Changing a Document when Selection Changed

Changing a Document when Selection Changed

atir5UTNF
Advocate Advocate
286 Views
2 Replies
Message 1 of 3

Changing a Document when Selection Changed

atir5UTNF
Advocate
Advocate

Revit don't let streching a rebar if the first rebar is not visible.

I would like to fix this behavior by changing the presentation mode to All when a rebar is selected, and set it back to as it was when unselected.

The API doc says it is "forbidden to make modifications to the current document" in the SelectionChanged Event Handlers.

 

Any idea how to solve this?

 

 

0 Likes
287 Views
2 Replies
Replies (2)
Message 2 of 3

longt61
Advocate
Advocate

My wildest guess is that you can create an ExternalEventHandler to change the display of rebar, then try to raise that event during SelectionChangedEvent. The ExternalEvent will run right after the SelectionChangedEvent.

However, I feel like this is not the proper approach since it might create more problems than what it can solve, if and only if the solution works. Showing rebar and make it viewed unobscured, and solid like can be a costly regeneration operation because it involves the view settings, not just rebar settings, especially when you have a large or complex BIM model. Besides, determine when and which rebar to restore to original state automatically can be quite a challenge, because you know which rebar is selected, but you don't know which rebar is RECENTLY UNSELECTED. Thus, the ExternalEvent may be executed multiple time unnecessarily.

I would recommend you to create 2 separated, simple addin command to show all rebar and to restore rebar state. That is way simpler and you or user can assign short cut to it to work more efficiently.

0 Likes
Message 3 of 3

atir5UTNF
Advocate
Advocate

That's pretty much what I have done.

Shortcut to command that show all rebars.

 

0 Likes