CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
New CADforum look launched.
Over 1.081.000 registered users (EN+CZ). New 1D nesting and 3D nesting tools, updated Color converter. New AutoCAD 2025 commands and variables. Learn about twiGIS.

CAD tip CAD tip # 7003:

Question

CAD 
 %  platform  category 
A
If you want to insert a text in your drawing (e.g. to the title block) which contains a manipulated name of the current drawing file - e.g. the filename left-trimmed or right-trimmed at a number of characters, you can use a combination of Diesel expressions in an automatic text field (e.g. with the FIELD command).

Some examples:

Drawing file name, no path, from the 3rd character (paste as a Diesel expression to a Diesel-type field):

  
$(substr,$(getvar,DWGNAME),3,99)  
Drawing file name, no path, no extension (4 characters), right-trimmed at another 3 characters (paste as a Diesel expression to a Diesel-type field):
  
$(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))  
Beginning of the drawing path (12 characters), ellipsis, first 8 characters of the drawing file name (paste as a Diesel expression to a Diesel-type field):
  
$(substr,$(getvar,DWGPREFIX),1,12)...$(substr,$(getvar,DWGNAME),1,8)  
Path without the disk letter and the drawing file name, all converted to uppercase (paste as a Diesel expression to a Diesel-type field):
  
$(upper,$(substr,$(getvar,DWGPREFIX),3)$(getvar,DWGNAME))  
ACADLTADT
100% *CAD
19.10.2009    34018×  
Prices - CAD eShop:

See also:
Tip 14307:How do I generate EDU licenses for the Autodesk license server?
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).
Tip 13788:Green square - mathematical charade and parametric constraints in AutoCAD.


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:
Use Google Earth images in your AutoCAD projects with the Plex.Earth Tools 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