TheSwamp
Code Red => .NET => Topic started by: MickD on June 21, 2006, 11:36:59 PM
-
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?
-
Mick,
Can you email to me a complete Project/solution on this with comments.
If I can duplicate it, I'll pass it on through the ADN system.
... looks like a weird one for sure !!
-
A piccy of the anomoly -
-
Mick,
Your database file name has changed but the DOCUMENT that's associated to the database hasn't.
A database does not necessarily have to have the same name as the document - you can have a database that's not associated with a document at all - remember ReadDwgFile?
Use either the file name property off the document or DWGPREFIX, DWGNAME and DWGTITLED sysvars.
-
Thanks Glenn that makes perfect sense, will give it a shot now.
-
Great !