Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
How can we update a formula field with the help of Lisp after copying it?
Thank you for your help.
Solved! Go to Solution.
Hi
How can we update a formula field with the help of Lisp after copying it?
Thank you for your help.
Solved! Go to Solution.
Not sure about your question.
A field in this example is using an object ID so each one is different hence using a Area.lsp.
If you want say sq Metres not mm then again its in the field formula adjust in code.
Hi
In the first field, the formula is used as follows:
(Area of polygon 1 * Layer 1 text content)
I want to copy the initial field for the next polygon after selecting new polygon updated copied field:
(Area of polygon 2 * Layer 2 text content)
Is this possible by Lisp?
@neam wrote:
..I want to copy the initial field for the next polygon after selecting new polygon updated copied field:
...
In the sample drawing you posted, Both Field1 and Field2 shows the value of the LWPOLYLINE area multiplied by the layer name, but has nothing to do with each other. So i dont get the question.
Somehow the way you explain it is similar to how the the Jeremy Bearimy Timeline works. and yes it broke me too. 😄
I edited field 2 manually.
Please, if possible, this edit should be done by Lisp program:
1- select field 2.
2- select new polygon.
3- update items in field 2 (area and layer name).
😁😁😁
@neam wrote:
I edited field 2 manually.
Please, if possible, this edit should be done by Lisp program:
1- select field 2.
2- select new polygon.
3- update items in field 2 (area and layer name).
I'm not sure if what you shown on the drawing is what the final product would be
omg 😢😢
I create one field for one polygon.
copy this field to others polygons.
Updated copied fields by click on polygon.
@neam wrote:
omg 😢😢
- Does that mean copy the Mtext, create a line and update MTEXT string value?.
- answer: NO
I create one field for one polygon.
copy this field to others polygons.
Updated copied fields by click on polygon.
The answer is YES to that question, other wise there would be nothing to update. The reason i'm asking this is to know if the program also needs to include the creation of the LINES/MTEXT as the user pick a polygon.
Thank you for understanding what I mean by my poor English.
In response to the second part of your post, we must say that it will be great.
Here's a simple demo
(Defun c:demo ( / lw p1 p2 _LWArea LW_ID mt )
(if
(and
(setq LW (ssget "_+.:S:E:L" '((0 . "LWPOLYLINE")(8 . "##,###"))))
(setq p1 (getpoint "\nPick target point"))
(setq p2 (getpoint p1 "\nText Location"))
)
(progn
(setq LW_ID (itoa (vla-get-ObjectID (setq ev (vlax-ename->vla-object (ssname LW 0))))))
(setq _LWArea
(strcat
"%<\\AcObjProp Object(%<\\_ObjId " LW_ID
">%).Area>%")
)
(setq str
(strcat "%<\\AcExpr "
"(("
_LWArea ")*"
(vla-get-layer ev)
") \\f \"%lu2%pr2\">%"
)
)
(entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))
(setq mt (entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 p2)
(cons 1 "X")))
)
(vla-put-textstring (vlax-ename->vla-object mt) str)
)
)
(princ)
)
HTH