vb和dwg的问题,help
欲读取dwg文件里的有关的文字信息?的地方是出问题的位置,这段代码不知如何写(vb6)
Dim acadapp As AcadApplication<BR>Dim acaddoc As AcadDocument<BR>Dim acadtxt As AcadText<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>acadapp.Documents.Open ("C:\1.dwg")<BR>Set acaddoc = acadapp.ActiveDocument<BR>'acaddoc.Open ("c:\1.dwg")<BR>acadapp.Visible = False<BR>Dim s As String<BR>Dim i As Integer
Dim moSpace As Object ?(就是要读出dwg中textstring的内容) <BR>Set moSpace = acaddoc.ModelSpace ?<BR> Dim ent As AcadEntity<BR> <BR> For Each ent In moSpace ?<BR> If ent.ObjectName = "acdbtext" Then ?<BR> Debug.Print acadtxt.TextString ?<BR> End If<BR> Next<BR>
<BR>
<BR>acaddoc.Close
页:
[1]