TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Red Nova on February 14, 2020, 10:29:45 AM
-
Hi.
I have a dynamic block with attributes that needs to be tagged. I am reading attributes and then inserting a tag block which contains these attribute values as fields.
I know how to do it if I only need to insert fields that contain values of the attributes.
However, I cannot figure out a way to insert a field with a simple formula that will do some math with attribute values.
In the attached example:
"Deck" is the block that needs to be tagged.
It has 2 attributes: "THICKNESS" and "HEIGHT". Values are always numeric.
I am inserting block named "Tag".
Inserting values of "THICKNESS" and "HEIGHT" as fields works fine.
I also need to insert a field formula that will be = "HEIGHT" - "THICKNESS"
Hoping to get some help here.
Thank you
-
So after digging for couple more hours in the net I figured out the answer from here:
https://forums.augi.com/showthread.php?133449-Summing-values-from-attributes
The credit goes to Lee Mac, though he had it in a much more fancy way :)
(setq format "%lu2%pr4%zs8")
(setq Topping (strcat
"%<\\AcExpr "
"%<\\AcObjProp Object(%<\\_ObjId " (vl-princ-to-string(Get-ObjectID-x86-x64 (caddr (assoc "THICKNESS" attlst))))">%).TextString>% - %<\\AcObjProp Object(%<\\_ObjId " (vl-princ-to-string(Get-ObjectID-x86-x64 (caddr (assoc "HEIGHT" attlst))))">%).TextString>%"
" \\f \""
format
"\">%"))