Fields for Math in AutoCAD


Contents:
Overview ---- Body ---- Conclusion

1Overview
The Problem

The other day I had to work on a file in which there were numerous points of data that someone wanted to display in another way much like you can set a Dimension Style to display both Imperial and Metric Units.

I was in a terrible hurry and decided to see if I could just use a Field to solve my problem.  I got it to work and decided this trick might be of value to others.

To explain the problem better, here's what I was up against.  Another user had created labels using Mtext that contained specific dimensional values but someone else wanted to see mathematical modifications to those numbers so I needed a way to capture the value of the Mtext, modify it and product another value.

2Body
The Solution - Make a Formula Field and add a Field to it

In the illustration to the right I show that I have started a Field text and set the Field Category to Objects where I have selected Formula.

In the Formula box I use the right-click context menu to access the "Insert Field" menu option.  This action opens another Field dialog because it's a Field in a Field.

Select an Object for your Field

For the first part of my Formula Field, I used the Object option under the Field Names and then used the Select Object button under the Object Type value field.

I selected the Mtext that holds the number I want to work with (see top image to the right).

Show the Contents of the Object in your Field

Once the Mtext Object has been Selected, you should see several options for Property.  In the illustration to the right I show that I selected "Contents" in order to retrieve the actual written information in that Mtext.

Show the Contents of the Object in your Field Formula

Back on the original Field dialog I now have the Mtext value captured in the Formula box.  At this point I can now use mathematical statements to modify the value that I captured.

Modify the Contents of the Object in your Field Formula

In the example illustrated to the right I show that I added six (6) inches to the captured value and then divided the sum by twelve (12) inches to produce a result in inches.  Notice that I set the Format to "Decimal", the Precision to zero (0) and added the inch mark (") under the Additional Format... dialog as a Suffix.

To finish the work, I added the statement, "TO FINISHED FLOOR" as part of the Field but outside of the Field dialog; i.e., just as plain Mtext.

3Conclusion
The End

Among the many cool things this example demonstrates is the linking between numeric values.  If a person changes the 144'-6" value, the Field will automatically run the Formula and show the new value to "finished floor".

 

 

 

© Copyright 2011 ARCHIdigm. All rights reserved.
Disclaimer and Copyright Information

See this Page as Originally Intended