Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with layer filter delete routine

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
US
below is some code that we have been using to delete layer filters in our drawings. It works great with acad2004 but has no effect in acad2005. i assume it has to do with the new layering stuff in 2005. The code is not mine it was a download. any help would be great. i think it may be a problem with the acad_layer filters statement but not sure.




(defun C:LayerFiltersDelete ()
(vl-Load-Com)
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove
(vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object)
)
)
)
"ACAD_LAYERFILTERS"
)
)
)
(princ "\nAll layer filters
have been deleted.")
(princ)
)
(defun C:LFD () (C:LayerFiltersDelete))
 
I remember reading in an Autodesk forum, Robert Bell (who supposedly wrote that routine) posted revised code to work for 2005. You might search for that. You could also try "layerfilter", a free routine at
 
THANKS. I DUG A BIT DEEPER AND THIS IS THE FINAL CODE. THE 2005 DICTIONARY IS REFERENCED IN RED.

(defun C:LayerFiltersDelete ()
(vl-Load-Com)
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove
(vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object)
)
)
)
"acad_layerfilters"
)
)
))

;this sections deletes 2005 layer filters and later

(defun c:LayerFiltersDelete2 ()
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove
(vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object))))
"AcLyDictionary")))
)

(defun C:LFD ()
(c:LayerFiltersDelete)
(c:layerfiltersdelete2)
(princ "\nAll layer filters have been deleted.")
(princ)
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top