Message 1 of 3
How to select all entities of a layer?

Not applicable
10-08-2012
09:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to select all entites of a layer?
I want to migrate my VB code to VB.NET code, can anyone help me to migrate the below code?
Private Function GetEntities(oLayerCollection As Collection, sSelectionSetName As String, _ Optional pointsList As Variant = Empty, _ Optional mode As AcSelect = acSelectionSetCrossingPolygon) As AcadSelectionSet Dim oSS As AcadSelectionSet Dim Point1(0 To 2) As Double, point2(0 To 2) As Double Dim gpCode(0 To 0) As Integer Dim dataValue(0 To 0) As Variant Dim groupCode As Variant, dataCode As Variant Dim vLayer As Variant Dim oCurrentDocument As AcadDocument ' dummy points Point1(0) = 0: Point1(1) = 0: Point1(2) = 0 point2(0) = 0: point2(1) = 0: point2(2) = 0 Set oCurrentDocument = m_oApplication.ActiveDocument On Error Resume Next Set oSS = oCurrentDocument.SelectionSets.Add(sSelectionSetName) On Error GoTo 0 Set oSS = oCurrentDocument.SelectionSets(sSelectionSetName) Call oSS.Clear gpCode(0) = 8 For Each vLayer In oLayerCollection If dataValue(0) = "" Then dataValue(0) = vLayer Else dataValue(0) = dataValue(0) & "," & vLayer End If Next vLayer groupCode = gpCode dataCode = dataValue If VarType(pointsList) = vbEmpty Then Call oSS.Select(acSelectionSetAll, Point1, point2, groupCode, dataCode) Else Call oSS.SelectByPolygon(mode, pointsList, groupCode, dataCode) End If Set GetEntities = oSS End Function
Layer collection will contains the various layer name