Remember that the same rules apply as when you purge, you may not be able to do this if the layer contains something.
Code:ThisDrawing.Layers.item("layername").Delete


Registered forum members do not see this ad.
Hello!
I am using lisp code to configure autocad. I have zerro understanding about VBA. The thing why i need VBA is to delete layer. I can delete layer using lisp, but after the command i cant activate vports in layouts using double click. Only after reopening the drawing i can activate vports using double click. So idea is to delete layer using VBA and then lets see what happens.
If someone who uses VBA could write the code that would pick up value from lisp variable named "LAYDEL-NAME" and delete the layer, I'd be very thankful.
Variable value might be forexample:Code:(setq LAYDEL-NAME "Layer1")
Remember that the same rules apply as when you purge, you may not be able to do this if the layer contains something.
Code:ThisDrawing.Layers.item("layername").Delete


I have objects there that I also want to delete.. This code is not working from the command line.. How shall i write it?


I wrote a lisp, that deleted all the objects from this layer.. So this is not a problem.. Now i need to delete the layer but the code line of yours still dont work.. How can I pass my variable to it?
So you can successfully delete all objects from the layer? What variable are you passing?
Everyone has a Photographic memory, some just don't have film



Why not use LAYDEL?
I can help with VBA if you want, but bog standard ACAD works just as good...
what about this
(command "vbastmt" "ThisDrawing.Layers.item("layername").Delete")
Everyone has a Photographic memory, some just don't have film
ok, that didn't work
Everyone has a Photographic memory, some just don't have film


If in the routine i use LAYDEL then in forth time i run this command i got error and must restart autocad.. Thats why i came with idea to use VBA and pass some vlisp variable that contained the name of the layer to delete as string..


Registered forum members do not see this ad.
Also strange thing happens. I dont really understand if its becaus Im using (command "explode" ...) or laydel, but the thing that happens is, that after command is done i cant go to the paperspace using double click in free space.. i can do it with pspace command. but when i wish to activate the vport, then i cant do it with double click.
When i remove the xplode code part and reopen the drawing, everything seems ok with the activating part.. and when i write the explode code line and reload, then it also works.. but when i reopen the drawing and lisp file is automaticaly loaded, then after the command i cant activate vports using double click.. ITS a MYSTERY>>
Bookmarks