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

0 Members and 1 Guest are viewing this topic.

MickD

  • Gator
  • Posts: 3499
  • (x-in)->[process]->(y-out)
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?
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

"First, solve the problem. Then, write the code." John Johnson

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 !!
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

MickD

  • Gator
  • Posts: 3499
  • (x-in)->[process]->(y-out)
Re: Strange anomoly (?)
« Reply #2 on: June 22, 2006, 02:19:12 AM »
A piccy of the anomoly -
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

"First, solve the problem. Then, write the code." John Johnson

Glenn R

  • Water Moccasin
  • Posts: 1932
  • What idiot child of married cousins wrote this?!
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.
Me

MickD

  • Gator
  • Posts: 3499
  • (x-in)->[process]->(y-out)
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.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

"First, solve the problem. Then, write the code." John Johnson

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 !
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--