firsrate_caduser Posted August 18, 2009 Posted August 18, 2009 Hello there!! I have a task of moving several objects to a frozen layer in several drawings, I was just thinking if there is a way to do that in a batch mode. I looked in this forum without any luck if there is a solution. I guess the lisp have to create a frozen layer and then move the object to that frozen layer. is this possible? thanks for any help! Meanwhile I am using the design center to insert the hidden layer and move the objects to that layer...it is taking me forever...lol. {( Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Yes, you can use VL to iterate through all open drawings and move objects as necessary, what objects need moving and to what layer? Quote
firsrate_caduser Posted August 18, 2009 Author Posted August 18, 2009 Thanks for the quick reply Lee Mac! Sorry for the ignorance, but what is "LV"? well there is two objects: One is a block with just Attributes. SYSM LAYER. Second are about 4 lines and 2 circle average in each drawing. N-LNWK-MEDM LAYER Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Firstly VL is Visual LISP. Are the objects to be moved on their own layer? How can they be determined from all the others in the drawings? Quote
firsrate_caduser Posted August 18, 2009 Author Posted August 18, 2009 that is the problem, I have to select the objects that I want to move to the frozen layer because there is other objects that I dont want to be on the frozen layer. It would be kind hard! ha! Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 If there is nothing that I could use to determine those objects then automation is out of the question I am afraid... A LISP could easily be made to speed up the manual selection process however... Quote
firsrate_caduser Posted August 18, 2009 Author Posted August 18, 2009 Yeah! I though that! but it would be nice to have a lisp that would create a hidden layer and select the objects that I need to move to that layer. thanks for you help!! Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Perhaps something like this may suffice: (defun c:mfrz (/ lay doc ss1 sel1 ss2 sel2) (vl-load-com) (setq lay (vla-get-layers (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))) (mapcar (function (lambda (Name) (if (not (tblsearch "LAYER" Name)) (vla-put-freeze (vla-add lay Name) :vlax-true)))) '("SYSM LAYER" "N-LNWK-MEDM LAYER")) (prompt "\nSelect Blocks for Layer: 'SYSM LAYER' ...") (if (setq ss1 (ssget '((0 . "INSERT") (66 . 1)))) (progn (vlax-for Obj (setq sel1 (vla-get-ActiveSelectionSet doc)) (vla-put-layer Obj "SYSM LAYER")) (vla-delete sel1))) (prompt "\nSelect Objects for Layer: 'N-LNWK-MEDM LAYER' ...") (if (setq ss2 (ssget '((0 . "LINE,CIRCLE")))) (progn (vlax-for Obj (setq sel2 (vla-get-ActiveSelectionSet doc)) (vla-put-layer Obj "N-LNWK-MEDM LAYER")) (vla-delete sel2))) (princ)) Quote
firsrate_caduser Posted August 18, 2009 Author Posted August 18, 2009 Thanks a millions!! it works just fine! can you modify to select arc, and polylines as well. thank you this would help me to speed up my work. Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 This also includes splines: (defun c:mfrz (/ lay doc ss1 sel1 ss2 sel2) (vl-load-com) (setq lay (vla-get-layers (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))) (mapcar (function (lambda (Name) (if (not (tblsearch "LAYER" Name)) (vla-put-freeze (vla-add lay Name) :vlax-true)))) '("SYSM LAYER" "N-LNWK-MEDM LAYER")) (prompt "\nSelect Blocks for Layer: 'SYSM LAYER' ...") (if (setq ss1 (ssget '((0 . "INSERT") (66 . 1)))) (progn (vlax-for Obj (setq sel1 (vla-get-ActiveSelectionSet doc)) (vla-put-layer Obj "SYSM LAYER")) (vla-delete sel1))) (prompt "\nSelect Objects for Layer: 'N-LNWK-MEDM LAYER' ...") (if (setq ss2 (ssget '((0 . "ARC,*LINE,CIRCLE")))) (progn (vlax-for Obj (setq sel2 (vla-get-ActiveSelectionSet doc)) (vla-put-layer Obj "N-LNWK-MEDM LAYER")) (vla-delete sel2))) (princ)) Quote
firsrate_caduser Posted August 18, 2009 Author Posted August 18, 2009 Lee Mac, thank you for you promt response and for you help!! this would help me a lot. Cheers... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.