Document.Name
Database.OriginalFileName
<CommandMethod("GetFileName")> _
Sub GetFileName()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
ed.WriteMessage(doc.Name & vbCrLf)
ed.WriteMessage(db.OriginalFileName)
End Sub
Application.GetSystemVariable("DWGPREFIX")
or another way
make sure you Import System.IO
Change previos Post to
<CommandMethod("GetFileName")> _
Sub GetFileName()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
ed.WriteMessage(Path.GetDirectoryName(doc.Name) & vbCrLf)
ed.WriteMessage(Path.GetDirectoryName(db.OriginalFileName))
End Sub
<CommandMethod("GetFileName")> _
Sub GetFileName()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
ed.WriteMessage(Path.GetDirectoryName(doc.Name) & vbCrLf)
ed.WriteMessage(Path.GetDirectoryName(db.OriginalFileName) & vbCrLf)
Dim fpath As String = Path.GetDirectoryName(doc.Name)
While fpath <> Nothing
ed.WriteMessage(fpath & vbCrLf)
fpath = Path.GetDirectoryName(fpath)
End While
fpath = doc.Name
Dim levels As Integer = ed.GetInteger("Enter number of levels you want" & vbCrLf).Value
For i As Integer = 0 To levels
fpath = Path.GetDirectoryName(fpath)
If fpath = Nothing Then
Exit For
End If
Next
ed.WriteMessage(fpath & vbCrLf)
End Sub
https://forums.autodesk.com/t5/net/current-drawi ... p/3008548?profile.language=en