Jump to content

Macro to Lock all layers


Recommended Posts

I am exploring the following macro:

 

^C^C_-layer;LO;[select All]

 

I cannot work out how to automatically select all layers to lock them. I cannot create a standard list because each drawing is different.

 

Should I use a DIESEL expression to extract all the names? Or is there a wildcard key like "*" that will select all?

Link to comment
Share on other sites

Thanks Pablo,

 

Using "all" has no effect on my layers. So I still need to dig deeper for a solution.

 

Also, thanks to whoever moved this thread for me. I could not find the customization forum anywhere. I found it now!

Link to comment
Share on other sites

See you need to be an old AutoCAD user that remembers dos shortcuts!

 

'-LAYER LO *;;

 

* for select all

;; to return to command line

Link to comment
Share on other sites

See you need to be an old AutoCAD user that remembers dos shortcuts!

 

I wish I was an old AutoCAD user! I thought I tried "*" already, but when you posted that I tried again and it work perfectly. It will even pick up anything with a common prefix like "HEIGHT_*".

 

Thanks.

Link to comment
Share on other sites

'-LAYER LO *;;

 

Notice the space betwhen 'LO' and '*' - this counts as a carridge return (enter). Try it at the command line, you will find that after you type LO and hit enter you will need to hit enter agin before you can use 'All'.

 

That's what I was hinting at...

Link to comment
Share on other sites

  • 2 weeks later...

Can anyone confirm if the same principle will work for RENAME command? I can get it to run in the command line, but it won't accept *.

 

My macro so far looks like ^C^C-rename LA * SYM_*; (Trying to add the prefix SYM_ to every layer).

 

I can do this successfully in the dialog box - see attachment showing all blocks highlighted when using the * in the "Old Block Name" field:

New Picture.png

Link to comment
Share on other sites

Can't use in the same way to rename layers sorry. Might be something for drawing standards try the _LAYERSTATE command if talking about renaming layers. You can activate the command line rename command with -rename (no dialog box)

Link to comment
Share on other sites

  • 2 weeks later...
try the LAYTRANS cmmand

 

Thanks cadvision. I tried LAYTRANS, but it does not work on my machine. I suspect it is not an LT command.

 

I got a wrote macro today that Unlocks all layers. Another great breakthrough for me, so thanks everyone.

 

I am still stumped by the -rename command. I can do it on the command line using *, but then in a macro * just returns a message saying "invalid layer selection". Why wouldn't it work exactly the same?

Link to comment
Share on other sites

You can prefix all layers from the Rename dialog.

 

  1. Select "Layers" in "Named Objects" list.
  2. In "Old Name" text section, type "*".
  3. In "Rename To" text section, type "PREFIX-*" and hit enter.

Link to comment
Share on other sites

Thanks Alan. I do understand how to do this at the command line.

 

The difficulty is that it does not behave the same once that is in a macro. It just says "Layer Selection Invalid". Can you confirm if it works for you inside a macro?

Link to comment
Share on other sites

Much unlike Rename, -Rename will only work with one layer/block/etc. at a time. It's about the only commandline version of something that is crippled.

Link to comment
Share on other sites

Ahaa. Well, I must have been remembering -layer that could accept * at the command line and perform multiple changes at once. Oops.

 

That confirms that it will not ever work on a macro! Thanks Alan.

 

I will contact Autodesk about this and see if it can be changed.

Link to comment
Share on other sites

That's twice you claim to be able to contact Autodesk in regards to a 'missing option'. Do you have some 'in' with the company?

Link to comment
Share on other sites

  • 3 weeks later...
That's twice you claim to be able to contact Autodesk in regards to a 'missing option'. Do you have some 'in' with the company?

 

Haha, no I definitely do not have an "in" with the company! But a man can dream. I certainly put things on AUGI wishlist, but usually my suggestions are too specific to appeal to the masses. Lately I have been emailing Autodesk through the Tech Support in Subscription Centre. Haven't seen it have any effect yet, but I am a big believer in feedback.

Link to comment
Share on other sites

  • 3 months later...

Macro to lack layers

 

Can we modify this to lock layers with the exception of the current layer? I need current layer on and this doesn't do it in 2004

 

^C^C'-LAYER;LO;*;

Edited by Buggsy
Link to comment
Share on other sites

  • 1 month later...

Sorry Buggsy, that's a pretty poor welcome to the forum by all of us. I have not had time to log on here for over 2 months. Trust me you will get a much better response in future, the users on here are fantastic.

 

I did not know the answer to your 1st post. So you have taught me how to do this with your second post. To me that looks about as efficient as you are going to get. And, in my mind, if it works then it's perfect!

Link to comment
Share on other sites

I've been wondering if there would be a reply. Thanks. The way this one works is, it locks all the layers and gives the operator the oppertunity to pick one layer to keep unlocked.

I've been doing design work for about 15 years now and started with Version 12 if I remember right. I got laidoff from my last employer a couple of yrs ago and been free lancing since. I just got called back to my last employer 5 months ago. I have 3 systems set up at home with 2004 2008 2010 and Inventor 2010. Depending on what I need to design depends on which system is used. The down fall from using different versions and systems is that not all of them work exactly alike. They are close but not the same. That is what I'm trying to fine tune. I will have more questions for all of you guys out there. I'm not the best but I do have my pros & cons on these lisp files

 

Gotts go, the boss wants to meet on a new project.

Link to comment
Share on other sites

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