Ever wondered how to filter your drawing for specific layers?
Well here's how. This application will filter your drawing for a specific
layer using the criteria that you will provide from within a sub-routine.
First of all the Function. Open a new module and add this coding :
Public Function LayerSelection(strLayerName As String, strSSName) _
Dim ssObjects As AcadSelectionSet
Dim intCode(0) As Integer
Dim varData(0) As Variant
Dim objCheck As AcadSelectionSet
intCode(0) = 8
'set variable for the dxf code for layer
varData(0) = strLayerName
'set variable for the layer name
Set ssObjects = ThisDrawing.SelectionSets.Add(strSSName)
'create a selection eset
ssObjects.Select acSelectionSetAll, , , intCode, varData
'select all entities on the specified layer
Set LayerSelection = ssObjects
'create a reference to the selection
Now add the sub-routine to run the function to the same module :
Public Sub FilterLayer()
Dim ssLayrObj As AcadSelectionSet
Set ssLayrObj = LayerSelection("0", "vbdset")
'get the entities on the layer "0"
Dim obj As Object
For Each obj In ssLayrObj
'for each of the entities
'delete the selection set
Run the macro "FilterLayer". All the entities on Layer 0 should
Now you've got them, you can do anything you like with them.
But that, I will leave to your imagination.......
I would just like to thank Randall Raath for allowing me to 'steal' this.
(Saved me a lot of typing!!!!).
If you would like to download the source code for this Application/s, then