Lisp routine to move multiple items to different layer and back to original

Lisp routine to move multiple items to different layer and back to original

Anonymous
Not applicable
1,105 Views
5 Replies
Message 1 of 6

Lisp routine to move multiple items to different layer and back to original

Anonymous
Not applicable

I'm looking for a lisp routine that will allow me to select multiple items in a drawing, then put them on a common layer.  And later, be able to return them to their original layer.

 

I want to move selected items to an "existing" layer that would be a grey color, then be able to return them to their original layers/settings at a later date.

 

Does anybody have something like that?? Or can give me some direction as to how to create it?  I'm a very modest lisp programmer.

 

Thank-you

0 Likes
1,106 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

Can you make a copy  of all of it, and change the copies  to the existing Layer, and just turn off the original Layers when you want them to show on the existing Layer, and vice versa?

 

I don't think you can do what you're asking, exactly -- once something is changed to a different Layer, AutoCAD has no way of knowing which Layer it was on before.  And you can't make something like an AutoLisp selection set of the ones from each Layer involved, if by "at a later date" you mean in a different editing session, because the selection set variable will die when the drawing is closed.

 

But another possibility would be to make a Layer with something distinctive like "-EX" added to the end [or "EX-" to the beginning?] of its name for every Layer used among the objects in question, all with the grey color.  That would make them "returnable," because their new Layers' names would contain the names of their original Layers.  Another -- make a Block of all objects on a given original Layer, with that Layer name used as the Block name.  Edit each Block so all its objects are on the existing Layer.  Then you can bring them back by editing each Block again, using its own name for the Layer to put all its objects back on.  You could do the same with WBLOCKing each Layer's-worth of stuff to an external drawing named for the Layer, and changing everything in each drawing to the existing Layer, or to Layer 0, and Inserting each appropriately.

Kent Cooper, AIA
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for the reply Kent. I’ll have to think about this a little longer, and try to find the best solution, based on your input. I think it’s going to be trickier than I anticipated.

Hmmm.
0 Likes
Message 4 of 6

ronjonp
Mentor
Mentor

Couldn't you just change the transparency of the objects to get that shaded back look?

0 Likes
Message 5 of 6

Anonymous
Not applicable
That actually works well for lines. But it doesn’t seem to recognize blocks? They still come out dark, even with the transparency set to say “80”.
0 Likes
Message 6 of 6

ronjonp
Mentor
Mentor

You'd need to set the internals of all block definitions to transparency 'ByBlock'.

0 Likes