Author Topic: Writing field formula with block attribute values in another block attribute  (Read 335 times)

0 Members and 1 Guest are viewing this topic.

Red Nova

  • Newt
  • Posts: 69

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
« Last Edit: February 14, 2020, 10:34:40 AM by Red Nova »

Red Nova

  • Newt
  • Posts: 69
So after digging for couple more hours in the net I figured out the answer from here:
The credit goes to Lee Mac, though he had it in a much more fancy way :)

Code: [Select]
  (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 \""