Have a look at this simple function to display the current drawing filename with path,
[CommandMethod("FILENAME")]
public static void TestFilename()
{
Editor ed =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Database db = HostApplicationServices.WorkingDatabase;
ed.WriteMessage("\nCurrent drawing is {0}:",db.Filename);
}
Works ok but leave your drawing for long enough for autosave to kick in and run it again.
On my machine it displays the name of the 'temp' save folder and drg name???
Is this normal behaviour? I ask as I want to use a file that is stored in the same folder as the current drg but if this can sometimes be the result it will not be good.
The only work around I can see is to save the file in code before getting its file name.
Any thoughts?