- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have a Lisp file (attached) that is be able to copy a default value from an attribute definition to an other default value. But because I must change a lot of blocks, I like to have a routine that is be able to do it automaticly for me. I copy into a existing drawing a default block and move the right attributes to the right locations, after that the new tool must make a selection (by Window) from all the extisting attributen definitions, copy the default values and the user must select the second window, so the tool can place all the default values to the right attribute definitions.
Old tool (one by one)
(defun c:CopyAttDefDefaultValue ()
(setq ent1 (car (entsel "Select first Attribute Definition: ")))
(if (and ent1 (eq (cdr (assoc 0 (entget ent1))) "ATTDEF"))
(progn
(setq ent1Data (entget ent1))
(setq tagName (cdr (assoc 2 ent1Data)))
(setq defaultVal (cdr (assoc 1 ent1Data)))
(setq ent2 (car (entsel "Select second Attribute Definition: ")))
(if (and ent2 (eq (cdr (assoc 0 (entget ent2))) "ATTDEF"))
(progn
(setq ent2Data (entget ent2))
(if (equal tagName (cdr (assoc 2 ent2Data)))
(progn
(setq ent2Data (subst (cons 1 defaultVal) (assoc 1 ent2Data) ent2Data))
(entmod ent2Data)
(princ "\nDefault Value copied."))
(princ "\nDe Attribute Definitions has not the same tagname.")))
(princ "\nNo second Attribute Definition selected.")))
(princ "\nNo first Attribute Definition selected."))
(princ))
Solved! Go to Solution.