Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi There,
i have a code that select/set closed polyline and once i extract coordinates i am trying to set selection set but i am getting nothing in line selectionSet.SelectByPolygon acSelectionSetWindowPolygon, pointsArray
i have not copied the entire code so some definitions maybe missing (please ignore)
Dim selectionSet As AcadSelectionSet ' Selection set to store the selected objects
Dim AktIDPt As Variant
'Dim MyDWG As AcadDocument
Dim AcadApp As Object
Dim AcadDoc As Object
Dim ThisDrawing As Object
On Error GoTo ErrorHandler
Set MyApp = GetObject(, "Autocad.Application")
ErrorHandler:
If Err.Description <> "" Then
Err.Clear
Set MyApp = CreateObject("Autocad.Application")
End If
MyApp.Visible = True
Set MyDWG = MyApp.ActiveDocument
Dim index As Integer
Dim ent As AcadEntity
Dim PL, Pl_Save As AcadLWPolyline
Dim points As Variant
MyDWG.Utility.GetEntity ent, pp, "Select Tile / Shpae must be polyline: "
If TypeOf ent Is AcadLWPolyline Then
If ent .closed = True Then
Set PL = ent
End If
Dim v As Variant
v = PL.Coordinates
Dim i As Integer
L = UBound(v)
index = 0
For i = 0 To UBound(v) Step 2
points(index) = v(i)
points(index + 1) = v(i + 1)
points(index + 2) = 0
index = index + 3
Next
points(index) = points(0)
points(index + 1) = points(1)
points(index + 2) = 0
savepoints = points
End If
Set selectionSet = MyDWG.SelectionSets.Add("MySelectionSet")
Dim mode As Integer
Dim pointsArray() As Double
mode = acSelectionSetWindowPolygon
pointsArray = points
selectionSet.SelectByPolygon acSelectionSetWindowPolygon, pointsArray
**Moderator edit: Moved code to code window. Please use the </> button to access the code window.
Solved! Go to Solution.