Author Topic: Strange anomoly (?)  (Read 4049 times)

0 Members and 1 Guest are viewing this topic.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Strange anomoly (?)
« on: June 21, 2006, 11:36:59 PM »
Have a look at this simple function to display the current drawing filename with path,

Code: [Select]
[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?
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Strange anomoly (?)
« Reply #1 on: June 22, 2006, 12:34:44 AM »
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 !!
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Strange anomoly (?)
« Reply #2 on: June 22, 2006, 02:19:12 AM »
A piccy of the anomoly -
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Strange anomoly (?)
« Reply #3 on: June 22, 2006, 02:37:56 AM »
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.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Strange anomoly (?)
« Reply #4 on: June 22, 2006, 03:08:02 AM »
Thanks Glenn that makes perfect sense, will give it a shot now.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Strange anomoly (?)
« Reply #5 on: June 22, 2006, 03:57:12 AM »
Great !
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.