.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help with PromptSelectionResult Problem

1 REPLY 1
SOLVED
Reply
Message 1 of 2
tdunn_3
699 Views, 1 Reply

Need help with PromptSelectionResult Problem

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)
                    PtCol.Add(poly.GetPoint3dAt(j))
                    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)

                    wpt.Add(wpt7)
                    wpt.Add(wpt8)
                    wpt.Add(wpt9)
                    wpt.Add(wpt10)






                    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
                            idcol.Add(ptid)
                        Next

                        Do Until idcol.Count = 0


                            counter = 0
                            For Each ptid In idcol
                                oPoint = DirectCast((acTrans.GetObject(ptid, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)).AcadObject, AeccPoint)

                                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
                            PtCol.Add(Pt3d)
                            idcol.Remove(smID)

                        Loop


                   


                    End If

 

1 REPLY 1
Message 2 of 2
Alexander.Rivilis
in reply to: tdunn_3

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

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost