View Full Version : Unable to remove some layers . . .
Dog
29th Jun 2005, 07:33 pm
I am trying to clean up an old drawing by removing layers that I'm not using any more. I have tried to delete the layer manually (Oh and I am using AutoCAD 2005) in the layers properties manager and that doesn't work. I have turned all other layers off, locked them and tried to select any objects on the layer I am trying to remove and I cannot find any. I have also locked everything else and tried selecting all and then deleting everything but even that doesn't work. Are there any ways to forcefully remove layers without deleting or moving everything off them? Is there any way to select only objects on that layer and get rid of them that way? I think the latter is possible however I can't see anything on these layers when everything else is turned off.
Jorge Mayor
29th Jun 2005, 07:49 pm
Hello;
There is a tool called Quick Select on the object properties, on that window select LAYER under the properties tab, then = the name of the layer you are trying to delete and click Ok; it should select only that layer, once selected try to change it to another layer, then purge your archive; ohh also there are times when a layer is part of a block and that block its inserted under another layer so when you turn off the block layer it turns off also the layer you are trying to delet; hope I didn't confuse you more ja...
Dog
29th Jun 2005, 08:18 pm
Thanks for the tips. The quick select method didn't select any objects on any of the layers so I think it might be that they are blocks. However I don't know what to do about it or how to find out what layer they are attached to.
leejohn
30th Jun 2005, 02:48 am
Thanks.
------------------------------------
http://anydwg.com
gmolloy
30th Jun 2005, 04:59 am
Have you tried purging the drawing once you have deleted all objects from the layer?
wehaveaproblem
30th Jun 2005, 06:14 pm
What I have used for this is selection ALL. This selects everything on the drawing even unseleable items. You can go ERASE ALL then R for remove then select all items with crossing box you want to keep. This will delete all the 'unselectable items' in your drawing.
I find that culprits are bits of text (with no text in them) and exploded dims and nodes etc. You can use LIST in the same way to find out what they are before you delete them (recommended).
This is all fine unless you have a block with these layers in them! How do you find out, EXPLODE all your blocks see what appears on those layers. Hope this helps.
Geo
30th Jun 2005, 08:20 pm
I have have that problem in the past so i found a LISP that says it could delete the layer....but I have not tried ot myself, so i do not recomened or take responcibility for its outcomes :twisted: :?
but if all else fails
; Delete Layer(s)
; Written by Mark Thomas
; This file contains 2 functions:
; del-layer will delete all objects on a selected layer and purge it
; mdel-layer will delete all objects on selected layers and purge them
(defun c:del-layer (/ ent l_name ss cntr amt ssent)
;;;
;;; erases all objects on selected layer then purges that layer
;;;
(setvar 'clayer "0") ; set layer to 0
(if
; make sure we get something
(setq ent (car (entsel "\nSelect layer to remove: "))); test
(progn
; extract the layer name from the entity
(setq l_name (cdr (assoc 8 (entget ent))))
; create a selection set of all entites on layer 'l_name'
(setq ss (ssget "X" (list (cons 8 l_name)))
; set 'cntr' to number of items in selection set
cntr (1- (sslength ss))
amt (itoa cntr); make a string from an integer
)
(if
; does the sel set have anything in it
(> cntr 0); test
(while
; as long as 'cntr' is greater than or equal to 0
; keep looping
(>= cntr 0)
; extract the ename from the sel set
(setq ssent (ssname ss cntr))
(entdel ssent); delete that entity
(setq cntr (1- cntr)); subtract 1 from cntr
)
)
)
)
(command "_.purge" "LA" l_name "N")
(princ (strcat "\nErased " amt " items"))
(princ)
)
;;;
;;; erases all objects on selected layers and purges them
;;;
(defun c:mdel-layer (/ lst)
(setq cmd (getvar 'cmdecho))
; turn off the echo!
(setvar 'cmdecho 0)
(if
; make sure we get a list before we continue
(setq lst (fx-make-layer-list)); test
; now that we have a list run 'fx-rm-layer' on each of those items
(mapcar '(lambda (x) (fx-rm-layer x)) lst)
)
; reset the variable
(setvar 'cmdecho cmd)
(princ)
)
;;;
;;; functions ================================================== ====
;;;
(defun fx-rm-layer (l_name / ss sntr amt ssent)
;;;
;;; erase and purges all entites on 'l_name', a string
;;; returns the number of objects erased
;;;
(setvar 'clayer "0")
(if
; make sure the layer exists in the dwg
(tblsearch "layer" l_name); test
(progn ; continue
(setq ss (ssget "X" (list (cons 8 l_name)))
cntr (1- (sslength ss))
amt cntr
)
(if (> cntr 0)
(while
(>= cntr 0)
(setq ssent (ssname ss cntr))
(entdel ssent)
(setq cntr (1- cntr))
)
)
)
)
(if (> amt 0)
(command "_.purge" "LA" l_name "N")
)
; return the amount of entites erased
amt
)
(defun fx-make-layer-list (/ ent l_name entlst)
;;;
;;; generate a list of layer names based on user selection
;;; and returns that list
;;;
(while
; while user is selecting something continue loop
(setq ent (car (entsel "\nSelect Item on Layer: "))); test
; extract layer name from selected entity
(setq l_name (cdr (assoc 8 (entget ent))))
(prompt l_name); output the layer
(if
; make sure the layer isn't already in the list
(not (vl-position l_name entlst)); test
; if not then add it to the list
(setq entlst (cons l_name entlst))
)
)
)
erona
1st Jul 2005, 03:20 am
Draw a temporary lines using layers you want deleted.
Type LAYDEL then pick those lines. After selecting everything you hate, enter to finish the command then a warning pops up. Enter yes.
If you made a mistake, just undo. :wink:
ashcity
3rd Sep 2005, 07:39 pm
Sometimes Purge works to remove the offending layer; but only if the layer is recognized by Purge as a layer that can be purged. You can have a layer with no objects in a drawing with no xrefs (layer not current) and the Layer Manager will not let you delete it; yet this layer may show up in the Purge tree and you can purge it – very strange.
In large drawings with many layers, I generally end up with about 5 out of 100 un-deletable empty layers. These layers have been Quick Selected (Multiple) and erased of all selected objects. Repeat of Quick Select for Layer Multiple selects 0 items. Yet, these layers cannot be deleted by Layer Manager or purged by Purge. Generally, I just rename these layers with a name that indicates they cannot be deleted. This is annoying, but the layers do no harm. I use AC2000i.
Murph
3rd Sep 2005, 08:21 pm
If a layer is frozen in a viewport that will make it undeletable and unpurgable.
Check all of your paperspace viewports.
ashcity
3rd Sep 2005, 11:57 pm
More on getting rid of crazy layers (layers that cannot be deleted by Layer Manager or purged by the Purge command).
I don’t know why the following works; but it worked for me.
For safety, do a Save As of the drawing that has the crazy layers (you now have a drawing identical to the one with the crazy layers). With this drawing open, do the following:
1. From the File menu, select Export.
2. In the Export dialog box, select Block as the file type; i.e., “Block (*.dwg).”
3. Enter a name for the new drawing file. Just add something to the name of the open file, like “(Block from crazy drawing).” Do not use the name of the open drawing or you will get an error.
4. Choose Save. You will return to the open drawing with the following on the Command line:
“Enter name of existing block or [= (block=output file/*(whole drawing)]<last command>:
5. Enter an asterisk (*)
6. Now, open the drawing named in step 3, and look for the crazy layers; you may find that they are gone. LOL
Tallguy
15th Oct 2009, 01:33 pm
I tried some of these solutions.
I found that QSELECT Block Reference (which were actually on a different layer entirely) and deleting them, then PURGE, helped.
I realise that most people want to keep their Block References, but I don't use AutoCAD Map3D 2008 in that way, so didn't need any Block References at all. I expect you could refine your search and maybe use AUDIT to help?
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.