CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products []
CZ | EN | DE
Login or
  Visitors: 2671
Plex.Earth connects AutoCAD and Google Earth

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:

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

See also:
Tip 13426:Use of alternative units for arithmetic in dimensions (without square brackets).
Tip 13006:Calculated property descriptions (tobogan slide from floor to floor)
Tip 11171:Total number of layouts as a field (Page 3 of 7).
Tip 10889:How to get user's full domain name, phone No., department, e-mail...
Tip 9619:How to get rid of "----" in empty fields?

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   

Add .CIT raster format support to AutoCAD and Map and Civil 3D
CITin 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.