如何用vb快速查找到dwg里的已知名称的块blockreference
如何用vb快速查找到(或提取)dwg里的已知名称的块blockreference 同一个主题不要分开发!下面是一段测试
Private Sub Form_Load()<BR>On Error Resume Next<BR>Dim oApp As Object<BR>Dim oDoc As Object<BR>Set oApp = GetObject(, "AutoCad.Application")<BR>Set oDoc = oApp.ActiveDocument<BR>Dim ss As Object<BR>oDoc.SelectionSets("Test").Delete<BR>Set ss = oDoc.SelectionSets.Add("Test")<BR>Dim ft(1) As Integer, fd(1)<BR>ft(0) = 0: fd(0) = "Insert"<BR>ft(1) = 2: fd(1) = "1"<BR>ss.Select 5, ft, fd<BR>MsgBox ss.Count<BR>End Sub<BR> 已知块名为fa或fb或fc,如何选择 ft(0) = 0: fd(0) = "Insert"<BR>ft(1) = 2: fd(1) = "fa,fb,fc"<BR> Dim acadapp As AcadApplication<BR>Dim acaddoc As AcadDocument<BR>'初始化CAD<BR>'On Error Resume Next<BR>Set acadapp = GetObject(, "autocad.application.16")<BR>If Err Then<BR> Err.Clear<BR> Set acadapp = CreateObject("autocad.application.16")<BR> If Err Then<BR> MsgBox Err.Description<BR> Exit Sub<BR> End If<BR>End If<BR>Dim filepath As String<BR>filepath = "D:\Syq901\c0101-02.dwg"<BR> acadapp.Documents.Open (filepath)<BR> Set acaddoc = acadapp.ActiveDocument<BR> acadapp.Visible = False<BR> <BR> Dim ss As AcadSelectionSet<BR> MsgBox (acaddoc.SelectionSets.Count)<BR>'acaddoc.SelectionSets("test").Delete ---此处报错??????<BR>Set ss = acaddoc.SelectionSets.Add("Test")<BR>Dim ft(1) As Integer, fd(1)<BR>ft(0) = 0: fd(0) = "insert"<BR>'ft(1) = 2: fd(1) = "fa,fb,fc"<BR>ss.Select acSelectionSetAll, ft, fd<BR>MsgBox ss.Count
结果还是ss.Count还是3000多,和没定义时一样多,选择了所有的,怎么回事? 如果可以的话,贴一个样图上来看看 换了一个文件,换了块名就可以了,这是为什么?我是cad2004查属性得到的块名。还是感谢班组的辛劳,十分感谢!!!
页:
[1]