- 积分
- 761
- 明经币
- 个
- 注册时间
- 2009-12-24
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2014-7-28 09:49:22
|
显示全部楼层
同样的命令用acedCmd实现
Private Declare Auto Function acedCmd Lib "acad.exe" _
(ByVal vlist As System.IntPtr) As Integer
<CommandMethod("FF3")> Public Sub FF3()
Dim acDocEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
'' 创建一个 TypedValue 数组,用于定义过滤条件 Create a TypedValue array to define the filter criteria
Dim acTypValAr(0) As TypedValue
acTypValAr.SetValue(New TypedValue(DxfCode.Start, "LINE"), 0)
'' 赋值过滤条件给 SelectionFilter 对象 Assign the filter criteria to a SelectionFilter object
Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
'' 要求在图形区域中选择对象 Request for objects to be selected in the drawing area
Dim acSSPrompt As PromptSelectionResult
acSSPrompt = acDocEd.SelectAll(acSelFtr)
' 如果提示状态是 OK,对象就被选择了 If the prompt status is OK,n objects were selected
If acSSPrompt.Status = PromptStatus.OK Then
Dim acSSet As SelectionSet = acSSPrompt.Value
Dim rb As ResultBuffer = New ResultBuffer
rb.Add(New TypedValue(5005, "_PEDIT"))
rb.Add(New TypedValue(5005, "_M"))
rb.Add(New TypedValue(5007, acSSet))
rb.Add(New TypedValue(5005, ""))
rb.Add(New TypedValue(5005, "_Y"))
rb.Add(New TypedValue(5005, "_J"))
rb.Add(New TypedValue(5001, 0))
rb.Add(New TypedValue(5005, ""))
acedCmd(rb.UnmanagedObject)
Else
Application.ShowAlertDialog("Number of objects selected: 0")
End If
End Sub |
|