Page 1 of 2 12 LastLast
Results 1 to 10 of 15

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

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

    Cool Delete / Remove all frozen and_or turned off layers?

    Guys,
    In the process of making a lisp routine that strips and prepares the Architects drawing for use as a background xref.
    I have most things sorted, it renames the files and saves it in it's required place. It thens follows on to removal of dimensions, solids and hatching etc
    It creates 1 layer name "Architectural" and then places everything on that layer and purges and audits. I am pretty happy with that though have noticed a couple of small things that i am not sure how to do. Often people have info on drawings that they don't want seen so they freeze the layer or turn it off. With lisp, how can i remove only the frozen or turned off layers ? I need to do this because I am ending up with this **** exploded on the drawings and then all on the same layer, not good.

    If anyone could assist I would be most grateful.

    regards

    Stephen

  2. #2
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

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

    ;This autolisp program deletes all frozen entities and purges their layers.

    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))
        (COMMAND "ERASE" EBS "")
        (COMMAND "LAYER" "T" "0" "S" "0" "")
        (COMMAND "PURGE" "LA" LTST "N")
      ));END PROGN/IF LTSF
      (IF (= LTS NIL) (SETQ LP NIL))
     );END LP
     (PRINC)
    );END EFEL
    Attached Files Attached Files
    Last edited by aaronic_abacus; 2007-03-25 at 12:38 AM.

  3. #3
    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?

    Once again,
    Aarinic, greatly appreciated.

    regards

    Stephen

  4. #4
    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?

    Aaronic,
    I tried it on an Architectural I had been using recently.
    I exploded the drawing a couple of times as it was a nested block. I ran the routine though something is quite right, it keeps running through repeating the same error.

    I have attached the drawing.

    Reagrds

    Stephen
    Attached Files Attached Files

  5. #5
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

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

    ;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
    Attached Files Attached Files
    Last edited by aaronic_abacus; 2007-03-25 at 06:54 PM.

  6. #6
    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?

    Aaronic,
    Thanks, grately appreciated.

    Stephen

  7. #7
    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,
    Does anyone have anything elese ? No disrespect Aaronic though this routine doesn't seem to do what i am looking for.
    I want to be able to remove all frozen and turn off layers with all there content.

    Could someone tell me how I make a selection set with all the frozen and turned off objects ?

    Regrads

    Stephen

  8. #8
    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?

    Hi Stephen, give this a try...
    Code:
    (defun c:delfrzoff (/ blocks doc ent idx layers lays2delete ss)
      (vl-load-com)
      (setq doc (vla-get-activedocument (vlax-get-acad-object))
    	layers (vla-get-layers doc)
    	blocks (vla-get-blocks doc)
    	idx -1
    	)
      (vlax-for lay layers
        (if (or (eq (vla-get-layeron lay) :vlax-false)
    	    (eq (vla-get-freeze lay) :vlax-true)
    	    )
          (progn
    	(vla-put-lock lay :vlax-false)
    	(if lays2delete
    	  (setq lays2delete (strcat lays2delete "," (vla-get-name lay)))
    	  (setq lays2delete (vla-get-name lay))
    	  )
    	)
          )
        )
      (if (and lays2delete
    	   (setq ss (ssget "x" (list (cons 8 lays2delete))))
    	   )
        (progn
          (while (setq ent (ssname ss (setq idx (1+ idx))))
    	(vla-delete (vlax-ename->vla-object ent))
    	)
          )
        )
      (princ (strcat "\nDone....deleted " (itoa (1+ idx)) " entities from the drawing."))
      (princ)
      )
    HTH,
    Jeff

  9. #9
    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?

    Aaronic,
    My apologies. I have come to realise that both routines do the same thing which is what I had asked for. 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.
    Thank you both for your help and efforts.

    Stephen

  10. #10
    Active Member
    Join Date
    2002-01
    Posts
    99
    Login to Give a bone
    0

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

    I am a weak lisp writer, but i could suggest you lock the layers you want to save, then turn on and thaw everything. Then do an erase all and follow up with a purge, audit (Dont forget to purge your reg-apps)

Page 1 of 2 12 LastLast

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
  •