Public Function S..._vbnet cad.n">
当前位置:   article > 正文

VBnet CAD二次开发 指定方式选择筛选指定对象_vbnet cad.net 选择

vbnet cad.net 选择

  1. Dim typeValue As TypedValue() = New TypedValue(0) {}
  2. typeValue.SetValue(New TypedValue(0, "Dimension"), 0)
  3. Dim sSet As SelectionSet = SelectSsGet("SelectAll", Nothing, typeValue)
  1. <Extension()>
  2. Public Function SelectSsGet(ByVal selectStr As String, ByVal point3dCollection As Point3dCollection, ByVal typedValue As TypedValue()) As SelectionSet
  3. Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
  4. ''将过滤条件赋值给SelectionFilter对象
  5. Dim selfilter As SelectionFilter = Nothing
  6. If typedValue IsNot Nothing Then
  7. selfilter = New SelectionFilter(typedValue)
  8. End If
  9. ''请求在图形区域选择对象
  10. Dim psr As PromptSelectionResult
  11. If selectStr = "GetSelection" Then ''提示用户从图形文件中选取对象
  12. psr = ed.GetSelection(selfilter)
  13. ElseIf selectStr = "SelectAll" Then ''选择当前空间内所有未锁定及未冻结的对象
  14. psr = ed.SelectAll(selfilter)
  15. ElseIf selectStr = "SelectCrossingPolygon" Then ''选择由给定点定义的多边形内的所有对象以及与多边形相交的对象。多边形可以是任意形状,但不能与自己交叉或接触。
  16. psr = ed.SelectCrossingPolygon(point3dCollection, selfilter)
  17. ElseIf selectStr = "SelectFence" Then ''选择与选择围栏相交的所有对象。围栏选择与多边形选择类似,所不同的是围栏不是封闭的, 围栏同样不能与自己相交
  18. psr = ed.SelectFence(point3dCollection, selfilter)
  19. ElseIf selectStr = "SelectWindowPolygon" Then ''选择完全框入由点定义的多边形内的对象。多边形可以是任意形状,但不能与自己交叉或接触
  20. psr = ed.SelectWindowPolygon(point3dCollection, selfilter)
  21. ElseIf selectStr = "SelectCrossingWindow" Then ''选择由两个点定义的窗口内的对象以及与窗口相交的对象
  22. Dim point1 As Point3d = point3dCollection(0)
  23. Dim point2 As Point3d = point3dCollection(1)
  24. psr = ed.SelectCrossingWindow(point1, point2, selfilter)
  25. ElseIf selectStr = "SelectWindow" Then ''选择完全框入由两个点定义的矩形内的所有对象。
  26. Dim point1 As Point3d = point3dCollection(0)
  27. Dim point2 As Point3d = point3dCollection(1)
  28. psr = ed.SelectCrossingWindow(point1, point2, selfilter)
  29. Else
  30. Return Nothing
  31. End If
  32. ''如果提示状态OK,表示对象已选
  33. If psr.Status = PromptStatus.OK Then
  34. Dim sSet As SelectionSet = psr.Value
  35. ed.WriteMessage("Number of objects selected: " & sSet.Count.ToString() & vbLf)
  36. Return sSet
  37. Else
  38. ed.WriteMessage("Number of objects selected 0 " & vbLf) ''打印选择对象数量
  39. Return Nothing
  40. End If
  41. End Function

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/111812
推荐阅读
相关标签
  

闽ICP备14008679号