Select all entities in a particular layer?
Moderators: SDS, support, admin
Select all entities in a particular layer?
I would like to be able to identify all entities in a layer once any entity in that layer is selected.
I've tried:
Any ideas? Thanks very much!
I've tried:
Code: Select all
Dim Selected As SortedList = CADImage.SelectedEntities
Dim tmpKey As String
Dim Line As CADImport.CADEntity
For Each tmpKey In Selected.Keys
Line = Selected(tmpKey)
'For i As Integer = 0 To Line.Layer.Entities.AllValues.Length - 1
'Dim cadent As CADEntity = Line.Layer.Entities(i)
'cadent.Selected = True
'Next
'the above For generated an exception because Line.Layer.Entities was nothing.
Next
If Line Is Nothing Then Exit Sub
CADImage.AddEntityToSelectCollection(Line.Layer)
CADImage.DoSelectEntity(Line.Layer)
DWT.CAD.InvalidateImage()
CADImage.InvalidateSelectedEntities(CADPict.CreateGraphics)
Hello!
Please try the following code (it selects all entities on the layer "0"):
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Please try the following code (it selects all entities on the layer "0"):
Code: Select all
<font color="blue">Private Sub</font id="blue"> btnSelectEntByLayer_Click(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.EventArgs) Handles btnSelectEntByLayer.Click
<font color="blue">Dim</font id="blue"> ent <font color="blue">As</font id="blue"> CADEntity
<font color="blue">Dim</font id="blue"> Cn, I <font color="blue">As Integer
If Me</font id="blue">.cadImage <font color="blue">Is Nothing Then
Return
End If</font id="blue">
Cn = <font color="blue">Me</font id="blue">.cadImage.Converter.Entities.Count
<font color="blue">For</font id="blue"> I = 0 <font color="blue">To</font id="blue"> Cn - 1
ent = <font color="blue">Me</font id="blue">.cadImage.Converter.Entities(I)
<font color="blue">If</font id="blue"> (<font color="blue">Not</font id="blue"> ent.Layer <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then
If</font id="blue"> (ent.Layer.Name = "0") <font color="blue">Then
Me</font id="blue">.cadImage.DoSelectEntity(ent)
<font color="blue">End If
End If
Next
Me</font id="blue">.cadImage.ClearBuffer()
<font color="blue">Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">End Sub</font id="blue">
Please post questions to the forum or write to support@cadsofttools.com