TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on December 01, 2006, 02:57:21 PM
-
Hi all..
i'm trying to add an information on simple rectangle...
(setq i1 (entget (car (entsel))))
(setq idata (list (list -3 (list "test1"
(cons 1000 "test2")
)
)))
(setq i1 (append i1 idata))
(entmod i1)
this seem to work.....but not true...
because if i re-select the same rectangle buy using...
(setq i1 (entget (car (entsel))))
it return me all the data without the new XDATA added...
seem that entmod is not working...
do i'm right ?
-
Try this to get the XDATA:
(setq i1 (entget (car (entsel)) '("*")))
-
Why you don't use Vla-SetXData Mon_Rectangle
SetXData (XDataType, XDataValue)
@+
-
Thanks PAT...
but,.....can you give me an example ?
Thanks Jeff....but what "*" mean ? search all Xdata for the selected item ?
-
get the dxf xdate straight in your head before you venture into the ActiveX version ..
In Jeff's code the '("*") represents return ALL Xdata Application Names
in your case you could use
(setq i1 (entget (car (entsel)) '("test1")))
since "test1" was your xdata APPName
Have a play with something like these to learn ...
(defun put-xdata (appName Data / elst exdata)
;; codehimbelonga kwb@theSwamp
(regapp appName)
(setq elst (entget (car (entsel "\nSelect graphical entity: ")))
exdata (list (list -3 (cons appName Data)))
elst (append elst exdata)
)
(entmod elst)
)
(defun c:put-xdata1 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME" (list (cons 1000 "Test Data"))))
)
(defun c:put-xdata2 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME" (list (cons 1070 2))))
)
(defun c:put-xdata3 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME"
(list
(cons 1000 "DataList3")
(cons 1002 "{")
(cons 1070 3)
(cons 1000 "Test String 3")
(cons 1002 "}")
)
)
)
)
(defun c:put-xdata4 (/)
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME"
(list
(cons 1000 "DataList4")
(cons 1002 "{")
(cons 1070 4)
(cons 1000 "Test String 4 ")
(cons 1002 "}")
(cons 1000 "DataList4a")
(cons 1002 "{")
(cons 1070 44)
(cons 1000 "Test String 4a")
(cons 1002 "}")
)
)
)
)
(defun get-xdata (appName / myData)
;; codehimbelonga kwb@theSwamp
(setq myData
(cadr
(assoc
-3
(entget
(car
(entsel
"\nSelect graphical entity to extract Data : "
)
)
(list appName )
)
)
)
)
myData
)
(defun c:get-xdata (/ )
(setq entityData (get-xdata "TEST-APPLICATION-NAME" ))
)
(defun c:get-ACADxdata (/ )
;; for dimensions, etc
(setq entityData (get-xdata "ACAD" ))
)
(defun c:get-ALLxdata (/ )
(setq entityData (get-xdata "*" ))
)
-
but,.....can you give me an example ?
You have an answer here (http://www.theswamp.org/index.php?topic=8625.0)
@+
-
And once you've assimilated the posts above, Have a look here ...
http://www.theswamp.org/index.php?topic=4395.msg53028#msg53028
-
Thanks guys,,,, :-)