Delete Layer and all entities on it
In the drawing explorer I can delete a layer with all entities on it. This works great but I use it every day when i send a drawing to a costumer. I would like to have a lisp or a other way that can do this. I now LAYDEL does not work and there is no command to do this.
Does anyone now how this is possible to do this automaticly. It is also good if it deletes the frozen layers with its entities or in another way.
greetings Steven Brok from holland
Comments
-
Is there anyone who can help me with this problem?0
-
Code by Keith copied from theswamp.org:
This example deletes the a layer you specify, but as Matt pointed out, it is not possible to delete the current layer (without more code).(defun dellay( layer ) (vl-load-com)
[/code]
You call this function by supplying a layer name as such:[code](dellay "LAYER1")
[/code]0 -
Steven,
I can write something for you that will give you the same functionality as the LAYDEL command. Give me a day or two and I will get it to you...
Thanks,
Kevin
0 -
Steven,
Please try attached file. Load the laydel.des file the same way you load a .lsp file. At the command line type laydel to start the function....
Kevin
0 -
Dear Kevin and Martin,
I really appreciate that you created that lisp. But with both lisp get me the same error.
Error 3224 Automation Error 80020009; [IAcadLayer] Error accessing [DELETE] method. ErrIndex=0;
Object is referenced by other object(s)
I have de middle version of bricscad is this a problem?0 -
Steven,
The error says that there is something in your drawing that uses the layer that you are trying to delete. The most probable cause would be a block that you inserted that has entities defined on the layer.0 -
Steven,
Your version of BrisCAD is not the problem. From the Error message it looks like the layer you are trying to delete is referenced by another object, which is preventing it from being deleted even though the entities have been erased from that layer. Can you send me a copy of the Drawing that you are having this issue with and I will see what is referencing that layer? You can attach it here or you can send it to me a kysurveyor3635@bellsouth.net, which might be easier.
Thanks,
Kevin
0 -
Hi,
There is a block I have inserted that has entities defined on the layer. But The thing is that i want to delete those entities but not the block. The block contains other entities on other layers that i want tot keep.
Is this even possible with Bricscad?0 -
The only ways I know to fix this are to explode the block in your drawing or to redefine the block and re-insert it.0
-
For that purpose, the normal way is :
- insert such a BlockReference
- explode that
- delete the entities you want to get removed
- re-define the block from remaining entities ...
It is the normal process of redefining a block ...
good chances, that you can delete the layer(s) afterwards ....
many greetings !0 -
It can be done by deleting the layer in the drawing explorer. Thats the way i always do this, but i want to make this automatic by using a command. Could there be a way to use the command bar to delete the layer through the drawing explorer?0
-
Can't he just go into in-place block editing, delete elements, and save changes on exit? No need to explode, re-define, re-insert?0
-
yes, that is essentially the same :-)0
-
ok, I think there is no way to make this easyer than i do this now. Thank you all for the help!0
-
I don't have Express Tools installed, but I would have thought LAYDEL would do what Steven wants. That's how it works in the less user-friendly DWG cad application -- it deletes all objects on the layer, including objects in blocks (but without deleting the rest of the block), and it also deletes the layer. If it doesn't do that in Bricscad, it should be easy to write a lisp function that does.
Steven, if the Bricscad LAYDEL command is supposed to delete nested objects, but isn't working for you, then you might have the xdata problem described and solved in another current thread (called "Cannot delete blocks and layers"). If LAYDEL is not supposed to deleted nested objects, then you could try searching for an appropriate lisp function at TheSwamp.org. If you don't find something, then post a request there, explaining that LAYDEL in Bricscad won't delete nested objects. It would probably take me most of the day to write that lisp function, but there are people who could do it in less time than it took me to write this post.0 -
Steven, I installed Express Tools, and found that the following custom command deleted all objects on the 3 layers named, including objects in blocks, without deleting the rest of the block, and also deleted the 3 layers themselves:
[code]^c^claydel;t;layer1;t;layer2;t;layer3;;y;graphscr;[/code]
It worked when the layers were off or frozen, but it didn't work on a locked layer.0