Hello guys.
I'm interested in two questions.
1) What events I can use to detect when the user rotates/zooms/moves the current view in the current DGN document?
2) How can I get the parameters of the camera (position, angle) when this event was handled?
Hi,
Dart Vader said:What events I can use to detect when the user rotates/zooms/moves the current view in the current DGN document?
I am not sure whether specific event for "a view parameter changed" exists in API, but I recommend to check ViewCallback class. It allows to monitor different view events. In your case, I guess pre or post update event can be used.
Dart Vader said:How can I get the parameters of the camera (position, angle) when this event was handled?
If I understand the documentation right, ViewContext is passed to monitoring function. Using this object, you can retrieve more information about view, viewport, frustrum etc.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Šlegr said:I am not sure whether specific event for "a view parameter changed" exists in API, but I recommend to check ViewCallback class. It allows to monitor different view events. In your case, I guess pre or post update event can be used.
Hm. In the documentation, there is some interface IViewUpdateEventsHandler. And you implement it in some object and register this object by AddViewUpdateEventsHandler method. And you can listen to an AfterRedraw method. But it's available only for a VBA. Is there some same interface/method for C++?
Dart Vader said:Is there some same interface/method for C++?
Did you check ViewCallback class? I allows exactly this.
In MicroStation SDK examples, I see several of them use this class.
Dart Vader said:In the documentation, there is some interface IViewUpdateEventsHandler
You tagged this post with C++, but now you're referring to VBA. Keep in mind that 99% of VBA is a wrapper around the C++ MicroStationAPI. The VBA API is aimed at helping programmers who are not familiar with the nuances of high-level languages such as C# and C++. You need to de-nuance a VBA object name to find its equivalent in the MicroStationAPI. In this case, Jan has de-nuanced the API for you. Familiarise yourself with the MicroStationAPI documentation (delivered with the MicroStation SDK).
Regards, Jon Summers LA Solutions
Hi Dart Vader ,
Dart Vader said:1) What events I can use to detect when the user rotates/zooms/moves the current view in the current DGN document?
Take a look at the ViewTool example, lines:
C:\Program Files\Bentley\MicroStation2023SDK\examples>s "view*update*" *.cpp View\viewtool\viewtool-remap.cpp:267:Private int viewtool_viewUpdate View\viewtool\viewtool-remap.cpp:791: ViewCallback::SetUpdatePostFunction (viewtool_viewUpdate); View\viewtool\viewtool-remap.cpp:847: ViewCallback::SetUpdatePostFunction (viewtool_viewUpdate); View\viewtool\viewtool.cpp:232:static int viewtool_viewUpdate View\viewtool\viewtool.cpp:742: ViewCallback::SetUpdatePostFunction (viewtool_viewUpdate); View\viewtool\viewtool.cpp:797: ViewCallback::SetUpdatePostFunction (viewtool_viewUpdate);
Dart Vader said:2) How can I get the parameters of the camera (position, angle) when this event was handled?
Take a look at the ViewInfoExample, lines:
C:\Program Files\Bentley\MicroStation2023SDK\examples\View\ViewInfoExample>scs "ViewInfoCR CameraInfo" *.cpp ViewInfoExample.cpp:34:static WString viewinfo_getStandardViewInfo (ViewInfoCR viewInfo) ViewInfoExample.cpp:52:static WString viewinfo_getViewGeomInfo (ViewInfoCR viewInfo) ViewInfoExample.cpp:130: ViewInfoCR viewInfo = activeViewGroup->GetViewInfoR (viewInfoExampleData.viewNo); ViewInfoExample.cpp:149: CameraInfo cInfo = viewInfo.GetCamera();
HTH,Bob