2 Replies Latest reply on Nov 4, 2014 11:03 PM by Ron Bates

    Detect end of view manipulation/update

    Ron Bates

      Is there a way to detect when view manipulation has ended?  Like the final repaint of a view?

       

      I'm already using viewChangeNotify to detect updates to the view that are going on.  But there doesn't seem to be a way to know if we've just processed a "final" update?

       

      My intended workaround was to use the mouse event handlers.  Like DMouseEvents_MouseMBtnUpNotifyEventHandler.  But I seem to be getting inconsistent results...they don't always fire..???  Meanwhile, they wouldn't be ideal b/c there are non-mouse ways to update the view (keyboard, space mouse, etc).

        • Re: Detect end of view manipulation/update
          Andrew Lemaitre

          Hi Mr. Bates,

           

          I do not have an answer for you, but might have some ideas that can help. I am also interested in knowing if this is possible without workarounds.

           

          The following page seems highly relevant, I think it contains all the view notifications.

           

          2015 SolidWorks API Help - swViewNotify_e Enumeration

           

          Why is it so important to know if they've stopped modifying the view?

           

          Maybe you could have a separate thread that constantly checks the difference between the current time and the time of the last view notification. You could have a variable that keeps track of the last time a view notification was received. If the current time minus the last view notification time is greater than some defined period of time, then you can assume the user is finished changing the view.

           

          One possible issue I can see with this is that the user might rotate/pan/zoom the view, but not let go of the mouse button. The program would then assume they've stopped 'updating' the view, but they've actually just paused the rotation/pan/zoom and are still holding down the button. If the state of the mouse buttons can be ascertained though, then this set of conditions could be avoided by checking if any of the mouse buttons are down.

           

          Another issue is that they may stop changing the view, but quickly start changing the view again. If the defined period of time between the current time and last notification is too great, then it would miss the momentary period where the user stopped updating the view.

           

          Enjoy,

          Andrew

            • Re: Detect end of view manipulation/update
              Ron Bates

              Yeah I still don't think any of the view notifications provide any way of determining if the update is a "final" update.  The postRender notifiy sounds good, but it still fires after each render...which is after every single frame.

               

              But your idea may work...  I'm going to give it a try and I'll post back on how it goes.  The reason I need this is that I'm doing some of my own rendering in the bufferswap event.  And once the view modifications are complete, I need to do 1 FINAL, but slightly different render.