i am looking at updating an entity's object data table field with a selected geometry value of that entity. That is of am wanting to extract from the entity's property the x,y,z value and have that value assigned to a field in a table of an defined object data
Odd request, you want to add data to an entity that it already has? If you want entity data to be put in a (text) field you should be able to do that directly. Can you be more specific about what you're trying to do?
it is a large 3d file that is dynamic. i would like to extract z value from an object and have it placed in a field of an object data table automatically instead of manually editting field through property box. At the moment each time file is added to i have to manually insert data into field through the object property box and this is very time consuming.
refer to attached jpeg
red line is new 3d line object which i have assigned an odject data table to. i wish to update/extract the Z value of that line into a field of the table.
with 100s of new lines added each 3 monthly period you can see how time consuming it can become
Quick and dirty (without check)
((lambda ( / js_pl n_pl ent dxf_ent z_pl) (setq js_pl (ssget '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (100 . "AcDbPolyline")))) (cond (js_pl (repeat (setq n_pl (sslength js_pl)) (setq ent (ssname js_pl (setq n_pl (1- n_pl)))) (setq dxf_ent (entget ent)) (setq z_pl (cdr (assoc 38 dxf_ent))) (if z_pl (progn (ade_odaddrecord ent "Working_Floor_Contour") (ade_odsetfield ent "Working_Floor_Contour" "Height" 0 z_pl) ) ) ) ) ) ))
I am new to LISP and scripts. Have readup looking to run your Lisp but i am lost without the defun statement. unsure how to start it up.
i have come across a LISP that is similar to what i am looking to do and it has (defun z2_ODfield_Height () to start.
can you revise or provide me with help to run your version. is it a matter of just loading it up.
i have loaded up your version but get no change to z values
To make the code a permanent function (new Command) and not a temporary function (executable only once after load)
It is simply necessary to substitute:
((lambda ( / js_pl n_pl ent dxf_ent z_pl)
....
))
by
(defun C:z2_ODfield_Height ( / js_pl n_pl ent dxf_ent z_pl)
...
)
After loading, execute z2_ODfield_Height at command line
In this code, I assumed that the table was existent, I am only bringing to update the field "Height"
To test my function with only a slide is difficult for me...