Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Opening Linked Model Hosted On BIM360

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
1010 Views, 6 Replies

Opening Linked Model Hosted On BIM360

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

Labels (3)
6 REPLIES 6
Message 2 of 7
jeremytammik
in reply to: Anonymous

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?

 



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

Message 3 of 7
Anonymous
in reply to: jeremytammik

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.

BrandonSchafer_0-1596140537975.png

 

Thanks,

Brandon

 

Message 4 of 7
jeremytammik
in reply to: Anonymous

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

 



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

Message 5 of 7
Anonymous
in reply to: jeremytammik

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.

 

BrandonSchafer_0-1596461784332.png

 

Message 6 of 7
Revitalizer
in reply to: Anonymous

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 7 of 7
Anonymous
in reply to: 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.

Post to forums  

Rail Community


Autodesk Design & Make Report