alanjt Posted February 23, 2010 Posted February 23, 2010 Yeah, but it would have just been wierd to let that go on too long. Oh I know, baby.:wink: Quote
ksperopoulos Posted June 21, 2010 Posted June 21, 2010 Perhaps: (defun c:DeleteAll (/ *error* LAYER UFLAG) (vl-load-com) ;; Lee Mac ~ 23.02.10 (defun *error* (msg) (and UFlag (vla-EndUndoMark *doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq layer "Blah") (setq *doc (cond (*doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (if (and (tblsearch "LAYER" layer) (eq :vlax-false (vla-get-lock (vla-item (vla-get-Layers *doc) layer)))) (progn (setq uFlag (not (vla-StartUndoMark *doc))) (vlax-for lay (vla-get-Layouts *doc) (vlax-for obj (vla-get-Block lay) (if (eq (strcase layer) (strcase (vla-get-layer obj))) (vl-catch-all-apply (function vla-delete) (list obj))))) (vlax-for blk (vla-get-Blocks *doc) (vlax-for obj blk (if (eq (strcase layer) (strcase (vla-get-layer obj))) (vl-catch-all-apply (function vla-delete) (list obj))))) (setq uFlag (vla-EndUndomark *doc))) (princ "\n** Layer Locked or Not Found **")) (princ)) Is there any way to get this to select all non-plotting layers even if they are frozen, off, locked, in a block, or in an attribute? Quote
VVA Posted June 21, 2010 Posted June 21, 2010 Try this program BGLAYDEL - delete frozen and off layers with objects bglaydel.lsp Quote
ksperopoulos Posted June 22, 2010 Posted June 22, 2010 VVA - This didn't delete the objects on the non plotting layers. This is a lot of code. Not knowing how to manipulate something this large, is there something in particular I need to change to get it to delete the non plotting layers? Quote
VVA Posted June 22, 2010 Posted June 22, 2010 VVA - This didn't delete the objects on the non plotting layers. BGLAYDEL - delete frozen and off layers with objects There are 2 ways - 1. off non plotting layers 2. Found string vla-get-freeze. You will find this part of the code: (if (or (= (vla-get-freeze item) :vlax-true) (= (vla-get-layeron item) :vlax-false) ) ;_ end of or Add one more string (if (or (= (vla-get-freeze item) :vlax-true) (= (vla-get-layeron item) :vlax-false) [b][color="Red"] (= (vla-get-Plottable item) :vlax-false)[/color][/b] ) ;_ end of or Quote
ronjonp Posted June 29, 2017 Posted June 29, 2017 WCMATCH (defun c:deleteall (/ *error* layer uflag) (vl-load-com) ;; Lee Mac ~ 23.02.10 ;; RJP - 06.30.2017 (defun *error* (msg) (and uflag (vla-endundomark *doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) ;; Separate layer names with commas for WCMATCH below ( removed check if layers are locked so it's up to you ) (setq layer (strcase "Layer1,Layer2,Layer3")) (setq *doc (cond (*doc) ((vla-get-activedocument (vlax-get-acad-object))) ) ) (setq uflag (not (vla-startundomark *doc))) (vlax-for lay (vla-get-layouts *doc) (vlax-for obj (vla-get-block lay) (if (wcmatch (strcase (vla-get-layer obj)) layer) (vl-catch-all-apply (function vla-delete) (list obj)) ) ) ) (vlax-for blk (vla-get-blocks *doc) (vlax-for obj blk (if (wcmatch (strcase (vla-get-layer obj)) layer) (vl-catch-all-apply (function vla-delete) (list obj)) ) ) ) (setq uflag (vla-endundomark *doc)) (princ) ) Quote
Mike52482 Posted October 30, 2019 Posted October 30, 2019 On 6/29/2017 at 11:22 AM, ronjonp said: WCMATCH (defun c:deleteall (/ *error* layer uflag) (vl-load-com) ;; Lee Mac ~ 23.02.10 ;; RJP - 06.30.2017 (defun *error* (msg) (and uflag (vla-endundomark *doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) ;; Separate layer names with commas for WCMATCH below ( removed check if layers are locked so it's up to you ) (setq layer (strcase "Layer1,Layer2,Layer3")) (setq *doc (cond (*doc) ((vla-get-activedocument (vlax-get-acad-object))) ) ) (setq uflag (not (vla-startundomark *doc))) (vlax-for lay (vla-get-layouts *doc) (vlax-for obj (vla-get-block lay) (if (wcmatch (strcase (vla-get-layer obj)) layer) (vl-catch-all-apply (function vla-delete) (list obj)) ) ) ) (vlax-for blk (vla-get-blocks *doc) (vlax-for obj blk (if (wcmatch (strcase (vla-get-layer obj)) layer) (vl-catch-all-apply (function vla-delete) (list obj)) ) ) ) (setq uflag (vla-endundomark *doc)) (princ) ) Thank you very much. I have been searching for a lsp to do exactly this for a week! Quote
Recommended Posts
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.