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: 

BackGroundWorker.DoWork with Revit API

1 REPLY 1
Reply
Message 1 of 2
talbimam
861 Views, 1 Reply

BackGroundWorker.DoWork with Revit API

i'm trying to make a progress bar to a relatively long process (that needs a nested loop) when i use the same code without the Revit API (simulation) the whole systeme work fine and the progress is reported but when i include the real code (Revit API with transaction and other API methods) the code compile without any errors but it did not works (the UI button don't run the bunch of code inside the DoWork method) and all the code is worthless.

please if anyone can give a hint, thanks

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: talbimam

I assume you are aware that the Revit API is single threaded and requires a valid Revit API context?

 

Such a context is only provided within the event handlers for the events provided by the Revit API.

 

https://thebuildingcoder.typepad.com/blog/2015/08/revit-api-context-and-form-creation-errors.html#2

 

Many of the articles on driving Revit from outside explain various aspects of this:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

 

That said, solutions for displaying a progress bar in parallel with Revit API processing have been presented here in the past; just search this forum for 'progress bar' and you will find them.

   



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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report