欲读取dwg文件里的有关的文字信息
?的地方是出问题的位置,这段代码不知如何写(vb6)
Dim acadapp As AcadApplication Dim acaddoc As AcadDocument Dim acadtxt As AcadText '初始化CAD 'On Error Resume Next Set acadapp = GetObject(, "AutoCAD.application.16") If Err Then Err.Clear Set acadapp = CreateObject("autocad.application.16") If Err Then MsgBox Err.Description Exit Sub End If End If
acadapp.Documents.Open ("C:\1.dwg") Set acaddoc = acadapp.ActiveDocument 'acaddoc.Open ("c:\1.dwg") acadapp.Visible = False Dim s As String Dim i As Integer
Dim moSpace As Object ?(就是要读出dwg中textstring的内容) Set moSpace = acaddoc.ModelSpace ? Dim ent As AcadEntity
For Each ent In moSpace ? If ent.ObjectName = "acdbtext" Then ? Debug.Print acadtxt.TextString ? End If Next