CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 2239 

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    2027×  
Prices - CAD eShop:
applies to: AutoCAD · AutoCAD LT ·

See also:
Tip 11171:Total number of layouts as a field.
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?
Tip 8951:Multicolor dimension texts in AutoCAD.
Tip 6644:Displaying layout name in dynamic text fields.


Back   All CAD Tips All CAD tips&tricks

What is the difference between ThisDoc.Document and ThisApplication.ActiveDocument in iLogic? « | » How to get a hi-res image of an Inventor assembly (for a brochure, billboard...)?

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:
Export 3D VRML scenes from AutoCAD and Inventor 2015
VRMLout More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist