Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Delete / Remove all frozen and_or turned off layers?

  1. #11
    100 Club
    Join Date
    2003-11
    Location
    Dublin, Ireland.
    Posts
    152
    Login to Give a bone
    0

    Default Re: Delete / Remove all frozen and_or turned off layers?

    Quote Originally Posted by stephen.coff
    For some reason they don't seem to properly purge the layers after removing the objects which was the reason for my comments. I ran both routines and with they layers off or frozen and then checked and layers were still showing as being there. It wasn't until I turned everything on that I realised the objects etc had actually been removed thus the routine just dosen't seem to purge it correctly.


    Stephen

    Code:
        (vlax-for lay layers
        	(if
          	(eq (vla-get-freeze lay) :vlax-true)
          	(vla-put-freeze lay :vlax-false)
        	)
          )
      (vlax-for lay layers
        	(vla-put-layeron lay :vlax-true)
          )
      
      (vla-purgeall Doc)
      
      
      (princ (strcat "\nDone....deleted " (itoa (1+ idx)) " entities from the drawing."))
      (princ)
      )
    I stuck this at the bottem of Miff's routine and it seemed to work.
    I'm sure it could be written more eloquently, and hopefully somebody out therewill do just that so we could see how it can be done.

    John

  2. #12
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Delete / Remove all frozen and_or turned off layers?

    First, I didn't notice that you also wanted the layers purged, sorry about that. Second, in light of that, there are more things that would need to be checked to truly be able to purge them.....I don't have the time right now to code this, but the idea wouold be to attempt to delete the layers after you delete the entities on them. So I'd add a variable, layobjlist, to place the (vla-object) of the layers we are deleting in the code where we get the name, then after this code:
    Code:
          (while (setq ent (ssname ss (setq idx (1+ idx))))
    	(vla-delete (vlax-ename->vla-object ent))
    	)
    you'd add something like this:
    Code:
        (mapcar '(lambda (x)
                      (setq tmperr (vl-catch-all-apply 'vla-delete x))
                      (if (vl-catch-all-error-p tmperr)
                        (setq notdeleted (cons x notdeleted))
                       )
                       )
                  layoblist)
    Then, if the variable 'notdeleted' is not nil, those layers are in use by a DimStyle, frozen in a PS viewport, used by an object in a block, etc. and need to be dealt with in other ways.

  3. #13
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Delete / Remove all frozen and_or turned off layers?

    Guys,
    This might sound rude though not meant to be. I want to add this into another routine I have made for stripping Architects drawings. I have writen it in lisp and wondered if anyone could write this for me likewise ?

    Stephen

  4. #14
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Delete / Remove all frozen and_or turned off layers?

    Uh, everything that's been posted HAS been in lisp......notice all the (....)'s?

    What Autocad version are you using, Stephen?

    How about posting what you've written so we can see how to best incorporate it with what we've shown?

  5. #15
    Woo! Hoo! my 1st post
    Join Date
    2015-07
    Posts
    1
    Login to Give a bone
    0

    Thumbs up Re: Delete / Remove all frozen and_or turned off layers?

    Quote Originally Posted by aaronic_abacus View Post
    ;Below is EFEL.LSP revised to account for an empty selection set.
    ;The program will not work with nested entities
    ; where the block is on an thawed layer and the nested entities on a frozen layer.

    Code:
    (DEFUN C:EFEL ()
     (PROMPT "\n*ERASE ALL FROZEN ENTITIES BY LAYER(with purge)* ")
     (SETQ LTSRL 1)
     (SETQ LP 1)
     (WHILE LP
      (SETQ LTS (TBLNEXT "LAYER" LTSRL))
      (SETQ LTSRL NIL)
      (SETQ LTSF (CDR (ASSOC 70 LTS)))
      (SETQ LTST (CDR (ASSOC 2 LTS)))
      (SETQ LTSTF (LIST (CONS 8 LTST)))
      (IF (= LTSF 1)
       (PROGN
        (SETQ EBS (SSGET "X" LTSTF))
        (IF (/= EBS NIL) (COMMAND "ERASE" EBS ""))
        (COMMAND "PURGE" "LA" LTST "N")
      ));END PROGN/IF LTSF
      (IF (= LTS NIL) (SETQ LP NIL))
     );END LP
     (PRINC)
    );END EFEL
    Still works in 2016! =) Awesome!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 7
    Last Post: 2018-04-13, 03:57 AM
  2. Convert off layers to frozen layers
    By Tom.Weinstein.137333 in forum AutoCAD General
    Replies: 2
    Last Post: 2012-11-08, 05:04 PM
  3. 2012: Layers frozen in P.S.
    By tvri in forum AutoCAD General
    Replies: 5
    Last Post: 2012-01-23, 12:38 PM
  4. FROZEN LAYERS
    By philw in forum AutoCAD General
    Replies: 1
    Last Post: 2008-01-15, 03:59 PM
  5. Notification of layers turned off/frozen
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-01-16, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •