选择集
1、根据图块名过滤
Dim tksTV(0) As DatabaseServices.TypedValue tksTV.SetValue(New DatabaseServices.TypedValue(DatabaseServices.DxfCode.BlockName, tkNames), 0) Dim tksFilter As New EditorInput.SelectionFilter(tksTV) Dim tksPSR As Autodesk.AutoCAD.EditorInput.PromptSelectionResult tksPSR = doc.Editor.GetSelection(tksFilter)
2、选择图块
Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim pso As PromptSelectionOptions = New PromptSelectionOptions() With pso .RejectObjectsOnLockedLayers = True .AllowSubSelections = False .MessageForAdding = "选择图块" .MessageForRemoval = "选择图块" End With Dim filList() As TypedValue = {New TypedValue(0, "Insert")} Dim filter As New SelectionFilter(filList) Dim psr As PromptSelectionResult = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(pso, filter) If Not psr.Status = PromptStatus.OK Then doc.Editor.WriteMessage(vbLf & "命令:") Exit Sub End If