CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 4743
Place your Ad on CADforum.cz

CAD tip CAD tip # 3676:

   
Question CAD 
 %  platform  category 
Q - question

Advanced formatting of AutoCAD 2005/2006/2007 fields.

A - answer Control codes in automatic text fields introduced in AutoCAD 2005 (the FIELD command) allow some detailed options which are not available in the standard user interface.

Fortunately, you can enter the field code manually (or by pasting) anywhere in the MText editor, when entering DText or in the DDEDIT dialog. Using this method, you can use some advanced formatting to your field values - see some examples:

  • %<\AcVar osmode \f "%X">%
    - displays OSMODE value as hex code

  • %<\AcDiesel test$(/,5,2) bbb \f "%tc4">%
    - displays DIESEL string expression with uppercase initials

  • %<\AcDiesel $(edtime,$(getvar,tdindwg),$(+,$(*,24,$(fix,$(getvar,tdindwg))),$(edtime,$(getvar,tdindwg),HH)):MM:SS)>%
    - displays total edit time (hh:mm:ss) spent on this drawing

  • %<\AcObjProp Object(%<\_ObjId 2130116872>%).Length \f "%ds33">%
    - uses "!" as decimal separator in object length (ASCII code 33)

  • %<\AcObjProp Object(%<\_ObjId 2130100448>%).Area \f "%.3f">%
    - displays object area to 3 decimal places (independently on LUPREC setting)

  • %<\AcObjProp Object(%<\_ObjId 2130042784>%).Area \f "%lu2%ct4%qf1%PR0 sq.ft.">%
    - displays object area in sq.ft. rounded (to 0 decimal places)

  • %<\AcObjProp Object(%<\_ObjId 2130276472>%).Area \f "%lu2%pr2%ps[area is , sq.m]%ds44%zs8%ct8[1234]%th32">%
    - displays the area rounded to 2 decimal places, with prefix "area is " and suffix " sq.m", decimal separator will be "," thousands will be separated by spaces, trailing zeroes will be suppressed, values will be multiplied by 1234 (A2007)

  • %<\AcObjProp Object(%<\_ObjId 2130112520>%).CustomScale \f "1\"=%lu2%ct1%qf28161'">% - displays viewport scale in the 1"=20' format

  • %<\AcDiesel $(upper,$(edtime, $(getvar, tdcreate),DD. MONTH YYYY))>%
    - displays drawing creation date in uppercase ("16. APRIL 2004")

  • %<\AcObjProp Object(%<\_ObjId 2130022304>%).Coordinates \f "%pt2">%
    - displays Y-coordinate of the selected POINT object

  • %<\AcObjProp Object(%<\_ObjId 2130022304>%).Coordinates \f "%pt4%ct8[0.001]">%
    - displays in [m] the [mm] Z-coordinate of the selected object (divides by 1000)
    - for block attributes: in the BEDIT mode, add a preset attribute a set its value to (Y-coord, A2007):
    %<\AcObjProp.16.2 Object(?BlockRefId,1).InsertionPoint \f "%pt2%.30q0%ct8[0.001]">%


Please note that you can also insert the %<\Ac-codes>% as DTEXT in AutoCAD LT (2005 and higher).

For other ways of flexible automatic labelling and linking object properties see LiveLabel by CAD Studio (also available for AutoCAD 2004 and 2002).

ACAD2007ACAD2005ACAD2004LTMapADT
100% *  CAD 
22.3.2004    55360×  
Prices - CAD eShop:

See also:
Tip 13744:Simple password protection of Inventor documents (iLogic).
Tip 13740:Dynamic label with filesize of the current DWG file.
Tip 13737:Formatting leading zeros in AutoCAD fields (and automatic field update).
Tip 13712:Why do I have an inactive "thousands separator" item in AutoCAD text field formatting?
Tip 13522:LookupXLS - populating DWG texts from Excel spreadsheets.


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 glossary   



Featuring:
Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info


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