Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

updating an entity's object data

6 REPLIES 6
Reply
Message 1 of 7
SABUO
928 Views, 6 Replies

updating an entity's object data

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

6 REPLIES 6
Message 2 of 7
TomBeauford
in reply to: SABUO

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?

 

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
Message 3 of 7
SABUO
in reply to: TomBeauford

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

Message 4 of 7
CADaSchtroumpf
in reply to: SABUO

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)
          )
        )
      )
    )
  )
))

 

Message 5 of 7
SABUO
in reply to: CADaSchtroumpf

Thanks very much. Will give it a g. Let you now how i went
Message 6 of 7
SABUO
in reply to: CADaSchtroumpf

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

Message 7 of 7
CADaSchtroumpf
in reply to: SABUO

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...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost