ursan 发表于 2022-7-6 21:49:37

PromptSelectionResult不起作用

嗨,伙计们
我的应用程序代码如下。我想在两点之间找到blockreference。当我缩放范围时,工作正常。bu i更改autocad中的缩放结果不正确。我添加了截图。我使用SelectCrossingWindow或SelectWindow。
 
 
   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
 
 
缩放范围:

 
缩小:

 
缩小,缩小,缩小:
页: [1]
查看完整版本: PromptSelectionResult不起作用