Jump to content

Deleting layers


Rollmop

Recommended Posts

I am trying to tidy up some drawing by deleting layers. I have deleted all the object in the layer but still get this error.

 

Untitled.jpg

 

What do I need to do?

Link to comment
Share on other sites

The "Layers containing objects" is the one that is probably the problem. An example you can have a block that exists in the dwg database but you have not inserted it anywhere, hence use Purge. Also CIV3d will not allow layer deletes if its connected to a style, but in 2013 you can remove un used styles then purge. I can see AC2012 but if drawing has proxy objects this problem will occur.

Link to comment
Share on other sites

  • 6 months later...
Unless you are using an ancient version of AutoCAD, look up and use LAYDEL and/or LAYMRG commands.

 

 

Thanks Pendean. Very helpful.:D

Link to comment
Share on other sites

One of the "objects" that can prevent layer deletion is a block definition closer. When you define a block, the objects are added to the block table, along with one phantom object at the end to close the definition. That closer object always goes on the current layer. If you're not careful when you define a block, or you borrow a block from somewhere else, that layer is arbitrary, that is, you don't know what it is, and there's no way to find out what it is. That's why I always define blocks with layer 0 current.

 

I'm not sure what happens when you use LAYDEL in that situation. The closer might get moved to the current layer, or to 0, or to some other layer. With AutoCAD there's no telling. If I had time I'd figure it out. If I had more time I'd write some code to manage the layers of block definition closers.

Link to comment
Share on other sites

I'm not sure what happens when you use LAYDEL in that situation.

 

FWIW - LAYDEL is quite powerful... It will not only delete the Layer Object from the Layer Collection, but also all entities that reside on said layer (this includes Block Definitions).

Link to comment
Share on other sites

One of the "objects" that can prevent layer deletion is a block definition closer. When you define a block, the objects are added to the block table, along with one phantom object at the end to close the definition. That closer object always goes on the current layer. If you're not careful when you define a block, or you borrow a block from somewhere else, that layer is arbitrary, that is, you don't know what it is, and there's no way to find out what it is. That's why I always define blocks with layer 0 current.

 

That makes no sense to me. I have never seen nor heard of this. Do you have any documentation? I think it may help me out with something.

Link to comment
Share on other sites

Cyber: I don't think it matters what layer the block is created on when it comes to using LAYDEL. The block and the layer it was created on will both be deleted.

Link to comment
Share on other sites

That makes no sense to me. I have never seen nor heard of this. Do you have any documentation? I think it may help me out with something.

 

Here's a link to an Autodesk docs page:

http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-7DA0E2BA-963F-4E41-AF33-C6B9D89D4688.htm,topicNumber=d30e579828

 

The key phrase there is "Block definitions begin with a block entity and end with an endblk subentity." If you export a drawing to DXF format, you'll find an ENDBLK entity in each block definition, and that entity has a layer assigned to it.

 

I am not making this up. I once had a layer that I couldn't purge, and I made it my mission in life to purge it. I looked into block definitions and found some info on ENDBLK. I found that if I could purge a particular block, then I could purge the offending layer. I redefined the block on a different layer and voila, the layer would purge.

 

Cyber: I don't think it matters what layer the block is created on when it comes to using LAYDEL. The block and the layer it was created on will both be deleted.

 

I've never seen a block removed by the LAYDEL command. Just now, for fun, I put all the entities in a block on one layer and then used LAYDEL to remove that layer. The block wasn't removed, but as you might expect, it lost all its entities.

Link to comment
Share on other sites

I didn't say you made it up. I didn't understand because I don't know anything about coding but, in laymans terms, maybe that entity is the layer reference. I understand that a block definition can have layer(s) that do not have anything on them and those said layers do make it into the drawing that the block is inserted into. Furthermore, those layers cannot be deleted until the block is purged or redefined. Correct me if I am wrong, please.

Link to comment
Share on other sites

FWIW - LAYDEL is quite powerful... It will not only delete the Layer Object from the Layer Collection, but also all entities that reside on said layer (this includes Block Definitions).

 

I just tried and the blocks still show in the to be purged list.

Link to comment
Share on other sites

I agree that the layer along with the block are deleted using LAYDEL but until, as SLW210 points out, the PURGE command is run the block definition remains. So, LAYDEL then PURGE then SAVE.

Link to comment
Share on other sites

What do you mean the block wasn't removed?

 

If (and only if) you leave an instance of the block in the drawing. I was testing whether Purge removed a block from which Laydel had erased all the objects, not whether it removed an unreferenced block. See below.

 

I didn't say you made it up. I didn't understand because I don't know anything about coding but, in laymans terms, maybe that entity is the layer reference. I understand that a block definition can have layer(s) that do not have anything on them and those said layers do make it into the drawing that the block is inserted into. Furthermore, those layers cannot be deleted until the block is purged or redefined. Correct me if I am wrong, please.

 

Sorry, that was a line from Dave Barry. He would write about ridiculous news items and claim, "I am not making this up." (By the way, Dave has a blog at the Miami Herald.)

 

You are right about the mystery layer. I tried to explain that every block definition has an End of Block object, and like most objects, it has a layer value. When you define a block, the layer for that End of Block object is set to the current layer. It's easy enough to verify for yourself. Pick an unreferenced layer and make it current. Define a block. Try to purge the layer (of course you have to set a new current layer first). It is now referenced, because of the new block, and won't purge.

 

Cyber: You were the first to mention DXF. I don't get the impression the OP is concerned with saving as a DXF file.

 

I brought DXF into the discussion because that's the easiest way (and maybe the only way) to see which layer the block definition's ENDBLK object is on. Again, you can verify this for yourself. I am not making it up.:)

 

I agree that the layer along with the block are deleted using LAYDEL but until, as SLW210 points out, the PURGE command is run the block definition remains. So, LAYDEL then PURGE then SAVE.

 

I should clarify--when I tested the Laydel command, I changed the objects in the block definition to the layer I wanted to delete. I put the block instance on a different layer, so it survived, although it lost all its contents.

Link to comment
Share on other sites

I have my doubts about a couple of the things you've written but it isn't worth pursuing at this point as it does not add to the discussion.

 

BTW...a layer cannot be purged if it has anything on it whether it is a line, a piece of text, or a block. But it can be deleted even if it is populated by any of those entities using LAYDEL.

Edited by ReMark
Link to comment
Share on other sites

... a layer cannot be purged if it has anything on it ... it can be deleted even if it is populated by any of those entities using LAYDEL.

 

That is exactly why you should use LAYDEL as the last resort. Deleting the layer will delete everything that was on it or associated with it. Make completely sure that there is nothing on that layer you want to keep.

Link to comment
Share on other sites

I just tried and the blocks still show in the to be purged list.

 

What I meant (if memory serves) was that blocks (on that layer) that are nested in other block definitions are also deleted. Absolutely block definitions are separate... LAYDEL only destroys entities (references) in this regard. Sorry for any confusion.

 

 

 

ETA - Confirmed:

 

I should clarify--when I tested the Laydel command, I changed the objects in the block definition to the layer I wanted to delete. I put the block instance on a different layer, so it survived, although it lost all its contents.
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...