Jump to content

LSP for saving and restoring specific states of multiple layers


neodd70

Recommended Posts

I am looking for a lsp command that I can use at the beginning of an existing lsp file to save the frozen/thawed, on/off and locked states of multiple layers and then at the end of my lsp file restore those states to the same layers. We have a lot of different layers that we use and we have just adjusted the colors on all of them. We have a lot of existing drawings that we need to convert over to the new colors. I have a lsp command that will convert the colors over however it turns on all layers, thaws all layers and unlocks all layers. I need to be able to set those states back to what they were before I update the colors. The way I convert the colors is that I have a drawing with a block that has every layer we use in it. I turn on, thaw and unlock every layer in my current drawing then select all my entities and copy them then erase them and purge all layers. I then insert the aforementioned block and then erase it (leaving every layer we have in the drawing) and paste my original entities back in. I then purge my drawing which gets rid of any layers that aren't used but this leaves them all on, thawed and unlocked. I need to put them back they way they were. I don't want to save the layer color or linetype or lineweight or anything like that. Any help would be appreciated.

Link to comment
Share on other sites

This is a very quick how to get started. I am sure there are programs alraedy done for what you want just search a bit more. Check www.lee-mac.com.

 

If you want to have a go then

 

; need thes 1st 2 lines to open database copy them to command line.
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
(setq layers (vla-get-layers acDoc))

; and example of retrieving the layer properties run on small number of layers
(vlax-for each layers 
(alert (strcat (vla-get-name each)(vla-get-linetype each)))
) 

; to find other properties of the layer
(vlax-for each layers (vlax-Dump-Object each) )

; lastly instead of put a get which is change to
(vla-put-linetype new "Continuous")

Link to comment
Share on other sites

Welcome to CADTutor neodd70! :)

 

Are you familiar with the command LAYTRANS?

 

You might find it worth a few minutes of your time, it can be very helpful in situations like this, or working with drawings and layers from outside vendors. :|

 

 

I haven't watched this video, but Lynn Allen certainly knows her stuff, and is usually right on the money.

Link to comment
Share on other sites

How many different colors we talking here?

 

Sent from my SM-G920T using Tapatalk

 

around 35 different colors spread across about 360 different layers. We use the layers to indicate a specific material height, tool, speed and feed rates for camming as the nesting software we use is a plugin for autocad and uses the layers to know what type of tool path to generate what material its cutting and which tool to use.

Link to comment
Share on other sites

Might this be a one time mapping exercise for LAYTRANS? :huh:

 

Yes it is. Thank you so much!!!!!! This worked perfectly. We had all our layers already we just changed the color. I was taking the hard way around but this is soooooo much better. Thanks again.

Link to comment
Share on other sites

Yes it is. Thank you so much!!!!!! This worked perfectly. We had all our layers already we just changed the color. I was taking the hard way around but this is soooooo much better. Thanks again.

 

I am so glad that you gave it a shot, it sounded like you might just find it a little helpful! :beer:

 

Similarly you can create mappings, if needed which can be applied to the work of other vendors, from outside of your organization, makes working on their drawings ever so much easier. :)

 

It is always so gratifying when people actually consider options suggested, all we forum members want to do is help!

You can even reverse (restore) the mapping, if you need to return it to a vendor, in their prefered colors and layer settings, after working on it, comfortably in house.

Edited by Dadgad
Link to comment
Share on other sites

I am so glad that you gave it a shot, it sounded like you might just find it a little helpful! :beer:

 

Similarly you can create mappings, if needed which can be applied to the work of other vendors, from outside of your organization, makes working on their drawings ever so much easier. :)

 

It is always so gratifying when people actually consider options suggested, all we want to do is help!

You can even reverse the mapping, if you need to return it to a vendor, in their prefered colors and layer settings, after working on it comfortably in house.

 

That's awesome. Very useful tool. I knew there had to be a better way of doing it but being that I am new to AutoCad (15 years of SolidWorks only) I didn't know which command to use. Searching doesn't always work for newbies because we don't always know which key words to use, thats why its great to have people like you with the experience that we don't have who are willing to share their knowledge. Thanks for being that person.

Link to comment
Share on other sites

Thanks for providing me the opportunity, to be that person.

Let's just assume, that you know about the SYSVDLG command, and if that would be an erroneous assumption, then check it out too, you'll be glad you did.

 

It will teach you things in an hour that might otherwise take you a lifetime to stumble upon.

Best way to flip through them is to just use your keyboard cursor, a great way to kill a little time on a slow afternoon. :beer:

 

This is where you can teach the software to work like you think it should, or need it to.

Link to comment
Share on other sites

Thanks for providing me the opportunity, to be that person.

Let's just assume, that you know about the SYSVDLG command, and if that would be an erroneous assumption, then check it out too, you'll be glad you did.

 

It will teach you things in an hour that might otherwise take you a lifetime to stumble upon.

Best way to flip through them is to just use your keyboard cursor, a great way to kill a little time on a slow afternoon. :beer:

 

This is where you can teach the software to work like you think it should, or need it to.

 

Thanks, I will do just that and I know it will be helpful. I have been charged with creating lsp files to automate a lot of the operations we do and I have gotten by so far but like you said, there's been a lot of stumbling so this will come in handy.

Link to comment
Share on other sites

Anybody who is serious about enhancing productivity should just cut to the chase and proceed directly to Lee Mac's excellent website .

No need to reinvent the wheel, in many cases.

No need to despair though, should you feel the need to design some custom rims, Lee will kindly share the sharpest of cutting tools and his state of the art facility, to assist you in doing so!

 

Layer Director is a core one, albeit one of the many I have in my startup lisp folder, without which I would be lost, and or hating what I do, instead of loving it.

 

Thanks Lee! :beer:

 

Lee's site certainly isn't the only way to go, and he might NOT have what you need. However, for each one you thought you needed, if you look, you will probably find two or three which, you won't be able to believe, you had never realized you needed. :|

Edited by Dadgad
Link to comment
Share on other sites

When trying to find a LISP or something here's my order of attack:

 

1. google

2. cadtutor

3. theswamp

4. lee-mac

5. lispbox

Link to comment
Share on other sites

When trying to find a LISP or something here's my order of attack:

 

1. google

2. cadtutor

3. theswamp

4. lee-mac

5. lispbox

 

I'll have to check out lispbox, didn'tknow about that one, thanks iconeo. :beer:

Link to comment
Share on other sites

The site operator watches some Russian forums too that produce some good stuff.

 

Sent from my SM-G920T using Tapatalk

Link to comment
Share on other sites

When I went to it there was a sort of disclaimer from the owner, saying that he hadn't really been keeping it up, and he wanted to be straight with anybody keen on using it. :beer:

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