Jump to content

PromptSelectionResult not working correctly

Recommended Posts


hi guys

my app code in following. i want to find blockreference in between two points. when i zoom extent working correct. bu i change zoom in autocad result incorrect. i added screenshot. i use SelectCrossingWindow or SelectWindow finally same.



     Public Sub FindBlockInFrame(frame As Extents3d)

           Dim tvs As TypedValue() = New TypedValue() _
               New TypedValue(DxfCode.Start, "INSERT"),
               New TypedValue(DxfCode.BlockName, "myblock")

           Dim filter As New SelectionFilter(tvs)
           Dim selection As PromptSelectionResult = ed.SelectCrossingWindow(frame.MinPoint, frame.MaxPoint, filter)
           'Dim selection As PromptSelectionResult = ed.SelectWindow(frame.MinPoint, frame.MaxPoint, filter)

           If selection.Status <> PromptStatus.OK Then
           End If

           Using tr As Transaction = db.TransactionManager.StartTransaction()

               Dim list As New List(Of BlockReference)

               For Each id As ObjectId In selection.Value.GetObjectIds()

                   Dim block As BlockReference = DirectCast(tr.GetObject(id, OpenMode.ForRead), BlockReference)

               ed.WriteMessage(vbLf & "block count in frmae  {0})", list.Count)

           End Using
       End Sub



zoom extent:

Ekran Resmi 2017-09-09 12.20.05.jpg


zoom out:

Ekran Resmi 2017-09-09 12.21.00.jpg


zoom out,zoom out,zoom out:

Ekran Resmi 2017-09-09 12.21.54.jpg

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now