Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

updating an entity's object data

updating an entity's object data

Anonymous
Not applicable
1,692 Views
6 Replies
Message 1 of 7

updating an entity's object data

Anonymous
Not applicable

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

0 Likes
1,693 Views
6 Replies
Replies (6)
Message 2 of 7

TomBeauford
Advisor
Advisor

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
0 Likes
Message 3 of 7

Anonymous
Not applicable

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

0 Likes
Message 4 of 7

CADaSchtroumpf
Advisor
Advisor

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

Anonymous
Not applicable
Thanks very much. Will give it a g. Let you now how i went
0 Likes
Message 6 of 7

Anonymous
Not applicable

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

0 Likes
Message 7 of 7

CADaSchtroumpf
Advisor
Advisor

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

0 Likes