COPYTOLAYER - COPY OBJECTS IN A DRAWING TO MULTIPLE DESTINATION LAYERS

COPYTOLAYER - COPY OBJECTS IN A DRAWING TO MULTIPLE DESTINATION LAYERS

Anonymous
Not applicable
2,858 Views
3 Replies
Message 1 of 4

COPYTOLAYER - COPY OBJECTS IN A DRAWING TO MULTIPLE DESTINATION LAYERS

Anonymous
Not applicable

I haven't used LISP files yet.

It looks pretty easy to load them, I just don't know the coding.

Using the "COPYTOLAYER" command, I would like to be able to select objects and copy them to multiple destination layers by selecting them in the dialog box that appears. The "COPYTOLAYER" command only allows one destination layer to be selected at a time instead of multiple layers. I have tried using the "SHIFT" and "CONTROL" keys but this did not work. I use this command often but as it stands, I have to select the objects and use the command over and over and over again. 

 

Just a thought, Is there a command that lets you "Reselect Last" or something of this nature if selecting multiple layers is not possible?

 

Thank you for your help.

0 Likes
Accepted solutions (2)
2,859 Views
3 Replies
Replies (3)
Message 2 of 4

David_W_Koch
Mentor
Mentor
Accepted solution

@Anonymous

I cannot think of a programmatic reason why multiple layers could not be selected, other than it would complicate things when you get to the displacement part, if you did not want all of the copies in the same spot.  But the fact remains that the program behind that command was not written to allow selection of multiple layers.

 

After running the command once, if you want to copy the same objects to a different layer, run the command again, and when prompted to select objects, type p (for Previous) and press the Enter key.  That will re-select the objects previously selected.  That works across nearly all (maybe all?) AutoCAD commands that prompt for a selection set, provided that there is a previous selection set active.  So it won't work the first time you are prompted to select objects in an AutoCAD session and will not work if the last command you ran deleted the items you selected, such as the ERASE command.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try this simple lisp... pick layers one by one, confirmed by OK or <enter>

 

(defun c:MCopyToLayer ( / ss)
  (if (setq ss (ssget))
    (while
      (progn
        (initcommandversion)
        (command "_.COPYTOLAYER" ss "" "_Name")
        (if (> (getvar 'CMDACTIVE) 0)
          (not (command "_X"))))))  ; T for while
  (princ)
  )
Message 4 of 4

Anonymous
Not applicable

THAT IS AWESOME!!!

I really need to start learning how to write LISP routines.

It works perfectly.  Thank You!

 

I am setting up home plans that send layers to PDF and in the PDF activating a specific layer such as a "Garage Type"

or a particular "2nd floor layout" will change the Elevations; Foundation Plan, Floor Plan and so on. Each Base Plan has a ton of options and about 6 "Styles". These are all layered on one PDF  and each option is one click and it changes the plan in its entirety.  I often need to copy objects to multiple different layers to make the "one click" work.  That is why I needed this. Before I would need to start copytolayer over and over and over again. NOT ANYMORE!!!

Thank you so much!

0 Likes