Jump to content

Delete all layers except current


woodman78

Recommended Posts

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

  • woodman78

    14

  • BlackBox

    9

  • irneb

    6

  • vnanhvu

    2

Top Posters In This Topic

Posted Images

LAYDEL > Name > Highlight all but one with shift-button

 

Sorry, don't know how to translate it to lisp-speek :(

Link to comment
Share on other sites

First you use command LAYLCK current your layer, and use my code (defun c:EAA () (command "erase" "all" "") (princ))

Link to comment
Share on other sites

Why not just use the wblock command, instead of deleting items from your main drawing??? :?

 

This would also save you the step of saving your main drawing as, then deleting all but what you wanted. Just a thought.

 

LISP:

 

(command "._wblock")

Link to comment
Share on other sites

Why not , new Drawing and make layer as required :? :sweat:

 

The OP already has data on the current (Active) Layer, and wants to isolate that data (by deleting all others), and Save As to another drawing (Hence my suggesting wblock).

 

As I understand it, and perhaps I am mistaken, the OP does not want to open a new (emtpy) drawing and create a new layer.

Link to comment
Share on other sites

The OP already has data on the current (Active) Layer, and wants to isolate that data (by deleting all others), and Save As to another drawing (Hence my suggesting wblock).

 

As I understand it, and perhaps I am mistaken, the OP does not want to open a new (emtpy) drawing and create a new layer.

 

As long as none of anything is clear , we could say everything is possible . ( could be right or wrong ).

 

So Also since mr vnanvhu already given the routine :) and the OP agreed with it in post No 7 , it means that they have nothing to keep

for the current layer while the given codes would erase everything without a permission from anyone . :D

 

Regards.

Link to comment
Share on other sites

Yes, there are multiple ways of accomplishing most tasks in AutoCAD, often times even multiple ways programmatically.

 

If the OP's goal is for the current layer's contents be the only occupants within a separate drawing, Erasing everything (except locked layers) and doing a Save As will work. However the simplest solution is to wblock that layer's contents... Same result, less work.

Link to comment
Share on other sites

I prefer the method I have of delete and saveas. Thanks anyway.

 

No worries; some people prefer to do more work for the same result. :)

Link to comment
Share on other sites

Actually, I'd go with RenderMan's suggestion due to more than just less work: Even after the LayDel, you may still have block definitions, styles, registered apps, dictionaries, etc. contained in the drawing. Not all of which can easily be gotten rid of through multiple purges. The WBlock tends to only save the VERY needed data to the new DWG - all in one single command call.

 

E.g.:

(command "._wblock" "c:\\NewFileName.dwg" "" "_None" '(0.0 0.0 0.0) (ssget "_X" (list (cons 8 (getvar "CLAYER")))) "")

One thing though, that will only export the entities selectable on the current tab. So if you need all the tabs and their contents as well, then you should rather go with the SaveAs method.

Link to comment
Share on other sites

@Irneb - Perhaps I did a poor sales job for wblock; I appreciate your stepping in to clarify the benefits beyond simple efficiency, as I quickly tired of what turned out to be arguing the point.

 

You can only lead a horse to water....

 

1995-04-14.gif

 

:lol: LoL

Link to comment
Share on other sites

I get your points about the wblock and I did consider it but I won't be saving the drawing to the same location each time. The user will choose the save location. And I know there are a few guys here who get freaked out by anything that isn't an open or save dialog box.

 

If I was to do wblock could I invoke a dialog to choose the folder to save the drawing to and the drawing name. A bit like saveas?

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