Hi,
I'm using the method OpenDocumentFile(ModelPath, OpenOptions, CloudCallback) to open a linked model from a master file, perform an update to the model, and then sync/close the model. I've gotten everything to work well except the "Opening Model" dialog stays active and locks the Revit UI from being accessible.
I was curious if this is a known issue, or if I'm doing something wrong.
Another note is that I'm doing this through Dynamo and Python so I've had to translate C# to Python to get this to work.
One final note: This was behaving correctly when I was just working on local servers and using the method OpenDocumentFile(String).
Thanks,
Brandon
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
It should work post-Revit-2020:
https://thebuildingcoder.typepad.com/blog/2019/04/whats-new-in-the-revit-2020-api.html#4.2.6.2
What version are you working with?
Hi Jeremy,
I'm using Revit 2020 for my test project because of the new GetCloudModelPath method. Everything does technically work all the way through making my updates, syncing with central, and closing the document. The only thing I'm running into is the Open Model dialog doesn't close and it keeps the Revit UI locked. I can even work with Dynamo after it finishes the run and close out of it.
After I close this Revit instance everything works as intended. I opened up the linked model to check that the modifications were pushed to the cloud and everything is there. I just don't think my team is going to like the hard close of Revit each time this has to be ran. The image below shows the Dynamo graph running and the linked model finishing it process then syncing, but the other dialog is still present.
Thanks,
Brandon
Can you close the dialogue manually? If so, how? What do you click, or what do you do?
Can you explore the dialogue using Spy++?
https://docs.microsoft.com/en-us/visualstudio/debugger/introducing-spy-increment
I believe that will enable closing it as well.
If either of these two methods work, you can probably adapt my dialogue clicker to close it as well:
https://github.com/jeremytammik/JtClicker
Thanks Jeremy!
This led me down the right rabbit hole. Python has a helper library "ctypes" that handles the common windows dlls. From there and with a little research to see how to handle window operations with the user32 dll I was able to adapt your JtClicker program for this dialog with no user input.
I find the window with the window caption similar to your program then I send a WM_CLOSE message to that window. So far this has worked every time, but I've wrapped it in a try-except block just in case the window isn't found for whatever reason.
Hi,
window will not be found if Revit's language is not English.
You may check Application.Language or ControlledApplication.Language and replace "Open Model" with a proper text.
Revitalizer
Hi Rudolf,
That's a great point indeed. Thanks for the heads up. Fortunately for this use case it'll be used only on English computers so I shouldn't have to worry about localization.
Thanks,
Brandon
Can't find what you're looking for? Ask the community or share your knowledge.