您好
感谢BillZndl和gile的回复。
我使用了两个建议。gile的代码工作正常,但是当我运行BillZndl时,我得到了如下错误:
这是我的代码:
- Imports Autodesk.AutoCAD.Runtime
- Imports Autodesk.AutoCAD.ApplicationServices
- Imports Autodesk.AutoCAD.DatabaseServices
- Imports Autodesk.AutoCAD.EditorInput
- Imports Autodesk.AutoCAD.Geometry
- Imports System.IO
- Public Class Class1
- _
- Public Sub DrawingPath()
- Dim doc As Document = Application.DocumentManager.MdiActiveDocument
- Dim h_app As HostApplicationServices = HostApplicationServices.Current
- Dim title As Integer = Convert.ToInt32(doc.GetSystemVariable("DWGTITLED"))
- If title > 0 Then
- Dim path As String = h_app.FindFile(doc.Name, doc.Database, FindFileHint.[Default])
- Dim info As New FileInfo(path)
- Dim size As Long = info.Length
- doc.Editor.WriteMessage(vbLf & "Path: " & path)
- doc.EditorWriteMessage(vbLf & "FileSize: " & size)
- Else
- doc.Editor.WriteMessage(vbLf & "File not found")
- End If
- End Sub
- End Class
|