Revit Addin Window + Selection

Revit Addin Window + Selection

Anonymous
Not applicable
377 Views
1 Reply
Message 1 of 2

Revit Addin Window + Selection

Anonymous
Not applicable

Dears,

 

Is it possible for a Revit Addin to show a panel/window to the user so that the user can select elements from Revit model then return to the Addin for further processing on the selected elements (then re-selecting another elements and so-on) ?

 

I thought of opening a WPF window from execute method. However, I got an error about "Starting a transaction from an external application running outside of API context is not allowed". I believe the reason is that the window will run on different thread than Revit API. However, if I made the window running on same thread, the user will not be able to interact with Revit to select the elements !!

 

What do you think a proper solution here ?

 

Thanks

0 Likes
378 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Ah250,

 

You are right, calls for a different thread ar not supported or allowed:

 

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

 

There are ways to work around this, using the Idling or much better still an external event.

 

You question reminds me of this old example of a selection watcher:

 

http://thebuildingcoder.typepad.com/blog/2010/09/selection-watcher-using-idling-event.html

 

That is a passive report, though, not active selection.

 

Cheers,

 

Jeremy



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

0 Likes