CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 11026

CAD tip CAD tip # 11794:

   
Question CAD 
 %  platform  category 
Q - question

Undocumented code in field expression - MText contents without control characters.

A - answer With AutoCAD dynamic text fields you can transfer (link) properties of drawing objects and automatically connect DWG objects. So you can e.g. specify the contents of a text object by the contents of another, source object. Any change of one text object then causes updates of multiple texts in your drawing (e.g. on individual sheets in layouts).

For such transfers you can use the FIELD command or the field function inside the MText editor, choose the category Objects, select the source object (e.g. a Text) and in it select the requested property - e.g. Contents. This will generate the field expression string in the panel "Field expression" - e.g. %<‌\AcObjProp Object(%<‌\_ObjId 2203960724656>%).TextString>%. You can also copy this string manually (Ctrl+C/Ctrl+V) to any text in the same drawing and so create a dynamic link to the source object.

But sometimes you will also need to transfer also the contents of a paragraph text, but without its control characters for switching colors, fonts, columns and bullets. If you want to transfer a pure (plain) contents of a MText to an attribute or to a line text (DText), just replace the property ".TextString" with the undocumented (and unlisted) property ".Text" in the generated field expression (in its string). Then insert this modified expression to your drawing as a field or replace an existing text with it. A single-line text will be filled with full contents of the source Mtext, but without the control codes.

An example of a modified expression:

%<‌\AcObjProp Object(%<‌\_ObjId 2203960724656>%).Text>%

The full workflow is illustrated in the video:

ACADLT
100% *  CAD 
13.2.2018    16739×  
Prices - CAD eShop:
applies to: AutoCAD · AutoCAD LT ·

See also:
Tip 13740:Dynamic label with filesize of the current DWG file.
Tip 13737:Formatting leading zeros in AutoCAD fields (and automatic field update).
Tip 13712:Why do I have an inactive "thousands separator" item in AutoCAD text field formatting?
Tip 13522:LookupXLS - populating DWG texts from Excel spreadsheets.
Tip 13426:Use of alternative units for arithmetic in dimensions (without square brackets).


Back   All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Generate hatch patterns automatically from your DWG drawings with
HGEN 2006 More info


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist