- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi forum
First of all, I want to clarify Im aware of the plenty of posts here and in Jeremy´s blog similar to this topic. I have tried everything that I have readed and I come here just to see if there´s something Im missing before giving up completely and accept that this cant be done in my concrete case. Also I got the feeling that the problem may not be the tipical Out of API context thing.
What Im trying to do is the following:
1. Open a form1 modeless dialog (show some info about the model).
2. Open a form2 modal dialog.
3. Change the Revit document at this point (get views from other document).
4. Close form2.
5. See form1 with the changes applied.
My first try was with IExternalEvents. I managed to make this work except for step 5. My last approach has been with the library https://github.com/KennanChan/Revit.Async wich make the work done the same way that external events. In step 3 im capturing the RevitServices.application in a Shared static class, so I can use it later in the method app.OpenDocumentfile(). While im not convinced about this workflow, it is in fact working in that part so Im convinced that thats not the problem here.
I have simplified the code to make a reproducible case for this topic. I think that the best and fastest way to show it to you is attaching the .sln ready to run instead of pasting the code which is a little too large. Running the .sln and debugging will do:
1. Open the form1 normally showing the info
2. Click button and open form2.
3. Click button in form2 and make changes to the document (ie. event is raised and finished correctly).
4. Close form2 .
5. Show form1 but changes are not applied despite of coding " updateForm1() or this.Refresh();
If the problem were that IExternalEvent cant be triggered on time, then it would be ok. I mean, I have read all Jeremy´s post and its clear that you cant exactly control the execution time for this actions. But what bothers me its that the ExternalEvent seems to finish properly. In fact the changes in the model are done. But its the updating of form1 what doesnt take consideration of this changes and thats why I ask here.
Help appeciated. Thanks. Regards.
PD: Im using Revit 2019.
Solved! Go to Solution.