Millsy29
15th Jul 2010, 01:38 pm
Hi everyone,
i have a lisp routine that i would like to alter to become more automated.
;* -------------------------- SUBROUTINE ------------------------------
(defun NEWSYSTEM ()
(cond
((= tagname "DRGNUM")(setq newdata drawingno))
((= tagname "CADFILE")(setq newdata cadfile))
((= tagname "REV")(setq newdata rev))
(T nil)
)
)
;* -------------------------- MAIN PROGRAM ------------------------------
(defun C:UPN (/ cadfile cadfilelen drawingno drawingrev drawingrevlen
rev field savefilename tagname newdata)
(setq cadfile (getvar "DWGNAME"))
(setq cadfilelen (strlen cadfile))
(setq drawingno (substr cadfile 1 (- cadfilelen 6)))
(setq drawingrev (substr cadfile 1 (- cadfilelen 4)))
(setq drawingrevlen (strlen drawingrev))
(setq rev (substr drawingrev drawingrevlen))
(setq field (entget (car (nentsel))))
(setq savefilename (cdr (assoc 1 field)))
(setq tagname (cdr (assoc 2 field)))
(NEWSYSTEM)
(setq field (subst (cons 1 newdata) (assoc 1 field) field))
(entmod field);modify database
(entupd (cdr (caddr field)));update entity without regen
(princ)
)
this allows me to select the title block attributes and change accordingly to the file name. (not trying to teaching you to suck eggs)
Now what i want it to do as all the title block is to search for block "A0-Sheet" "A1-Sheet" "A3-Sheet" then find "cadfile" attribute and automatically change and so of for the drawing no. and rev.
Can anybody help me with this?
Millsy
i have a lisp routine that i would like to alter to become more automated.
;* -------------------------- SUBROUTINE ------------------------------
(defun NEWSYSTEM ()
(cond
((= tagname "DRGNUM")(setq newdata drawingno))
((= tagname "CADFILE")(setq newdata cadfile))
((= tagname "REV")(setq newdata rev))
(T nil)
)
)
;* -------------------------- MAIN PROGRAM ------------------------------
(defun C:UPN (/ cadfile cadfilelen drawingno drawingrev drawingrevlen
rev field savefilename tagname newdata)
(setq cadfile (getvar "DWGNAME"))
(setq cadfilelen (strlen cadfile))
(setq drawingno (substr cadfile 1 (- cadfilelen 6)))
(setq drawingrev (substr cadfile 1 (- cadfilelen 4)))
(setq drawingrevlen (strlen drawingrev))
(setq rev (substr drawingrev drawingrevlen))
(setq field (entget (car (nentsel))))
(setq savefilename (cdr (assoc 1 field)))
(setq tagname (cdr (assoc 2 field)))
(NEWSYSTEM)
(setq field (subst (cons 1 newdata) (assoc 1 field) field))
(entmod field);modify database
(entupd (cdr (caddr field)));update entity without regen
(princ)
)
this allows me to select the title block attributes and change accordingly to the file name. (not trying to teaching you to suck eggs)
Now what i want it to do as all the title block is to search for block "A0-Sheet" "A1-Sheet" "A3-Sheet" then find "cadfile" attribute and automatically change and so of for the drawing no. and rev.
Can anybody help me with this?
Millsy