用vb6.0,2004cad lib库;
Dim acadapp As AcadApplication Dim acaddoc As AcadDocument
Set acadapp = GetObject(, "AutoCAD.application.16")
acadapp.Documents.Open (filepath) '打开dwg文件 Set acaddoc = acadapp.ActiveDocument acadapp.Visible = False
For ind = 0 To acaddoc.ModelSpace.Count - 1'循环读取
Set ent = acaddoc.ModelSpace.Item(ind) If ent.ObjectName = "AcDbBlockReference" Then
Set blockRefObj = ent
If UCase(blockRefObj.Name) = "TBZ10" or UCase(blockRefObj.Name) = "TBF00" And blockRefObj.HasAttributes = True Then '取内容,略过
end if
next
此遍历的方式太慢(要查询所有的object),如何能直接查询到块TBZ10(或它的blockreference),使速度加快。一个200k的dwg要一分多钟