Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Whew, it's been just over a year using LISP, but I'm finally getting into trying to make a decent application.
I am struggling with trying to trying to save a list of entity handles into an Xrecord. I have not been able to find a good example yet. I need some help.
Essentially I have 1 - 50+ entities that make up an object. I do not want to create a block with these entities because editing them would not work efficiently. Therefore, I would like to save a list of their handles (In Order!) in an Xrecord, so that I can reference this inside my custom dictionary next time the dwg is opened.
Any insight on the matter is appreciated. Here's what I have so far:
(defun c:TEST ( / myD myX) (setq myD (DictCheck)) (setq myX (AddXrec myD)) ;Do More Stuff (princ) );defun (defun DictCheck ( / return) ;tests if dictionary exists, if not creates it (if (not (setq return (dictsearch (namedobjdict) "MY_DICT"))) (setq return (dictadd (namedobjdict) "MY_DICT" (entmakex '((0 . "DICTIONARY") (100 . "AcDbDictionary"))))) (setq return (cdr (assoc -1 return))) );if );defun (defun AddXrec (dict / return x) (if (not (setq return (dictsearch dict "MY_XREC"))) (progn (setq x (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") ;Enter list here (maybe pass list into function?) ;(list h1 h2 h3 h4 h5) )));setq (setq return (dictadd dict "MY_XREC" x)) );progn ;else (setq return (cdr (assoc -1 return))) );if );defun
Best,
~DD
Solved! Go to Solution.