.NET

.NET

Member
Posts: 5
Registered: ‎05-31-2012
Message 1 of 2 (244 Views)

Need help with PromptSelectionResult Problem

244 Views, 1 Replies
02-07-2013 09:34 AM

I am trying to select points within 3 feet of a polyline segment, sort the points, add them to a point collection, and then move on to the next segment. The problem I am having is in the selection set works for the first segment and then after I loop through for the next segment it is not picking up on the points in the selection window.

```   Application.AcadApplication.ZoomExtents()

For j As Integer = 0 To nVertex - 2
PtBeg = poly.GetPoint2dAt(j)
PtEnd = poly.GetPoint2dAt(j + 1)
ovdist = PtBeg.GetDistanceTo(PtEnd)
cdist = Math.Sqrt(9 + (ovdist * ovdist))
FindCircleCircleIntersections(PtBeg.X, PtBeg.Y, 3, PtEnd.X, PtEnd.Y, cdist, wpt3, wpt4)
FindCircleCircleIntersections(PtEnd.X, PtEnd.Y, 3, PtBeg.X, PtBeg.Y, cdist, wpt5, wpt6)
wpt7 = New Point3d(wpt3.X, wpt3.Y, 0)
wpt8 = New Point3d(wpt4.X, wpt4.Y, 0)
wpt9 = New Point3d(wpt5.X, wpt5.Y, 0)
wpt10 = New Point3d(wpt6.X, wpt6.Y, 0)

ptres = acDoc.Editor.SelectWindowPolygon(wpt, ptfilter)
If ptres.Status = PromptStatus.OK Then
Dim ptSS As Autodesk.AutoCAD.EditorInput.SelectionSet = ptres.Value
Dim points As ObjectId() = ptSS.GetObjectIds()

For Each ptid In points
Next

Do Until idcol.Count = 0

counter = 0
For Each ptid In idcol

If counter = 0 Then
smID = ptid
Pt1 = New Point2d(oPoint.Easting, oPoint.Northing)
odist = Pt1.GetDistanceTo(PtBeg)
Pt3d = New Point3d(Pt1.X, Pt1.Y, 0)
If odist = 0 Or odist = ovdist Then
idcol.Remove(smID)
End If
Else
Pt2 = New Point2d(oPoint.Easting, oPoint.Northing)
dist = Pt2.GetDistanceTo(PtBeg)
If dist < odist And Not dist = 0 And Not dist = ovdist Then
smID = ptid
Pt1 = Pt2
Pt3d = New Point3d(Pt1.X, Pt1.Y, 0)
odist = dist
End If
If dist = 0 Or dist = ovdist Then
idcol.Remove(smID)
End If
End If
counter += 1
Next
idcol.Remove(smID)

Loop

End If```

Moderator
Posts: 1,323
Registered: ‎04-09-2008
Message 2 of 2 (234 Views)

Re: Need help with PromptSelectionResult Problem

02-07-2013 10:23 AM in reply to: tdunn_3

I do not see that you cleaned wpt variable in the loop.

Пожалуйста не забывайте про Утвердить в качестве решения и Баллы
Please remember to Accept as Solution and Kudos

Recently Solved