CAD Forums > Land Lubber / Geographically Positioned

Change "Property Set" data using Lisp

(1/2) > >>

Rod:
As a follow on from this thread http://www.theswamp.org/index.php?topic=54433.0

My tests changing property set data in Autcoad Civil using lisp have been successful.

I am using the AecScheduleApplication COM object which is installed with Autocad architecture (and possibly installed with MEP).
Autocad architecture 2017 is installed on my machine as a trial (the trial has expired but this still works)

My test program read object data and placed it into the property set (which had already been defined and added to the objects but was empty)

I am yet to clean up the code, put in error checking and AEC version checking but here it is if anyone is interested.

Cheers, Rod.


--- Code - Auto/Visual Lisp: ---defun C:test ()  (setq ss (ssget))  (setq i 0)  (repeat (sslength ss)    (progn      (objdata2propset (ssname ss i))      (setq i (1+ i))    ) ;_ end of progn  ) ;_ end of repeat  (princ)) ;_ end of defun (defun objdata2propset (ent)  (setq tblname (car (ade_odgettables ent)))  (setq str (ade_odgetfield ent (car (ade_odgettables ent)) "FULLNAME" 0))  (setq vlaObj          (vlax-ename->vla-object ent)        acadObj         (vlax-get-acad-object)        schedApp        (vla-getInterfaceObject                          acadObj                          "AecX.AecScheduleApplication.7.9"                        ) ;_ end of vla-getInterfaceObject        propSets        (vlax-invoke-method schedApp 'PropertySets vlaObj)        psdName         "Road Name"        propSet         (vlax-invoke-method propSets 'Item psdName)        properties      (vlax-get-property propSet 'Properties)        propNameValList (reverse                          (vlax-for prop properties                            (if (= (vlax-get-property prop 'Name) "Road_Name")                              (vlax-put-property prop 'Value (vlax-make-variant Str))                            ) ;_ end of if                          ) ;_ end of vlax-for                        ) ;_ end of reverse  ) ;_ end of setq) ;_ end of defun

Rod:
Here is a video of it at work and a DWG and lisp that allows multiple selection.

Peter2:
Thanks Rod,
looks interesting. I hope that I can test it in the next time.

MSTG007:
Just wanted to share. It worked great! Even with 2018. Thank you again Rod!!!

MSTG007:
I know this is an old topic. But I was wondering if it was possible to make a popup box (selection dialog box) that lists the Object data fields instead of hard coding the field? The reason its hard to keep it hardcoded is because a lot of object data has different field names.

Navigation

[0] Message Index

[#] Next page

Go to full version