The DgnPlatformNet ViewPort class documentation includes this note: To update the view, see IViewManager::UpdateView or IViewManager::UpdateViewDynamic.
But IViewManager is part of the C++ MicroStationAPI, not part of DgnPlatformNet. There isn't a documented ViewManager for .NET.
Unknown said: There is a DgnDisplayNET wrapper API
Thanks! I've referenced Bentley.DgnDisplayNet.dll...
However, the compiler tells me error CS0234: The type or namespace name 'DgnDisplayNET' does not exist in the namespace 'Bentley' (are you missing an assembly reference?)
P.S. Why doesn't ViewPort have an Update() method?
Regards, Jon Summers LA Solutions
Unknown said:The native DgnViewport class does not have an Update() function - why would you expect the managed equivalent to have one?
It's not a matter of expectation but hope. Isn't updating a view rather fundamental to the way MicroStation works?
I might criticise the MicroStationAPI for the same reason. If a ViewPort controls a View, why can't it tell it to Update?
Unknown said:Isn't updating a view rather fundamental to the way MicroStation works?
No, when was the last time you had to click on the Update View icon while drawing? The views are automatically healed to reflect changes to persistent elements. Forcing full view updates means making the user wait until the update completes before they can do anything; full updates are to be avoided when possible.
-B
Unknown said: Maybe you should describe why you feel you need to update the viewport
I'm attempting to focus a view on a particular element. Here's where I'm setting the view origin & extent...
viewInfo.SetGeometry(elementCentre, elementDelta, rotation); viewGroup.SetViewInformation(viewInfo, nView); viewGroup.SaveChanges(); viewGroup.SynchViewDisplay(nView, false, true, false);
When I run the code I see no change in the view. If I update the view manually, I see the view focus on the element. My assumption is that I need to update the view after SynchViewDisplay().
Unknown said:No, when was the last time you had to click on the Update View icon while drawing?
I'm not drawing. I've changed view parameters and want to see the new display, which appears not to happen automatically.
David Larson
Unknown said:Would sending a keyin do as a workaround for now?
Thanks! However, I'm exercising the DgnPlatformNet as far as possible. I prefer to find what that API can do without resorting to queuing key-ins. After all, if we use only key-ins, we might as well record a VBA macro and forget the path to .NET enlightenment 8-)
Hi Jon,
I believe you may be able to achieve an update for the desired view (group) doing something like the pseudo-code below:
USE: Bentley.DgnPlatformNET.ViewGroupStatus MakeActive(Bentley.DgnPlatformNET.ViewGroup newActive, bool deferInitialUpdate)
HTH,Bob
Answer Verified By: Jon Summers
I thought that ViewGroup.SynchViewDisplay() would be the solution: Tells the host to synchronize the displayed view with the state stored in this ViewGroup. While that appears to set the view params (if you manually update the view) it doesn't redraw the view.
Unknown said:I believe you may be able to achieve an update for the desired view doing something like the pseudo-code below
Thanks for the hint! It set me on a path of exploration which arrived at a reasonable result. I'll write it up and publish in the next day or two.
Unknown said:dgnfile.GetViewGroups ().MakeActive (grp, false)
It's a bit flishy-flashy! There's a visible glitch as we switch ViewGroup. Also, the user loses the Previous history option when right-clicking in the view.
I wrote an article DgnPlatformNet: Focus on an Element that describes an ElementLocator class. It includes a work-around for the absence of IViewManager::UpdateView in the DgnPlatformNet. It's not perfect: I would prefer simply to redraw a view without the work-around.