LISP needed to delete OFF layers (with or without content on those layers)

LISP needed to delete OFF layers (with or without content on those layers)

k005
Advisor Advisor
2,582 Views
13 Replies
Message 1 of 14

LISP needed to delete OFF layers (with or without content on those layers)

k005
Advisor
Advisor

Hi All;

 

How can I delete closed OFF layers?

 

***POST TITLE AND BODY EDITED FOR CLARITY***

0 Likes
Accepted solutions (1)
2,583 Views
13 Replies
Replies (13)
Message 2 of 14

rkmcswain
Mentor
Mentor

What do you mean by closed layers? Do you mean empty layers?

Use the PURGE command.

 

If the layer is not empty, then use the LAYMRG command to merge all objects on that layer to some other existing layer.

 

 

 

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 14

k005
Advisor
Advisor

No, it's not empty. It's just off. There is no merging.

I want to delete the closed ones.

0 Likes
Message 4 of 14

pbejse
Mentor
Mentor

@k005 wrote:

Hi All;

 

How can I delete closed layers?


Not sure what that is? Unused layers? Closed polylines on a specific layer? Layers that are currently off/Frozen?

How did the barber win the race?

 

0 Likes
Message 5 of 14

rkmcswain
Mentor
Mentor
@k005 wrote:

No, it's not empty. It's just off. There is no merging.

I want to delete the closed ones.

It depends.

 

Typically, you can't delete layers with object on them, but the LAYDEL command can do it.

 

Another alternative, lets say you have 200 layers, and you want to get rid of 193 of them. It might be easier in this case to (again, presuming the 193 layers are OFF) - use the WBLOCK command to WBLOCK out the visible objects on the 7 remaining layers to a new DWG file. Then open that new DWG file. Boom. Done.

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 6 of 14

rkmcswain
Mentor
Mentor

Oh, few, if anyone here is going to know that "empty" means "off".

"Off" or "Frozen" are the correct terms in the Autodesk world.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 7 of 14

rkmcswain
Mentor
Mentor

Whoa @pendean - when did you get these super powers ?!?

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 8 of 14

k005
Advisor
Advisor

@pbejse 

 

I turned the layers off.

Here is a situation. This dwg file is a block. Therefore, if I delete the closed layers, when I call the blog to another place, unnecessary layers do not appear.

0 Likes
Message 9 of 14

k005
Advisor
Advisor

Yes . It can be this way. But I want to solve this in one go... if possible.

0 Likes
Message 10 of 14

pbejse
Mentor
Mentor

@k005 wrote:

I turned the layers off.

Here is a situation. This dwg file is a block. Therefore, if I delete the closed layers, when I call the blog to another place, unnecessary layers do not appear.


Not sure i understand that @k005. The layers that are off is part of the block, you export the block [ with objects on the off layer ] to another file or drawing but only those are shown on screen? meaning delete the objects on "off"  layers from that block?

 

0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant
Accepted solution

@k005 wrote:

....

How can I delete closed OFF layers?

....


(defun C:LAYOFFDEL (/ lay lname)
  (while (setq lay (tblnext "layer" (not lay)))
    (if
      (and
        (not (wcmatch (setq lname (cdr (assoc 2 lay))) "0,Defpoints"))
        (minusp (cdr (assoc 62 lay))); turned off
      ); and
      (command "_.laydel" "_name" lname "" "_yes")
    ); if
  ); while
  (princ)
); defun
Kent Cooper, AIA
Message 12 of 14

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

....

....
        (minusp (cdr (assoc 62 lay))); turned off
....

That will delete only Layers that are turned off.  If you want to do the same with Layers that are on but frozen, that can also be done.

Kent Cooper, AIA
Message 13 of 14

k005
Advisor
Advisor

my friend ; The scenario is as follows;

 

I create a part of the dwg file as a Block,, I get...

I open and edit this created file. Without changing the reference point.

edit ; I turn off unnecessary layers. Therefore, it is necessary to delete the closed ones. Because it's not necessary. If I don't delete it, the dwg I call also creates a problem.

0 Likes
Message 14 of 14

k005
Advisor
Advisor

@Kent1Cooper 

 

Yes. That's exactly it.

Thank you very much. OK.

0 Likes