Field Code Formatting Codes

Field Code Formatting Codes

Kyudos
Advisor Advisor
3,971 Views
13 Replies
Message 1 of 14

Field Code Formatting Codes

Kyudos
Advisor
Advisor

I can't seem to find any comprehensive documentation of AutoCAD field formatting codes - all I seem to be able to discover is what third partties have 'worked out'.

 

Does anyone have a full specification? It's hard to come up with custom formats otherwise...

0 Likes
3,972 Views
13 Replies
Replies (13)
Message 2 of 14

devitg
Advisor
Advisor

Maybe it can help. From field and lisp

0 Likes
Message 3 of 14

Kyudos
Advisor
Advisor

Sorry for necro'ing this thread but...

 

I've had cause to look for this again, and still can find anything from AutoDesk 5 years later.

I mean, it seems pretty crucial to the use of field expressions - is there a reason AutoDesk haven't documented it?

 

 

0 Likes
Message 4 of 14

hak_vz
Advisor
Advisor

Check this link for more detailed fields format explanation.

There is no official documentation about this.

 

https://blog.bricsys.com/customizing-bricscad-coding-with-field-text-p20/ 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 5 of 14

Kyudos
Advisor
Advisor

Thanks I did see that page, it's useful, but not complete...e.g.:

 

"%qf is used by scale factors, but employs values I haven’t figured out yet"

 

I still don't understand why a years-old feature has zero documentation. How do AutoCAD expect people to use it?

 

 

Message 6 of 14

Anonymous
Not applicable

The only real way is do it manually and look at the string produced. Took ages to work out add multiple fields for attribute in block, was very simple in the end. 

0 Likes
Message 7 of 14

le-tan-phuc
Enthusiast
Enthusiast

thank you so much
I was happy to finally find the tutorial through your suggestion

0 Likes
Message 8 of 14

Sea-Haven
Mentor
Mentor

This took a while to work out add 2 attribute vales then put answer in a 3rd attribute, could be like att1 = length att2 = height att3 = area a "*" instead of "+".

; add 2 attributes and put the value as a field into the 3rd attribute.
; BY AlanH

(defun c:test ( / obj lst x )
(setq oldatt (getvar 'attdia))
(setvar 'attdia 0)
(command "-insert" "c" (getpoint "\npick point") 1 1 0 (getstring "\nEnter Att1 ") (getstring "\nEnter Att2 ") (getstring "\nEnter Att3 ") "-")
(setq obj (vlax-ename->vla-object (entlast)))
(setq lst '())
(foreach att (vlax-invoke obj 'getattributes)
(princ  "\n")
(setq lst (cons  (strcat "%<\\AcObjProp Object(%<\\_ObjId " 
(vlax-invoke-method (vla-get-Utility  (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString att :vlax-false)
">%).Textstring>%"
 ) lst ))
)
(setq str nil)
(setq x (length lst))
(setq str (strcat "%<\\AcExpr "
(nth (setq  x (- x 1)) lst) " + "
(nth (setq  x (- x 1)) lst) " + "
(nth (setq  x (- x 1)) lst) ">%"
)
)
(setq x 1 y 4)
(foreach att(vlax-invoke obj 'getattributes)
(if (= x y)
(Vla-put-textstring att str)
)
(setq x (+ x 1))
)
(setvar 'attdia oldatt)
(princ)
)
(c:test)


0 Likes
Message 9 of 14

khix
Contributor
Contributor

If you're still looking I made this. It's not everything, but it has most basic rounding and units

0 Likes
Message 10 of 14

Kyudos
Advisor
Advisor

Thanks, this is a good resource! But it is just re-emphasizing that AutoCAD still haven't officially, properly, documented this (to my knowledge), now a full DECADE after I first asked about it (and probably a decade before that? maybe more?). I could somewhat understand if field codes were an entirely undocumented feature that users had reverse engineered over a long period. But they are a 'official' feature of the product, with their own interface! AutoDesk are like "Here's a very useful feature. It even has a very flexible, if somewhat complicated, formatting system so you can get things displayed just the way you prefer. Here let me tell you have that all works........ Ha!Ha! JK you're on your own! Good luck!" 🙄

0 Likes
Message 11 of 14

Sea-Haven
Mentor
Mentor

Perhaps add the properties available like Area, Length, Radius and so on for objects maybe a table with ticks showing what is available.

 

You can also do stuff like sum two fields and get a result, 3 Attributes sum 2 and put result in third attribute.

0 Likes
Message 12 of 14

Kyudos
Advisor
Advisor

Surely someone at AutoDesk could get Claude to write the docs in next to no time?

0 Likes
Message 13 of 14

Sea-Haven
Mentor
Mentor

I am sure need more columns

SeaHaven_0-1787275455305.png

 

0 Likes
Message 14 of 14

khix
Contributor
Contributor

I posted about this elsewhere and was linked this resource: 

https://www.cadforum.cz/en/autocad-field-formatting-codes-full-list-tip15138