Author Topic: vlax-ldata vs dictionary  (Read 4111 times)

0 Members and 1 Guest are viewing this topic.

Patrick_35

  • Bull Frog
  • Posts: 276
  • Rennes, France
vlax-ldata vs dictionary
« on: August 31, 2007, 07:37:43 AM »
Hello

I seek to find the information written with vlax-ldata, but by using the dictionaries, this with an aim of being able to recover this information via objectdbx

For example, if I make
Code: [Select]
(vlax-ldata-put "Test" "01" "A_String")I find the dictionary with
Code: [Select]
(setq dict (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "Test"))A (vla-get-count dict) return 1
if I make
Code: [Select]
(vlax-ldata-put "Test" "02" "A_Secund_String")A (vla-get-count dict) return 2
Therefore, information is well stored in the dictionary.
But I don't find the values “A_String” and “A_Secund_String”
I do one (vla-getxdata (vla-item dict “01”) “” 'aa 'bb) and aa-> Nil, bb - > Nil :(

Thanks

@+
« Last Edit: August 31, 2007, 07:49:50 AM by Patrick_35 »
The shape even of the pyramids of Egypt shows that already the workmen tended to make some less and less.
Will Cuppy, 1884-1949.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10339
Re: vlax-ldata vs dictionary
« Reply #1 on: August 31, 2007, 09:05:36 AM »
Does thes get you any closer?
Code: [Select]
(defun c:test ()
  (setq myDict (dictsearch (namedobjdict) "Test"))
  (setq myDict (cdr (assoc -1 myDict)))
  (while (setq xitem (dictnext myDict (not xitem)))
    (setq xdata (cons xitem xdata))
  )
  xdata
)

Note that vla-getxdata works with an object. See help:
Quote
Gets the extended data (XData) associated with an object.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Patrick_35

  • Bull Frog
  • Posts: 276
  • Rennes, France
Re: vlax-ldata vs dictionary
« Reply #2 on: August 31, 2007, 09:22:38 AM »
Thank cab
your lisp work fine, but I would like to work with the vlisp because I wish to recover information written by vlax-ldata with objectdbx

@+
The shape even of the pyramids of Egypt shows that already the workmen tended to make some less and less.
Will Cuppy, 1884-1949.

zeha

  • Guest
Re: vlax-ldata vs dictionary
« Reply #3 on: August 31, 2007, 09:36:59 AM »
Try this
Code: [Select]
(vlax-ldata-put "Test" "01" "A_String")
(vlax-ldata-put "Test" "02" "A_Secund_String")
(vlax-ldata-list "Test");(("02" . "A_Secund_String") ("01" . "A_String"))
(vlax-ldata-put "YourAPP" "YourLabel" (cons "YourItem" "1234"))
(vlax-ldata-list "YourAPP");("YourItem" . "1234")
(vlax-ldata-put "YourAPP" "YourLabel" (cons "YourItem" "5678"))
(vlax-ldata-list "YourAPP");("YourItem" . "5678")
(vlax-ldata-put "YourAPP" "YourSecondLabel" (cons "YourSecondItem" "9-10"))
(vlax-ldata-list "YourAPP");(("YourSecondLabel" "YourSecondItem" . "9-10") ("YourLabel" "YourItem" . "5678"))

(cdr (assoc "YourLabel"(vlax-ldata-list "YourAPP")));("YourItem" . "5678")
(cdr (assoc "YourSecondLabel"(vlax-ldata-list "YourAPP")));("YourSecondItem" . "9-10")
;;And then delete

;(mapcar '(lambda(x)(vlax-ldata-delete "YourAPP" (car x)))(vlax-ldata-list "YourAPP"))
(vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "YourAPP")

Cheers
Harrie
« Last Edit: August 31, 2007, 01:41:03 PM by Daron »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10339
Re: vlax-ldata vs dictionary
« Reply #4 on: August 31, 2007, 09:49:51 AM »
Welcome to TheSwamp Harrie 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Patrick_35

  • Bull Frog
  • Posts: 276
  • Rennes, France
Re: vlax-ldata vs dictionary
« Reply #5 on: September 03, 2007, 06:50:52 AM »
Thank Harrie
I know vlax-ldata-get, vlax-ldata-list, vlax-ldata-delete and vlax-ldata-test but i can't use us with objectdbx

I try to explain me, but it's not easy
Objectdbx gives access a drawing without opening it. Here an example to draw a line without opening the drawing “c: /test.dwg”

Code: [Select]
(defun Ouvrir_dessin_dbx(dwg / dbx)
  (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
    (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument"))
    (setq dbx (vlax-create-object (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2))))
  )
  (vla-open dbx dwg)
  dbx
)

(setq Dbx (ouvrir_dessin_dbx "c:/test.dwg"))
(setq bl (vla-item (vla-get-blocks Dbx) "*Model_Space"))
(vla-addline bl (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point '(50.0 50.0 0.0)))
(vla-saveas Dbx "c:/test.dwg")
(vlax-release-object Dbx)
   
Now, I wish to make the same thing, but by recovering the information written by the vlax-ldata in this same drawing, of or the attempt to use dictionaries

@+
The shape even of the pyramids of Egypt shows that already the workmen tended to make some less and less.
Will Cuppy, 1884-1949.

FengK

  • Guest
Re: vlax-ldata vs dictionary
« Reply #6 on: September 03, 2007, 03:16:16 PM »
fyi, i remember seeing a lot of discussion in Autodesk NG that says compared with xdata and dictionary, ldata is not good to use.

Patrick_35

  • Bull Frog
  • Posts: 276
  • Rennes, France
Re: vlax-ldata vs dictionary
« Reply #7 on: September 05, 2007, 07:04:33 AM »
Thank you

So, if I understands well, not solution  :-(

@+
The shape even of the pyramids of Egypt shows that already the workmen tended to make some less and less.
Will Cuppy, 1884-1949.