Document.Title with or without .rvt extension

Document.Title with or without .rvt extension

Anonymous
Not applicable
1,817 Views
3 Replies
Message 1 of 4

Document.Title with or without .rvt extension

Anonymous
Not applicable

Hi all,

 

I would like to report the weird behaviour of Document.Title, specifically:

 

var activeDocTitle = commandData.Application.ActiveUIDocument.Document.Title;

 

Depending on your Windows Files and Folder settings, this will return:

  • "revit_document_name.rvt" - if File name extensions is turned on or;
  • "revit_document_name" - if File name extensions is off

Now, this may not look like like much of an issue, but in our code we had a little neat line that was something like:

var documentName = Path.GetFileNameWithoutExtension(activeDocTitle);

which was OK, until... someone had a document named "revit.document.name". Since we, as software engineers, like our files WITH their extensions and our users don't, this behaviour kinda wreck havoc around the office, until we pinpointed what is going on 🙂

 

The issue was manifested on Windows 10 machines using Revit 2016 and 2016 API as well on 2017.

 

It would be nice to make the Title property consistent regardless of Windows settings or at least document this behaviour in API docs.

 

Best regards,

Uros

 

Accepted solutions (1)
1,818 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Uros,

 

Thank you for your report.

 

Sorry to hear about this.

 

I logged the issue REVIT-115348 [Document.Title with or without .rvt extension -- 13071541] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

The workaround is simple, of course, if you may assume that Revit always forces the extension RVT.

 

In that case, any other extension removed by GetFileNameWithoutExtension is something added by the user.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

Anonymous
Not applicable

Dear Jeremy,

 

Thank you for the prompt response.

 

Besides a bit of confusion, and a couple of hours delay, this was not a big of an issue for our team.

 

Nevertheless, I think that this kind of inconsistent behavior can cause many other apps to fail or misbehave, and should be addressed as soon as possible.

Or at least the API docs should be updated with a remark.

 

The workaround for us was quite simple indeed.

We just check if the Document.Title ends with an ".rvt" extension (case insensitive of course), and if so, Path.GetFileNameWithoutExtension is applied.

 

Best regards,

Uros 

0 Likes
Message 4 of 4

Dale.Bartlett
Collaborator
Collaborator

I had a similar manifestation of this issue. A user had set their Revit User Name as FirstName.LastName. So the local file ends up named <CentralFileName>_ FirstName.LastName.rvt. With extensions turned off, and trying to open the local file by correctly selecting it in the Revit File Open Dialog, Revit responds that .LastName is not a valid Revit file. Turning on extensions in Windows fixed the problem. Dale




______________
Yes, I'm Satoshi.
0 Likes