Jump to content

PromptSelectionResult not working correctly


Recommended Posts

Posted

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
               Return
           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)
                   list.Add(block)
               Next

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

               tr.Commit()
           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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...