Is there an equivalent for the .path for the .NET API? I don't have COM installed 🙂 I'm looking for it a couple days now but can't find a way to do it.
Whoa -- no need for COM.
Document doc = Application.DocumentManager.MdiActiveDocument; string path = Path.GetDirectoryName(doc.Database.Filename);
What about the "DWGPREFIX" system variable, it's easy to check in both .NET and COM interop.
<CommandMethod("Test1")>
Public Sub Test1()
Dim path As string = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.Filename.ToString
If Right(path,3) <> "dwg" then
MsgBox("This file has not been saved")
Else
MsgBox("ThisDrawing = " & path)
End If
Dim NewPath As String = Left(path, Len(path)-3) & "dat"
MsgBox(NewPath)
End Sub
Imports Autodesk.AutoCAD.Interop Imports Autodesk.AutoCAD.Interop.Common Public Shared ReadOnly Property ThisDrg() As AcadDocument Get Return Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument End Get End Property Public Shared Function GetPath(ByVal ThisDrg As AcadDocument) As String Dim strPath As String = ThisDrg.FullName strPath = IO.Path.GetDirectoryName(strPath) Return strPath End Function
Can't find what you're looking for? Ask the community or share your knowledge.