Message 1 of 10
Selection Set in VB.Net
Not applicable
06-13-2005
04:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I trie to create as Selection set in VB.Net, if I do not use any filters it functions well, but when I trie to use the filter option I get an Error.
This is the code:
Friend Function SelectionSet_Create(ByVal Name As String, ByVal Point3dList() As Point3d, ByVal ObjectName As String) As AcadSelectionSet
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Dim SSObj As AcadSelectionSet
Dim SSmode As Autodesk.AutoCAD.Interop.Common.AcSelect
Dim PointsArray As Array = PointlistToArray(Point3dList)
Try
acadApp = CType(GetObject(, AutoCadApplicatie), AcadApplication)
acadApp.Visible = True
acadDoc = acadApp.ActiveDocument
acadDoc.Application.Visible = True
SSObj = acadDoc.SelectionSets.Add(Name)
SSmode = Autodesk.AutoCAD.Interop.Common.AcSelect.acSelectionSetCrossingPolygon
If ObjectName "*" Then
Dim FilterType(0) As Integer : FilterType(0) = 2
Dim FilterData(0) As String : FilterData(0) = ObjectName
SSObj.SelectByPolygon(SSmode, PointsArray, FilterType, FilterData)
Else
SSObj.SelectByPolygon(SSmode, PointsArray)
End If
SSObj.Highlight(True)
Autodesk.AutoCAD.ApplicationServices.CommandLinePrompts.Message(vbCrLf & SSObj.Count & " Objects selected" + vbCrLf)
Catch ex As Exception
MessageBox.Show(ex.ToString)
Return Nothing
End Try
End Function
And this is the error I get is attached.
What is going wrong ?
Harold van Aarsen
The Netherlands
This is the code:
Friend Function SelectionSet_Create(ByVal Name As String, ByVal Point3dList() As Point3d, ByVal ObjectName As String) As AcadSelectionSet
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Dim SSObj As AcadSelectionSet
Dim SSmode As Autodesk.AutoCAD.Interop.Common.AcSelect
Dim PointsArray As Array = PointlistToArray(Point3dList)
Try
acadApp = CType(GetObject(, AutoCadApplicatie), AcadApplication)
acadApp.Visible = True
acadDoc = acadApp.ActiveDocument
acadDoc.Application.Visible = True
SSObj = acadDoc.SelectionSets.Add(Name)
SSmode = Autodesk.AutoCAD.Interop.Common.AcSelect.acSelectionSetCrossingPolygon
If ObjectName "*" Then
Dim FilterType(0) As Integer : FilterType(0) = 2
Dim FilterData(0) As String : FilterData(0) = ObjectName
SSObj.SelectByPolygon(SSmode, PointsArray, FilterType, FilterData)
Else
SSObj.SelectByPolygon(SSmode, PointsArray)
End If
SSObj.Highlight(True)
Autodesk.AutoCAD.ApplicationServices.CommandLinePrompts.Message(vbCrLf & SSObj.Count & " Objects selected" + vbCrLf)
Catch ex As Exception
MessageBox.Show(ex.ToString)
Return Nothing
End Try
End Function
And this is the error I get is attached.
What is going wrong ?
Harold van Aarsen
The Netherlands