Jump to content

Stop layers from being purged


stryder444

Recommended Posts

Hello,

 

 

I am setting up a layers list for my business, so there will be one list of layers that everyone can pick from, but I was wondering if there is a way to prevent unused layers from being purged whenever the PURGE command is used.

 

 

I want to stop any layers from being purged, so that the layers list remains the same throughout. Is there a way in which to do this?

Link to comment
Share on other sites

The problem is that there are quite a few layers so it will be quite difficult to create an object or key containing all the layers.

Link to comment
Share on other sites

The object could be a 1 micron high piece of text.

 

Or you can create a block with an item on each layer. OK, so its going to be large but will only need doing once. Now insert this block on a non-plot or off (even frozen) layer and it won't be accidentally purged.

Link to comment
Share on other sites

or a block of point objects and it is not necessarily to be inserted into a drawing to avoid purging its related layers ( if you purge layers only of course and not purge all). :)

Link to comment
Share on other sites

You say it's your business. Since you don't like the obvious answer I have a very simple one for you. Tell your employees if they purge any unused layers from a company drawing they'll be fired.

Link to comment
Share on other sites

When did I say I didn't like the answer - I said that it would take a bit of time to do. No criticism of the answer at all.

Link to comment
Share on other sites

It was implied. Oh, this is going to take too much time. No denying the thought crossed your mind.

 

Here's a answer you are sure to like. Use the built-in AutoCAD Standards Tester to keep the layers from being deleted. Yes, it will take time to set up too but it is the one sure fire way to retain your layers.

 

Crap. AutoCAD 2007? Time to upgrade.

Link to comment
Share on other sites

We had a similar issue here with people purging layers and creating there own, rather than fighting against them purging. We went along the lines of using a script to replace the purge command that didn't purge layers, but there are some that need purging sometimes, we then decided rather than fight it, we created a script that automatically loaded all the layers we need. Not only that but you can restore the layers deleted using they LAYDEL command as well.

Link to comment
Share on other sites

Add name of your layers into the following routine and you can change the name of the routine to be instead of the purge command call purge and it would purge everything in the drawing except the layer names that you'd add to it .

 

 (defun c:Test (/ *error* l lst)
 (defun *error* (u)
   (if doc
     (vla-endundomark doc)
   )
   (princ (strcat "\n Error:" u))
 )
 (or doc
     (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
 )
 (vla-startUndomark doc)
 (foreach l '("Layer1" "Layer2" "Layer3")
   (setq
     lst (cons
           (entmakex (list '(0 . "POINT") '(10 0. 0. 0.) (cons 8 l)))
           lst
         )
   )
 )
 (command "_.-purge" "All" "*" "N")
 (foreach o lst (vl-catch-all-apply 'entdel (list o)))
 (vla-endundomark doc)
 (princ)
)
(vl-load-com)

Link to comment
Share on other sites

I use the point in a corner of my template titleblock, well a few points, each on a seperate layer, stops me purging out my own layers. And that is copied into each sheet size, just in case I delete all but one layout size. I also have several dims placed in model space to keep dimstyles in the template.

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