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: 

ViewActivated on Sheets

5 REPLIES 5
Reply
Message 1 of 6
atiefenbach
523 Views, 5 Replies

ViewActivated on Sheets

I'm trying to trigger a function when the user activates a view.  I've successfully done this by using the ViewActiaved event.  However, if the user has a sheet as the active view and they acitvate a view on the sheet the ViewActivated event is not trigger.  I know the ProgessChanged event is fired during this activating of the view, but I don't want to slow the system down by checking all of those events.

 

If there another option?

Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
5 REPLIES 5
Message 2 of 6
R.van.den.Bor
in reply to: atiefenbach

What about the speed when you hook in the ProgressChanged event, but filter if the active view is a drawing sheet ?
Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 3 of 6

Dear atiefenbach,

Thank you for your query.

Did Remy's suggestion help?

Here is another one from Joe Ye:

I am thinking if we can use the Idling event. For example, when the active view is non-sheet view, and the document’s  previous active view is the non-sheet view’s host sheet (judge by the Sheet Number property value). In this case it may be activated from the sheet view if the view change cannot be captured the ViewActivated event.

As an extension of both Remy's and Joe's suggestions, you might be able to reduce the overload and system performance degradation caused by the Idling or some other all-too-frequent event notification by defining your own external event yourself and trigger that in a timer at less frequent intervals.

I demonstrated that approach in the discussion on replacing an Idling event handler by an external event for my real-time round-trip cloud-based simplified 2D BIM editing RoomEditorApp subscription to real-time database changes:

http://thebuildingcoder.typepad.com/blog/2013/12/replacing-an-idling-event-handler-by-an-external-ev...

I hope that helps.

Best regards,



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

Message 4 of 6
atiefenbach
in reply to: jeremytammik

Thanks for all your great responses!  I'm definitely going to bookmark Jeremy's blog post because I'm sure there will be a day I want something similar.  Although I think all of those are viable solutions I don't think I want to spend too much time trying to make it work, right now, because it's not a neccessary function to office productivity.  I'm afraid my small amount of API knowledge might cause too much grief if I code some sort of idling event incorrectly.

 

I was looking for a simple solution, like the ViewActivated event, to work in this instance.  Is it possible, to add this to the API wishlist, though, so that future realeases will have the ViewActivated event fire in these instances.  I mean, I am activating a view afterall.

 

Thanks!

Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
Message 5 of 6
arnostlobel
in reply to: atiefenbach

Hello Atiefenbach,

 

in fact, you are not activating a view 🙂 What you do is activating a viewport on a sheet. That is different from activating a view in a Revit document, which basically means that a different view in a MDI environment gets a focus. Also, please note that activating a sheet's viewport has no effect on ActiveView property of that document.

 

That being said, I agree that a request for adding new viewport related  events should be added on the wish-list for future releases.

 

In the meantime, I think using the ProgressChanged event would be the best approach, assuming raising the event in this situation is dependable and you can make it work for you.

 

Arnošt Löbel

Autodesk, Revit R&D

Arnošt Löbel
Message 6 of 6
tamas.deri
in reply to: arnostlobel

Unfortunately you are wrong. The ActiveView will be the one in the viewport instead of the sheet.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community