.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deleting Layer Filters

2 REPLIES 2
Reply
Message 1 of 3
Saumitra
499 Views, 2 Replies

Deleting Layer Filters

Hi

I am trying to write code in VB.NET to delete all the layer filters in a bunch of drawings (AutoCAD 2008). Some of the drawings have lots of junk layer filters (numbers running into 20-30000's) and hence, the need to automate this.

I have been able to automate the code but the problem is that it takes a lot of time to delete( around 2-3 minutes per drawing). Can someone suggest improvements to it or another alternative? (something as fast as the "Delete" button in the form that comes up after typing the Filters command). Here is my code

Dim acadDictionary As AcadDictionary
Dim layerFilter As Object
Dim xRecord As AcadXRecord

acadDictionary = _MyAutoCAD.ActiveDocument.Layers.GetExtensionDictionary

layerFilter = acadDictionary.Item("ACAD_LAYERFILTERS")

For Each xRecord In layerFilter
xRecord.Delete()
Next

Thanks

Saumitra
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Saumitra

You don't have to delete each layer filter, just delete
the ACAD_LAYERFILTERS parent dictionary, and that's
it.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5718396@discussion.autodesk.com...
Hi

I am trying to write code in VB.NET to delete all the layer filters in a bunch of drawings (AutoCAD 2008). Some of the drawings have lots of junk layer filters (numbers running into 20-30000's) and hence, the need to automate this.

I have been able to automate the code but the problem is that it takes a lot of time to delete( around 2-3 minutes per drawing). Can someone suggest improvements to it or another alternative? (something as fast as the "Delete" button in the form that comes up after typing the Filters command). Here is my code

Dim acadDictionary As AcadDictionary
Dim layerFilter As Object
Dim xRecord As AcadXRecord

acadDictionary = _MyAutoCAD.ActiveDocument.Layers.GetExtensionDictionary

layerFilter = acadDictionary.Item("ACAD_LAYERFILTERS")

For Each xRecord In layerFilter
xRecord.Delete()
Next

Thanks

Saumitra
Message 3 of 3
Saumitra
in reply to: Saumitra

Thanks Tony

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost