Results 1 to 2 of 2

Thread: Empty layer 1__1 will not delete

  1. #1
    Member
    Join Date
    2001-08
    Posts
    24
    Login to Give a bone
    0

    Default Empty layer 1__1 will not delete

    So I'm missing something here. This doesn't seem to delete the 1__1 layer that is empty once I move objects over to the "Line4" layer.

    Code:
      (setq lay2 (ssget "x" '((8 . "1__1"))))
      (setq flag (tblsearch "LAYER" "1__1"))
      (if flag
            (command "_change" lay2 "" "P" "layer" "LINE4" "")
        	(command "_purge" "LA" lay2 "n")
     )
    Hmmmm...maybe I should just use Laydel instead of purge.

    Edit:
    A little Follow up after I posted. I changed the purge to a Laydel and it works when I try it at the command line but doesn't work in the routine.


    On a side note looking at this I am not sure where I'm putting the list of layers.
    Code:
    ;;; Purge all layers except those in list
    ;;; Example: (ax:purge-layers (vla-get-activedocument (vlax-get-acad-object)) '("DIM" "LAYER1"))
    ;;; Argument: doc {document}
    ;;;           name {a layer name list}
    (defun ax:purge-layers (doc except)
      (vlax-for item (vla-get-layers doc)
        (setq ln (vla-get-name item))
        (if (not (member (strcase ln) except))
          (purge-layer ln)
        )
      )
    )
    J. Logan
    ACAD 2016
    Last edited by rkmcswain; 2017-12-13 at 02:28 AM. Reason: added [CODE] tags

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Empty layer 1__1 will not delete

    Just a note, you can't purge a layer (or anything else) that is referenced.

    Just because you delete all visible entities that are on a layer, doesn't mean nothing is referencing that layer. It could be referenced by an entity in a block definition, or by Xdata, or by a number of other things.

    LAYMRG and LAYDEL hunt down and change those references, that is why they generally work.
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. Replies: 3
    Last Post: 2017-07-22, 05:56 AM
  2. 2014: delete empty View/sheet set
    By mostafa90 in forum Revit - API
    Replies: 7
    Last Post: 2014-08-06, 06:25 PM
  3. Tip - Delete all your empty folders on a drive
    By madcadder in forum CAD Management - General
    Replies: 11
    Last Post: 2008-06-23, 02:55 PM
  4. Layer Manager to delete multiple layer states
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2006-05-19, 02:11 PM
  5. Replies: 1
    Last Post: 2006-04-03, 10:01 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
  •