Jairame
07-21-2010, 04:06 PM
Here's my problem:
I have a series of 518 drawings. I'll be using scriptpro to run through them all and apply a LISP routine to do the following:
Loop through all of the layers in the drawing, and if they are yellow, cyan or magenta, change them to green, blue and red respectively. I also need it to run through any and all elements in the drawing to do the same thing and also to (command "burst") all blocks to apply the same color change to them. Make sense?
I have this code for bursting the blocks:
(defun c:bust ()
;(setvar "qaflags" 1)
(setq AllBlocks (ssget "X" (list (cons 0 "INSERT"))))
(while (/= AllBlocks nil)
(progn
(sssetfirst nil AllBlocks)
(c:burst)
(setq AllBlocks (ssget "X" (list (cons 0 "INSERT"))))
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-SendCommand doc (chr 27))
);progn
);while
(princ)
);defun
And I have this code (only works for one color, not all 3) for changing the elements in the drawing (only works in either paper or modelspace, not both which I need it to do):
(defun c:pastel ()
(setq ylo (ssget "X" ' ((62 . 2))))
(while (/= ylo nil)
(progn
(command "_.change" ylo "" "p" "color" "green" "")
(setq ylo (ssget "X" ' ((62 . 2))))
);progn
);while
(setq cya (ssget "X" ' ((62 . 4))))
(while (/= cya nil)
(progn
(command "_.change" cya "" "p" "color" "blue" "")
(setq cya (ssget "X" ' ((62 . 4))))
);progn
);while
(setq mag (ssget "X" ' ((62 . 6))))
(while (/= mag nil)
(progn
(command "_.change" mag "" "p" "color" "red" "")
(setq mag (ssget "X" ' ((62 . 6))))
);progn
);while
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-SendCommand doc (chr 27))
(princ)
);defun
Anyone want to help me out? It would be much appreciated.
I have a series of 518 drawings. I'll be using scriptpro to run through them all and apply a LISP routine to do the following:
Loop through all of the layers in the drawing, and if they are yellow, cyan or magenta, change them to green, blue and red respectively. I also need it to run through any and all elements in the drawing to do the same thing and also to (command "burst") all blocks to apply the same color change to them. Make sense?
I have this code for bursting the blocks:
(defun c:bust ()
;(setvar "qaflags" 1)
(setq AllBlocks (ssget "X" (list (cons 0 "INSERT"))))
(while (/= AllBlocks nil)
(progn
(sssetfirst nil AllBlocks)
(c:burst)
(setq AllBlocks (ssget "X" (list (cons 0 "INSERT"))))
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-SendCommand doc (chr 27))
);progn
);while
(princ)
);defun
And I have this code (only works for one color, not all 3) for changing the elements in the drawing (only works in either paper or modelspace, not both which I need it to do):
(defun c:pastel ()
(setq ylo (ssget "X" ' ((62 . 2))))
(while (/= ylo nil)
(progn
(command "_.change" ylo "" "p" "color" "green" "")
(setq ylo (ssget "X" ' ((62 . 2))))
);progn
);while
(setq cya (ssget "X" ' ((62 . 4))))
(while (/= cya nil)
(progn
(command "_.change" cya "" "p" "color" "blue" "")
(setq cya (ssget "X" ' ((62 . 4))))
);progn
);while
(setq mag (ssget "X" ' ((62 . 6))))
(while (/= mag nil)
(progn
(command "_.change" mag "" "p" "color" "red" "")
(setq mag (ssget "X" ' ((62 . 6))))
);progn
);while
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-SendCommand doc (chr 27))
(princ)
);defun
Anyone want to help me out? It would be much appreciated.