changing selected layers with macro

changing selected layers with macro

Anonymous
Not applicable
2,457 Views
8 Replies
Message 1 of 9

changing selected layers with macro

Anonymous
Not applicable

Hi everyone,

 

I would like to get some help in a layer subject. I am using AutoCad Map 3D 2012. My problem is the following:


I get a .dwg file which contains different layers. These layers have to change to some of the specific layers in my layer base.
The process I am thinking should be the following:

select <layer1> by clicking an object in the drawing -> press a macro -> layer changed to the speficic layer, <layer2>

The key is to make a script that works like: selected object -> _selectsimilar -> select to that layer that I wrote into the command line making the script.

 

Is there a way to do this? 

Thanks for the answers

0 Likes
Accepted solutions (1)
2,458 Views
8 Replies
Replies (8)
Message 2 of 9

Ajilal.Vijayan
Advisor
Advisor

Hello,

did you try LAYTRANS command ?

Also QUICKSELECT can be used to select based on the layer name and then change the layer.

0 Likes
Message 3 of 9

Anonymous
Not applicable

Laytrans almost solves my problem. The thing is the layers I have to change should be selected my clicking on them. The reason is because every time I get a .dwg the layers of those objects have different names. 

 

I guess there is nothing like: select by clicking+change the selected layer to a layer I wrote into the script. Because I know the "goal" layer's name, but not the original ones.

 

0 Likes
Message 4 of 9

Vinayv4v
Advisor
Advisor

Hello,

 

In addition to above mentioned commands you can also use LAYMRG (Layer Merge)

Which will combine the selected layer to another named layer and purge the previous layer.

See the screencast:

 

Cheers,

Vinay Vijayakumaran

0 Likes
Message 5 of 9

Anonymous
Not applicable

I did an actrecord and made a .actm file with the _laymrg command. Everything worked fine, I could change the layer by selecting it etc. 

Then I tried it again by using as script. A window pop up and says there is no object selected. There are 3 options in the window and manually I can select the layer then select the new layer etc. 

is there a way when I dont have to select the goal layer again with dialog box?

0 Likes
Message 6 of 9

Vinayv4v
Advisor
Advisor
Accepted solution

Hi,

 

You may have missed some steps in your scripts.

After selecting the layer you want to change make sure there is an (enter or next line in the script).

 

Cheers,

Vinay Vijayakumaran

Message 7 of 9

Anonymous
Not applicable

I still can not rid off that message.
Here is what I did:

 

_selectsimilar

I clicked on the object

Enter

_Chpror

_layer

I type the required layer name

Enter
Enter

 

It works very good. The problem is if I run this I got the message that I have to select an object/go without selecting/abort. I do not want this message, I know I have to select something 😄

When I press select an object, the little program runs and the same result appears=job is done.

0 Likes
Message 8 of 9

Anonymous
Not applicable

I put an actuserinput command when I was looking at my macro. Thanks for the help all!

0 Likes
Message 9 of 9

Vinayv4v
Advisor
Advisor

Hi,

 

I may be not getting what you are asking for. Can you post a screencast so that I could take a look after.

Cheers,

Vinay Vijayakumaran

0 Likes