Get the type of layer from a selection set

Get the type of layer from a selection set

Anonymous
Not applicable
321 Views
3 Replies
Message 1 of 4

Get the type of layer from a selection set

Anonymous
Not applicable
I want to get the index of layer in a selection set.
I dont want the duplicated information.
Es:
In my SelObj (selset) i have a lot of objects in four layer.
I want to get the number of the layer used in selection set.
If i iterated the selection with the single entity i obtain the duplicated.
Thx for help and sorry for my english.
0 Likes
322 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
A little difficult to understand. Are you looking
to find all objects that are on a certain layer within a slection
set?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
want to get the index of layer in a selection set.
I dont want the
duplicated information.
Es:
In my SelObj (selset) i have a lot of
objects in four layer.
I want to get the number of the layer used in
selection set.
If i iterated the selection with the single entity i obtain
the duplicated.
Thx for help and sorry for my
english.
0 Likes
Message 3 of 4

Anonymous
Not applicable
I want to get the index of layer in a selection set.
Ex.I have a selection set whit ten obj. The layer of this obj are "0" "1" and "2".
I want to obtain "0","1" and "2" and not the number of entity.
0 Likes
Message 4 of 4

Anonymous
Not applicable
I'm not sure I understand either but is this what you want?

'-------------------------------------------------------------------------------

Public Sub showLayers(selectionSet As AcadSelectionSet)
Dim entity As AcadEntity
Dim layerFound As Boolean
Dim i As Integer
Dim layerNames As New Collection

For Each entity In selectionSet
layerFound = False
For i = 1 To layerNames.Count
If entity.layer = layerNames(i) Then
layerFound = True
End If
Next i
If Not layerFound Then
layerNames.Add entity.layer
End If
Next entity

For i = 1 To layerNames.Count
Debug.Print layerNames(i)
Next i
End Sub

'-------------------------------------------------------------------------------

Public Sub testShowLayers()
Dim selectionSet As AcadSelectionSet

Set selectionSet = ThisDrawing.SelectionSets.Add("TEST")
selectionSet.SelectOnScreen

showLayers selectionSet
selectionSet.Delete
End Sub

'-------------------------------------------------------------------------------
0 Likes