CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.095.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 13006:

Question

CAD 
 %  platform  category 
A
For one of our customers we solved a problem of dynamic labels for the drawing content. Although this was a different, more professional application, let's look at a similar problem with the labeling of the tubes of a tobogan water slide leading from one floor of one building to another floor of another building.

You can see an example of the result, generated labels like "tobogan tube leads from floor X to floor Y", at the beginning of the video tutorial. Basically, we need to display the recalculated Y-coordinate value of the start and end points of the selected spline curve or 3D pipe. There are several sub-problems that arise in the solution of the main task:

  1. How to associatively relate the shape of the 3D sweep object to the shape of the control spline curve (because 3D objects have no "ends"). Here we need to use the Surface mode in the SWEEP command, because in the default Solid mode the original curve disappears.
  2. How to get the coordinates of the start and end point of the spline curve in the Field dialog - they are not offered in the property list. We can help here by copying the field expression for the selected object (use the tangent value, for example) and then modifying the property code to the desired start (StartPoint) or end (EndPoint) point - so we basically use just the ObjId from the original field code. You can then insert the text of the semi-manual field into the standard TEXT command. In the field formatting options, we choose a decimal precision of 0 (%pr0, for subsequent recalculation of the floor number) and of course only the Y-component of this coordinate, i.e. %pt2.

    An example of such text field code:

    %< \AcObjProp Object(%< \_ObjId 2550833060576>%).Startpoint \f "%lu2%pt2%pr0">%

  3. But displaying the Y-coordinate is not enough, we need to convert it to a floor number. To do this, we just need to use a combined field of the type Expression, containing a reference to the original property field (Y-coordinate, we can insert our manually created field code here), divided by the numeric value of the floor height. For correct rounding (number of decimal places=0), we will correct it by half a floor.
  4. Finally, we'll assemble the label from several DText objects, or use MText with embedded calculated fields.

Video demonstration:

Sample DWG drawing for download:

Block 21621

ACADADTMech
100% *CAD
7.7.2021    39681×  
Share the tip:
Digg it! Del.icio.us Facebook Twitter Google bookmark Technorati StumbleUpon
applies to: AutoCAD · AutoCAD Architecture · Mech ·

See also:
Tip 14537:Automation of AutoCAD drawing texts using fields.
Tip 14446:Undocumented options in AutoCAD FIELDs - hyperlinks, hexadecimal or binary format
Tip 14215:IF statement in AutoCAD text fields and attributes.
Tip 14039:How to display the total volume or surface of 3D solids in DWG?
Tip 13996:Automatic hide for Revit palettes - save screen space (undocumented).


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
  



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


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