• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Member
    Posts: 5
    Registered: ‎05-31-2012
    Accepted Solution

    Need help with PromptSelectionResult Problem

    94 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)
                        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

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,167
    Registered: ‎04-09-2008

    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.


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

    Please use plain text.