PDA

View Full Version : Can a Standards File Be Added via Lisp?


cadmancando
2007-10-17, 09:24 PM
I would like to ADD a DWS file?

Can I do this as well via LISP?

Mark

T.Willey
2007-10-17, 10:45 PM
I would like to ADD a DWS file?

Can I do this as well via LISP?

Mark

I'm sure you can, but you may want to start a new thread, as some people who may know how will not look in this thread. I don't know how off hand, and I don't have the time to research it.

Opie
2007-10-17, 11:00 PM
I'm sure you can, but you may want to start a new thread, as some people who may know how will not look in this thread. I don't know how off hand, and I don't have the time to research it.
Done. ;)

Now, hopefully, someone knows the answer.

T.Willey
2007-10-17, 11:35 PM
Turns out I have one by Robert Bell that I modified a little.

(defun AddDWS (FileN / DictN eDict XRInt)
;;;R. Robert Bell
;;; modified by Tim Willey

(setq DictN "AcStStandard"
eDict (cond
((cdr (assoc -1 (dictsearch (namedobjdict) DictN))))
((dictadd (namedobjdict) DictN (entmakex '((0 . "DICTIONARY") (100 . "AcDbDictionary")))))
)
)
(RemoveDws eDict FileN)
(if (setq XRInt (cdrs 3 (entget eDict)))
(setq XRInt (1+ (apply 'max (mapcar 'atoi XRInt))))(setq XRInt 0)
)
(dictadd eDict (itoa XRInt) (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") (cons 1 FileN))))
)

Looks like you might also need this one.

(defun RemoveDWS (DictCheck DictName / n vpl)

(setq DictCheck (entget DictCheck))
(setq n 0)
(while (nth n DictCheck)
(if (= (car (nth n DictCheck)) 350)
(setq vpl (append vpl (list (cdr (nth n DictCheck)))))
)
(setq n (1+ n))
)
(foreach item vpl
(if (= (value 1 (entget item)) DictName)
(entdel item)
)
)

)

And it looks like you will need this one. Man... too many subs to remember them all.

(defun VALUE (num ent /)
(cdr (assoc num ent))
)

RobertB
2007-10-17, 11:46 PM
Turns out I have one by Robert Bell that I modified a little.
Whoosh! Even forgot I wrote that one. Sheesh. Too much code, too few memory cells.

T.Willey
2007-10-17, 11:52 PM
Whoosh! Even forgot I wrote that one. Sheesh. Too much code, too few memory cells.

I used it a lot for a couple of weeks, then I decided that I didn't like the way standards works, and have not looked at it since. Thanks for it though, as when I needed it I had no idea how dictionaries worked.