Hi
I want to delete all layers starting with a certain name, which I can do as long as the layer is empty.
My question is - How do you find all the entities in a layer, so I can then delete them and so therefore delete the layer?
Thanks in advance
Phil
#2
Hi wonton,
You can use a selection set with filter by Layer. Here is an example on how to delete all the entities drawn on "MyLayer":
Regards,
JCAMPOS
You can use a selection set with filter by Layer. Here is an example on how to delete all the entities drawn on "MyLayer":
Code: Select all
Public Sub DeleteAllEntitiesInMyLayer()
'Initializes a new SelectionSet:
Dim sset As IntelliCAD.SelectionSet
'Defines the filter for the SelectionSet:
Dim filterTypes(0) As Integer
Dim filterData(0) As Variant
filterTypes(0) = 8: filterData(0) = "MyLayer"
'Creates the selection using the SelectionSet:
Set sset = IntelliCAD.ActiveDocument.SelectionSets.Add("MyLayerSSet")
Call sset.Select(IntelliCAD.SelectionSetType.vicSelectionSetAll, , , filterTypes, filterData)
Dim i As Integer
Dim ent As IntelliCAD.entity
For i = 1 To sset.Count
'Gets the entity:
Set ent = sset.Item(i)
'Deletes the entity:
ent.Delete
Next i
End Sub
JCAMPOS