Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lisp to remove/purge layer filters

18 REPLIES 18
Reply
Message 1 of 19
Anonymous
580 Views, 18 Replies

lisp to remove/purge layer filters

We have some consultants who use 400+ layer filters - which is exceedingly annoying. I want to know if there is a quick streamlined way of remove the majority of layer filters except the ones we want using lisp. Any help would be appreciated, I've looked around the autolisp help in a2k without much luck. I know about spurge and I really want to develop a streamlined tool that just addresses this issue. -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977)
18 REPLIES 18
Message 2 of 19
Anonymous
in reply to: Anonymous

Something like this: ; Jason Piercey . December 4th, 2003 ; Note: This DOES NOT work in AutoCAD 2005 (defun c:deleteLayerFilters (/ res obj flag i) (vl-catch-all-apply (function (lambda () (setq obj (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS" ) ) (cond ((zerop (vla-get-count obj)) (princ "\nno layer filters to delete") ) (t (if (/= "" (setq res (getstring t "\nfilters to delete <*>: "))) (setq res (strcase res)) (setq res "*") ) (setq i 0) (vlax-for filter obj (if (wcmatch (strcase (vla-get-name filter)) res) (progn (vla-delete filter) (setq i (1+ i)) (setq flag t)) ) ) (if flag (princ (strcat "\n" (itoa i) " filters deleted")) (princ "\nno matching filters found") ) ) ) ) ) ) (princ) ) -- Autodesk Discussion Group Facilitator "Jamie Duncan" wrote in message news:405075bc_3@newsprd01... We have some consultants who use 400+ layer filters - which is exceedingly annoying. I want to know if there is a quick streamlined way of remove the majority of layer filters except the ones we want using lisp. Any help would be appreciated, I've looked around the autolisp help in a2k without much luck. I know about spurge and I really want to develop a streamlined tool that just addresses this issue.
Message 3 of 19
Anonymous
in reply to: Anonymous

Jason, Yours *might* still work in A2k5 if the filters were created by A2k4 or earlier. This take on my last relevant post will take care of A2k5 filters too. ;;; Written by R. Robert Bell ;;; Allows the user to enter a wildcard string to keep matching filters. ;;; Sample string: "`#*,MW*" will keep all filters beginning with a "#" or "MW" (defun rrbI:LayerFiltersDelete (strKeepWC / objXDict) (vl-load-com) (vl-catch-all-apply (function (lambda () (setq objXDict (vla-GetExtensionDictionary (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))))))) (cond (objXDict (or (rrbI:DeleteAllXRecs objXDict "ACAD_LAYERFILTERS" strKeepWC) (rrbI:DeleteAllXRecs objXDict "AcLyDictionary" strKeepWC))))) (defun rrbI:DeleteAllXRecs (objXDict dictName strKeepWC / objDict i) (vl-catch-all-apply (function (lambda () (setq objDict (vla-Item objXDict dictName)) (vlax-for objXRec objDict (cond ((not (and strKeepWC (wcmatch (vla-Get-Name objXRec) strKeepWC))) (setq i (1+ (cond (i) (0)))) (vla-Delete objXRec))))))) (cond (i (princ (strcat "\n" (itoa i) " filters deleted."))))) (defun C:LFD (/ inpKeep) (setq inpKeep (getstring "\nWildcard mask for filters to keep, or to delete all: ")) (rrbI:LayerFiltersDelete (cond ((/= inpKeep "") inpKeep))) (princ)) -- R. Robert Bell
Message 4 of 19
Anonymous
in reply to: Anonymous

I was using mine the other day on a clients drawing and the filters remained intact (the filters had to of been created with A2K4 or previous) that is why I posted about this the other day. -- Autodesk Discussion Group Facilitator "R. Robert Bell" wrote in message news:40508caf$1_1@newsprd01... > Jason, > > Yours *might* still work in A2k5 if the filters were created by A2k4 or > earlier.
Message 5 of 19
Anonymous
in reply to: Anonymous

I opened a 2000-based drawing file with 2000-based XRefs in A2k5 and the old dictionary was still used in that case. At least my code will take care of either case. -- R. Robert Bell "Jason Piercey" wrote in message news:40508ec7$1_3@newsprd01... I was using mine the other day on a clients drawing and the filters remained intact (the filters had to of been created with A2K4 or previous) that is why I posted about this the other day. -- Autodesk Discussion Group Facilitator "R. Robert Bell" wrote in message news:40508caf$1_1@newsprd01... > Jason, > > Yours *might* still work in A2k5 if the filters were created by A2k4 or > earlier.
Message 6 of 19
Anonymous
in reply to: Anonymous

Thanks to you both. I guess I could create a list of the layer filters I want and if the filtername is a member of the list it isn't deleted. I'm really clueless on the vlisp stuff, so Ionly partially understand the code. Oh well, just going to have to keep trudging up the learning curve... Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "Jamie Duncan" wrote in message news:405075bc_3@newsprd01... We have some consultants who use 400+ layer filters - which is exceedingly annoying. I want to know if there is a quick streamlined way of remove the majority of layer filters except the ones we want using lisp. Any help would be appreciated, I've looked around the autolisp help in a2k without much luck. I know about spurge and I really want to develop a streamlined tool that just addresses this issue. -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977)
Message 7 of 19
Anonymous
in reply to: Anonymous

If you want to keep filters Mine, Yours, and any that start with a 0, you would do this: Command: LFD Wildcard mask for filters to keep, or to delete all: Mine,Yours,0* 244 filters deleted. Command: I have a fully commented version, if you want it. P.S. Watch for word-wrap on my post. -- R. Robert Bell "Jamie Duncan (remove lock to reply)" wrote in message news:4050942c$1_1@newsprd01... Thanks to you both. I guess I could create a list of the layer filters I want and if the filtername is a member of the list it isn't deleted. I'm really clueless on the vlisp stuff, so Ionly partially understand the code. Oh well, just going to have to keep trudging up the learning curve... Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "Jamie Duncan" wrote in message news:405075bc_3@newsprd01... We have some consultants who use 400+ layer filters - which is exceedingly annoying. I want to know if there is a quick streamlined way of remove the majority of layer filters except the ones we want using lisp. Any help would be appreciated, I've looked around the autolisp help in a2k without much luck. I know about spurge and I really want to develop a streamlined tool that just addresses this issue. -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977)
Message 8 of 19
Anonymous
in reply to: Anonymous

Thanks Robert! I would appreciate the fully commented version - learning by example is de rigeur for lisp it seems. -- Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "R. Robert Bell" wrote in message news:40509b20$1_1@newsprd01... > If you want to keep filters Mine, Yours, and any that start with a 0, you > would do this: > > Command: LFD > Wildcard mask for filters to keep, or to delete all: Mine,Yours,0* > > 244 filters deleted. > > Command: > > I have a fully commented version, if you want it. > > > P.S. Watch for word-wrap on my post. > > -- > R. Robert Bell > > > "Jamie Duncan (remove lock to reply)" wrote in > message news:4050942c$1_1@newsprd01... > Thanks to you both. I guess I could create a list of the layer filters I > want and if the filtername is a member of the list it isn't deleted. > > I'm really clueless on the vlisp stuff, so Ionly partially understand the > code. Oh well, just going to have to keep trudging up the learning curve... > > Jamie Duncan > > Consulting - If you're not part of the solution, there's good money in > prolonging the problem. > "Jamie Duncan" wrote in message > news:405075bc_3@newsprd01... > We have some consultants who use 400+ layer filters - which is exceedingly > annoying. I want to know if there is a quick streamlined way of remove the > majority of layer filters except the ones we want using lisp. > > Any help would be appreciated, I've looked around the autolisp help in a2k > without much luck. I know about spurge and I really want to develop a > streamlined tool that just addresses this issue. > > > > -- > Jamie Duncan > > "How wrong it is for a woman to expect the man to build the world she > wants, rather than to create it herself." > - Anais Nin (1903-1977) > > >
Message 9 of 19
Anonymous
in reply to: Anonymous

Here you go! -- R. Robert Bell "Jamie Duncan (remove lock to reply)" wrote in message news:40509c13$1_3@newsprd01... Thanks Robert! I would appreciate the fully commented version - learning by example is de rigeur for lisp it seems. -- Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "R. Robert Bell" wrote in message news:40509b20$1_1@newsprd01... > If you want to keep filters Mine, Yours, and any that start with a 0, you > would do this: > > Command: LFD > Wildcard mask for filters to keep, or to delete all: Mine,Yours,0* > > 244 filters deleted. > > Command: > > I have a fully commented version, if you want it. > Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp" Attachment not added (content type not allowed): "LayerFiltersDelete.lsp"
Message 10 of 19
Anonymous
in reply to: Anonymous

Robert! Fantastic! I just switched the getstring to a fixeed string (for my users) and guess what? 2303 filters deleted! Can you stand it? who the heck needs 2303 layer filters? Thanks for the notes - I will peruse it later when I've calmed down. -- Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "R. Robert Bell" wrote in message news:4050a219$1_3@newsprd01... > Here you go! > > -- > R. Robert Bell > > > "Jamie Duncan (remove lock to reply)" wrote in > message news:40509c13$1_3@newsprd01... > Thanks Robert! I would appreciate the fully commented version - learning by > example is de rigeur for lisp it seems. > > -- > > > Jamie Duncan > > Consulting - If you're not part of the solution, there's good money in > prolonging the problem. > "R. Robert Bell" wrote in message > news:40509b20$1_1@newsprd01... > > If you want to keep filters Mine, Yours, and any that start with a 0, you > > would do this: > > > > Command: LFD > > Wildcard mask for filters to keep, or to delete all: Mine,Yours,0* > > > > 244 filters deleted. > > > > Command: > > > > I have a fully commented version, if you want it. > > > > >
Message 11 of 19
Anonymous
in reply to: Anonymous

Glad I could help! -- R. Robert Bell "Jamie Duncan (remove lock to reply)" wrote in message news:4050a3b9$1_2@newsprd01... Robert! Fantastic! I just switched the getstring to a fixeed string (for my users) and guess what? 2303 filters deleted! Can you stand it? who the heck needs 2303 layer filters? Thanks for the notes - I will peruse it later when I've calmed down. -- Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "R. Robert Bell" wrote in message news:4050a219$1_3@newsprd01... > Here you go! > > -- > R. Robert Bell > > > "Jamie Duncan (remove lock to reply)" wrote in > message news:40509c13$1_3@newsprd01... > Thanks Robert! I would appreciate the fully commented version - learning by > example is de rigeur for lisp it seems. > > -- > > > Jamie Duncan > > Consulting - If you're not part of the solution, there's good money in > prolonging the problem. > "R. Robert Bell" wrote in message > news:40509b20$1_1@newsprd01... > > If you want to keep filters Mine, Yours, and any that start with a 0, you > > would do this: > > > > Command: LFD > > Wildcard mask for filters to keep, or to delete all: Mine,Yours,0* > > > > 244 filters deleted. > > > > Command: > > > > I have a fully commented version, if you want it. > > > > >
Message 12 of 19
Anonymous
in reply to: Anonymous

I removed about 4600+- filter from a clients drawing the other day.... 4600! -- Autodesk Discussion Group Facilitator "Jamie Duncan (remove lock to reply)" wrote in message news:4050a3b9$1_2@newsprd01... > 2303 filters deleted! Can you stand it? who the heck needs 2303 layer > filters?
Message 13 of 19
Anonymous
in reply to: Anonymous

didn't you keep 4599? I heard it was a good filter..... Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "Jason Piercey" wrote in message news:4050a522_3@newsprd01... > I removed about 4600+- filter from a clients > drawing the other day.... 4600! > > -- > > Autodesk Discussion Group Facilitator > > > "Jamie Duncan (remove lock to reply)" wrote in message > news:4050a3b9$1_2@newsprd01... > > > 2303 filters deleted! Can you stand it? who the heck needs 2303 layer > > filters? > >
Message 14 of 19
Anonymous
in reply to: Anonymous

small millwork drawing - 10131 layer filters! -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977) "Jason Piercey" wrote in message news:4050a522_3@newsprd01... > I removed about 4600+- filter from a clients > drawing the other day.... 4600! > > -- > > Autodesk Discussion Group Facilitator > > > "Jamie Duncan (remove lock to reply)" wrote in message > news:4050a3b9$1_2@newsprd01... > > > 2303 filters deleted! Can you stand it? who the heck needs 2303 layer > > filters? > >
Message 15 of 19
Anonymous
in reply to: Anonymous

Ridiculous -- Autodesk Discussion Group Facilitator "Jamie Duncan" wrote in message news:40512f47$1_2@newsprd01... > small millwork drawing - 10131 layer filters!
Message 16 of 19
alexshein
in reply to: Anonymous

Guys,
First of all i want to thank you both for your great programs. We removed all filters from our incoming backgrounds, which is about 8000 per file. I notices that most of filters had weird names suggested an automatic generation of filter every time your use any of preset option i.e. Show All X-ref Dependant layers. If I'm right, is it possible to turn this auto generation off?
Message 17 of 19
Anonymous
in reply to: Anonymous

seriously thinking to have this every time a drawing is opened. More kb for the layer filters than the entities! -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977) "Jason Piercey" wrote in message news:4051b99c$1_1@newsprd01... > Ridiculous > > -- > Autodesk Discussion Group Facilitator > > > "Jamie Duncan" wrote in message > news:40512f47$1_2@newsprd01... > > small millwork drawing - 10131 layer filters! > >
Message 18 of 19
Anonymous
in reply to: Anonymous

Jamie, You'll be surprised if I gave you the number of our winner (civil engeneers) 15252 filters deleted in 1 file with no xrefs... Kal "Jamie Duncan (remove lock to reply)" wrote in message news:4050a3b9$1_2@newsprd01... > Robert! > > Fantastic! I just switched the getstring to a fixeed string (for my users) > and guess what? > > 2303 filters deleted! Can you stand it? who the heck needs 2303 layer > filters? > > Thanks for the notes - I will peruse it later when I've calmed down. > > -- > > > Jamie Duncan > > Consulting - If you're not part of the solution, there's good money in > prolonging the problem. > "R. Robert Bell" wrote in message > news:4050a219$1_3@newsprd01... > > Here you go! > > > > -- > > R. Robert Bell > > > > > > "Jamie Duncan (remove lock to reply)" wrote in > > message news:40509c13$1_3@newsprd01... > > Thanks Robert! I would appreciate the fully commented version - learning > by > > example is de rigeur for lisp it seems. > > > > -- > > > > > > Jamie Duncan > > > > Consulting - If you're not part of the solution, there's good money in > > prolonging the problem. > > "R. Robert Bell" wrote in message > > news:40509b20$1_1@newsprd01... > > > If you want to keep filters Mine, Yours, and any that start with a 0, > you > > > would do this: > > > > > > Command: LFD > > > Wildcard mask for filters to keep, or to delete all: > Mine,Yours,0* > > > > > > 244 filters deleted. > > > > > > Command: > > > > > > I have a fully commented version, if you want it. > > > > > > > > > > >
Message 19 of 19
Anonymous
in reply to: Anonymous

That would be 150 filters per layer? or 300? Jamie Duncan Consulting - If you're not part of the solution, there's good money in prolonging the problem. "Kal Houhou" wrote in message news:40541199_1@newsprd01... > Jamie, > You'll be surprised if I gave you the number of our winner (civil engeneers) > 15252 filters deleted in 1 file with no xrefs... > > Kal > > > "Jamie Duncan (remove lock to reply)" wrote in > message news:4050a3b9$1_2@newsprd01... > > Robert! > > > > Fantastic! I just switched the getstring to a fixeed string (for my > users) > > and guess what? > > > > 2303 filters deleted! Can you stand it? who the heck needs 2303 layer > > filters? > > > > Thanks for the notes - I will peruse it later when I've calmed down. > > > > -- > > > > > > Jamie Duncan > > > > Consulting - If you're not part of the solution, there's good money in > > prolonging the problem. > > "R. Robert Bell" wrote in message > > news:4050a219$1_3@newsprd01... > > > Here you go! > > > > > > -- > > > R. Robert Bell > > > > > > > > > "Jamie Duncan (remove lock to reply)" wrote in > > > message news:40509c13$1_3@newsprd01... > > > Thanks Robert! I would appreciate the fully commented version - > learning > > by > > > example is de rigeur for lisp it seems. > > > > > > -- > > > > > > > > > Jamie Duncan > > > > > > Consulting - If you're not part of the solution, there's good money in > > > prolonging the problem. > > > "R. Robert Bell" wrote in message > > > news:40509b20$1_1@newsprd01... > > > > If you want to keep filters Mine, Yours, and any that start with a 0, > > you > > > > would do this: > > > > > > > > Command: LFD > > > > Wildcard mask for filters to keep, or to delete all: > > Mine,Yours,0* > > > > > > > > 244 filters deleted. > > > > > > > > Command: > > > > > > > > I have a fully commented version, if you want it. > > > > > > > > > > > > > > > > > > >

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost