Create a new layer based on another layer's name

Create a new layer based on another layer's name

charles_neelyFG4LK
Contributor Contributor
369 Views
5 Replies
Message 1 of 6

Create a new layer based on another layer's name

charles_neelyFG4LK
Contributor
Contributor

I want to be able to select objects and have new layers created based on the layers of the selection set. The name would be the layers in the selection set with a prefix of “CD”. Any guidance on how to accomplish this?

0 Likes
Accepted solutions (1)
370 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor

Study what’s shown in this similar thread

https://www.cadtutor.net/forum/topic/15668-creating-layers-by-selecting-objects/


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 6

charles_neelyFG4LK
Contributor
Contributor

That is great! Gets me what I'm looking for except its adding a suffix and I want to add a prefix to the layer name.

0 Likes
Message 4 of 6

paullimapa
Mentor
Mentor
Accepted solution

So just modify the code so you would add your prefix sections of the code that looks like this:

 (strcat (cdr (assoc 8

to this:

 (strcat "CD-" (cdr (assoc 8

Then remove the suffix from sections of the code that looks like this:

(entget forVar))) " - FUTURE")

to this:

(entget forVar))) )

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 6

charles_neelyFG4LK
Contributor
Contributor

That did it! Thank you for the help.

0 Likes
Message 6 of 6

paullimapa
Mentor
Mentor

You are welcome…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes