Public Function S..._vbnet cad.n">
赞
踩
- Dim typeValue As TypedValue() = New TypedValue(0) {}
- typeValue.SetValue(New TypedValue(0, "Dimension"), 0)
- Dim sSet As SelectionSet = SelectSsGet("SelectAll", Nothing, typeValue)
- <Extension()>
- Public Function SelectSsGet(ByVal selectStr As String, ByVal point3dCollection As Point3dCollection, ByVal typedValue As TypedValue()) As SelectionSet
- Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
- ''将过滤条件赋值给SelectionFilter对象
- Dim selfilter As SelectionFilter = Nothing
-
- If typedValue IsNot Nothing Then
- selfilter = New SelectionFilter(typedValue)
- End If
- ''请求在图形区域选择对象
- Dim psr As PromptSelectionResult
-
- If selectStr = "GetSelection" Then ''提示用户从图形文件中选取对象
- psr = ed.GetSelection(selfilter)
- ElseIf selectStr = "SelectAll" Then ''选择当前空间内所有未锁定及未冻结的对象
- psr = ed.SelectAll(selfilter)
- ElseIf selectStr = "SelectCrossingPolygon" Then ''选择由给定点定义的多边形内的所有对象以及与多边形相交的对象。多边形可以是任意形状,但不能与自己交叉或接触。
- psr = ed.SelectCrossingPolygon(point3dCollection, selfilter)
- ElseIf selectStr = "SelectFence" Then ''选择与选择围栏相交的所有对象。围栏选择与多边形选择类似,所不同的是围栏不是封闭的, 围栏同样不能与自己相交
- psr = ed.SelectFence(point3dCollection, selfilter)
- ElseIf selectStr = "SelectWindowPolygon" Then ''选择完全框入由点定义的多边形内的对象。多边形可以是任意形状,但不能与自己交叉或接触
- psr = ed.SelectWindowPolygon(point3dCollection, selfilter)
- ElseIf selectStr = "SelectCrossingWindow" Then ''选择由两个点定义的窗口内的对象以及与窗口相交的对象
- Dim point1 As Point3d = point3dCollection(0)
- Dim point2 As Point3d = point3dCollection(1)
- psr = ed.SelectCrossingWindow(point1, point2, selfilter)
- ElseIf selectStr = "SelectWindow" Then ''选择完全框入由两个点定义的矩形内的所有对象。
- Dim point1 As Point3d = point3dCollection(0)
- Dim point2 As Point3d = point3dCollection(1)
- psr = ed.SelectCrossingWindow(point1, point2, selfilter)
- Else
- Return Nothing
- End If
- ''如果提示状态OK,表示对象已选
- If psr.Status = PromptStatus.OK Then
- Dim sSet As SelectionSet = psr.Value
- ed.WriteMessage("Number of objects selected: " & sSet.Count.ToString() & vbLf)
- Return sSet
- Else
- ed.WriteMessage("Number of objects selected 0 " & vbLf) ''打印选择对象数量
- Return Nothing
- End If
- End Function
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。