Jump to content

Move layer to frozen layer


Recommended Posts

Posted

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. {:((

Posted

Yes, you can use VL to iterate through all open drawings and move objects as necessary, what objects need moving and to what layer?

Posted

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

Posted

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?

Posted

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!

Posted

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...

Posted

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!!

 

:)

Posted

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))

Posted

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.

Posted

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))

Posted

Lee Mac, thank you for you promt response and for you help!! this would help me a lot.

 

Cheers...:)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...