The basic idea is to create an elevation marker which measures and displays the elevation (distance in meters) from the project zero (from the current UCS’s X axis) in the Block’s Attribute Definition after the placement. It works like this:
In the Model I specify the section’s zero elevation as the origin of the new UCS’s X axis, then I Copy/Paste or Insert the elevation marker as many times I need, finally I put back the UCS (set the WCS).
The current Default Value of the Attribute Definition consist of an Object/Formula Field (let’s call it A) which consist of another two fields.:
The first one is Object/Block Placeholder/Position Field (let’s call it Insertion point) which displays the distance between the Reference Point of the Block and the X axis of the WCS in millimeters.
The second one is Other/SystemVariable/UCSORG Field (let’s call it UCSORG) which displays the distance between the X axis of the current UCS and the X axis of the WCS in millimeters too.
The whole Formula of the Field A looks like this:
ROUND((InsertionPoint-UCSORG)/5)*5/1000
Then the whole Field Expression is this:
%<\AcExpr (ROUND((%<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%lu2%pt2%pr3">% -%<\AcVar ucsorg \f "%lu2%pt2%ds44">%)/5)*5/1000) \f "%lu2%pr3%ds44">%
The first flaw is that after the Regeneration of the drawling the results are recalculated based on the current UCS or WCS. By BURSTing the Markers after the placement or by placing the whole section to the X axis of the WCS the problem is solved but I hope that it can be done more… elegantly.
The second flaw is that the measurements are displayed without the - + ± signs in front (except the -).
The basic idea is to Insert another Field (to the front of the Absolute Value of Field A) which will displays the correct “prefix” based on whatever the elevation is negative, positive or zero.
Based on my experiences with MS Excel it could be done by an “IF-THEN” kind of function so I searched for a Field with similar functionality.
As far as I know the only Field capable doing this is Other/DieselExpression Field but two Fields and a ABS() Formula have to be added. For this a simpler version of the basic A Field would be used, just the subtraction of the InsertionPoint and UCSORG Fields without rounding it off and dividing by a thousand (let’s call it B).
The whole Field Expression of the B Field is this:
%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%lu2%pt2%pr3">%-%<\AcVar ucsorg \f "%lu2%pt2%ds44">%) \f "%lu2%pr3%ds44">%
The DieselExpression Schematically should look like this.:
$(IF,B,$(IF,$(+,ABS(B),-B),-,+),%%P)
Basically it means: IF B is even to zero, THEN display ±, OTHERWISE, IF Absolute Value of B minus B is even to zero, THEN display +, OTHERWISE display -.
To make it work, the ABS() Formula have to be added as a Field Expression.:
$(IF,B,$(IF,$(+,%<\AcExpr (ABS(B))>%,-B),-,+),%%P)
And the B Fields as well.:
$(IF,%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%lu2%pt2%pr3">%-%<\AcVar ucsorg \f "%lu2%pt2%ds44">%) \f "%lu2%pr3%ds44">%,$(IF,$(+,%<\AcExpr (ABS(%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%lu2%pt2%pr3">%-%<\AcVar ucsorg \f "%lu2%pt2%ds44">%) \f "%lu2%pr3%ds44">%))>%,-%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%lu2%pt2%pr3">%-%<\AcVar ucsorg \f "%lu2%pt2%ds44">%) \f "%lu2%pr3%ds44">%),-,+),%%P)
It works… if I use just numbers in the DieselExpression Field (0’s result is ±; 1’s result is +; -1’s result is -) Displays the correct signs instantly after closing the Diesel Expression Field, but when I use the Formula’s Field Expression and I reenter it, the inner Fields are simplified to the actual results of the Fields. It turns them to invariants.
I also tried out an AutoCAD add-on called AutoField because it also has additional IF function but neither supports adding inner Fields and Formulas. And there is the point where I am stuck.