Hi y'all!
Let's say that the user has a Revit Document open in my Application, but he/she has named it incorrectly (or better said, not accordingly to our internal naming convention).
Now, I'm creating a plugin that generates the correct name and path from some user inputs (through a UI) and I want to change the name of the Document on the fly, to the generated name.
I tried with this:
string generatedName = GenerateName();
uiApp.ActiveUIDocument.Document.Title = generatedName;
but then I found out that the property Title doesn't have a get accessor, hence I can't do the above.
What would be the best way to achieve this?
Thanks!
Solved! Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
Do you mean set accessor?
The title is associated with the file name, isn't it?
Maybe you have to close the model, rename the file, and reopen the model from the newly named file.
Yeah sorry I meant set accessor!
And yes, the title is pretty much the file name without the .rvt extension.
On closing an renaming the file: I guess I wouldn't be able to do it probrammatically from a Revit button / IExternalEvent (triggered by a Dockable Panel), would I?
In the UI if I wanted to rename a file I wouldn't close it and rename it I'd SaveAs and delete the old one...
Document.SaveAS
You should also consider if you are working with the central file or the local file?
I like Richard's suggestion better.
However, you can close the active document if you really want to:
https://thebuildingcoder.typepad.com/blog/2012/12/closing-the-active-document.html
Yeah I thought of the SaveAs option too. I guess it's the best option.
Thanks guys!
Can't find what you're looking for? Ask the community or share your knowledge.