Do you know that you can attach volumes of
data to almost any object that is stored with the drawing. No it's not XDATA!
Let's attach some LDATA to the Modelspace
Object.
Note that we are not attaching the data to a line or a circle, but to Modelspace!!!!
In this example, we'll attached four integer,
three real numbers, two strings,
and (a partridge in a dotted pair tree).
(Coding very kindly donated by Peter Jamtgaard)
----------------------------
;CODING STARTS HERE
(defun C:VL-PUT-LDATA (/ ACADOBJ CDWGOBJ MSPCOBJ)
(setq ACADOBJ (vlax-get-acad-object)
CDWGOBJ (vlax-get-property acadobj "activedocument")
MSPCOBJ (vlax-get-property CDWGOBJ "modelspace")
)
(vlax-ldata-put MSPCOBJ "test"
'( 1 2 3 4 1.0 2.0 3.0 "TEST" "TEST1" (0 .
"INSERT"))
)
(vlax-release-object ACADOBJ)
(vlax-release-object CDWGOBJ)
(vlax-release-object MSPCOBJ)
(prin1)
)
(defun C:VL-GET-LDATA (/ ACADOBJ CDWGOBJ
MSPCOBJ)
(setq ACADOBJ (vlax-get-acad-object)
CDWGOBJ (vlax-get-property acadobj "activedocument")
MSPCOBJ (vlax-get-property CDWGOBJ "modelspace")
)
(print (vlax-ldata-get MSPCOBJ "test"))
(vlax-release-object ACADOBJ)
(vlax-release-object CDWGOBJ)
(vlax-release-object MSPCOBJ)
(prin1)
)
;CODING ENDS HERE
|