Jump to content

Field Formula


phjlc

Recommended Posts

Hi, I usually do Levels point as field where as Level of the block is displaying as shown below

 

image.png.9e0674f1bcbe3f54c855a4edaf2c7d0f.png

this is the field expression %<\AcObjProp Object(%<\_ObjId 2125408804544>%).InsertionPoint \f "%lu2%pt4%pr3">%

 

but this only work on Meters as the unit of the drawing, 

 

so the problem occurs when the drawing that I working on is in Milimeters, but I still need to show the levels in Meters, 

 

I used the formula here as follow

image.png.8982d26bd176f58d8ed6e323c411d949.png

this is the field expression %<\AcExpr (%<\_FldPtr 2124231006640>%*.001) \f "%lu2%pr3">%

 

but I notice that this field expression doesn't use Object Id rather, it uses FldPtr,

 

can anyone guide me for creating this so I can apply this in the attribute within a block, my code that concerned this is as follows:

 

(vla-put-textstring Atr1 (strcat "+" "%<\\AcExpr (%<\\_FldPtr " Fldptr1 ">%*.001) \\f ""\"%lu2%pr3""\">%"))

;; Atr1 - Attribute to be placed this field
;; Fldptr1 - Field Pointer

 

 

Link to comment
Share on other sites

The field pointer is the pointer to the nested field expression (i.e. in this case, the field expression which returns the insertion point coordinate value), and so the field expression would be constructed as follows:

 

(vla-put-textstring Atr1 (strcat "+" "%<\\AcExpr (%<\\AcObjProp Object(%<\\_ObjId " ObjectID ">%).InsertionPoint \\f \"%pt4\">%*.001) \\f ""\"%lu2%pr3""\">%"))

 

 

 

  • Like 2
Link to comment
Share on other sites

It worked perfectly thanks Lee Mac, just one more question, what's the difference between "%pt4" to "%lu2%pt4%pr3", 

 

Link to comment
Share on other sites

32 minutes ago, phjlc said:

It worked perfectly thanks Lee Mac, just one more question, what's the difference between "%pt4" to "%lu2%pt4%pr3",

 

You're welcome.

 

%pt4 obtains a specific coordinate value, %lu2 applies units formatting (similar to LUNITS) and %pr3 applies precision formatting (similar to LUPREC). Since formatting is not required prior to multiplication, I omitted these from the nested field expression.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...