Permanent store unusual list structure, dictionary?

Fatfreek

Usenet Archive
Joined
Oct 26, 2000
Messages
96
Reaction score
0
The following list of lists, BoundsOrganized, is a list of closed LWpolyline handles. The structure of the list is:
((Major1 (list Secondaries1)(list Tertiaries1))
(Major2 (list Secondaries12)(list Tertiaries2)) etc., etc.)

Where a drawing consists of major polylines that enclose smaller polylines (secondary) that in turn may enclose smaller polylines (tertiary).

(
("179" (nil) (nil))
("143" ("3B1" "42D" "454") ("3AF" "3B0" "42C"))
("140" ("13F") (nil))
)

I would like to store such a list inside my drawing where I can retrieve it in subsequent sessions (dictionary technique?).

Some time ago a script of steps to enclose within a dictionary was posted under thread "Dictionary to store lists". And I tried to step through that script with my BoundsOrganized variable -- but failed. I suspect that my list may not be structured correctly since I get errors.

This novice is open to suggestions on any way to get my list in some kind of permanent drawing storage -- yes, I can restructure (if needed) the above list.

Len Miller
 
Not sure what you have tried but...

(setq data '(("someData" ("someMoreData") ("evenMoreData")))) (("someData" ("someMoreData") ("evenMoreData")))

(setq data (list (cons 1 (vl-prin1-to-string data))))
((1 . "((\"someData\" (\"someMoreData\") (\"evenMoreData\")))"))

(createdict "MyDict")
<Entity name: 41830280>

(addrecord "MyDict" "MyRecord" data)
<Entity name: 41830288>

(setq data (getrecord "MyDict" "MyRecord"))
((1 . "((\"someData\" (\"someMoreData\") (\"evenMoreData\")))"))

(read (cdr (assoc 1 data)))
(("someData" ("someMoreData") ("evenMoreData")))

(defun createdict (dictName / dictionary xname newdict) (if (not (dictsearch (namedobjdict) dictName)) (progn (setq dictionary '((0 . "DICTIONARY") (100 . "AcDbDictionary")) xname (entmakex dictionary) newdict (dictadd (namedobjdict) dictName xname) ) ) )
)

(defun addrecord (dictName key dataList / xname)
(setq dataList (append (list '(0 . "XRECORD") '(100 . "AcDbXrecord")) dataList) xname (entmakex dataList) ) (dictadd (getdictname dictName) key xname)
)

(defun getrecord (dictName key /)
(cdr
(cddddr (cddddr (dictsearch (getdictname dictName) key))) )
)

There are also the vlax-ldata* functions.
 
Beautiful sequence of steps, Jason. When I got through, I saved the drawing, brought it back to the editor, did the (setq data (getrecord .... --- and there it was.

Over time perhaps I can understand part of what's going on here -- but in the meanwhile I am more than satisfied.

Thanks very much for your patience.

Len Miller
 

Latest threads

Back
Top