With CONNECT SDK v10.13, I've adjusted a view's geometry like this using the DgnPlatformNet API...
viewInfo.SetGeometry(origin, elementDelta, rotation); viewGroup.SetViewInformation(viewInfo, nView); viewGroup.SynchViewDisplay (nView, false, true, false);
That appears to work OK. However, I have manually to redraw the view to see the change. That is, I have to click the paintbrush icon in the UI to redraw the view.
What should I do programmatically to refresh a view after ViewGroup.SynchViewDisplay?
ViewGroup.SynchViewDisplay
Here's one way, calling the VBA interface …
/// <summary> /// Update the specified view using an InterOp calling the VBA interface. /// </summary> /// <param name="nView"> Zero-based view index.</param> private void UpdateViewUsingInterOp (int nView) { Bentley.Interop.MicroStationDGN.Application app = Utilities.ComApp; DesignFile dgnFile = app.ActiveDesignFile; Bentley.Interop.MicroStationDGN.Views views = dgnFile.Views; // VBA views are 1-based View view = views[1 + nView]; if (null != view) view.Redraw();
But why can't I do the same with .NET?
Hi Jon,
Are you calling viewGroup.SaveChanges() at some point and does that help synch things up further? I don't see any product or example C# code calling SynchViewDisplay.
Bob
Robert Hook said:Are you calling viewGroup.SaveChanges() at some point
I've tried calling that, but it makes no difference that I can see.
Regards, Jon Summers LA Solutions
The C++ API provides: IViewManager::GetActiveViewSet().UpdateView
The VBA/COM Refresh code eventually calls mdlView_updateMulti.
I will see if I can find a better managed equivalent.
Robert Hook said:The C++ API provides: IViewManager::GetActiveViewSet().UpdateView
Well, yes, but in this app. I'm test-driving the .NET API, by navigating to some unsignposted areas. I want to do a little more than just kick the tyres.
Robert Hook said:The VBA/COM Refresh code eventually calls mdlView_updateMulti
Good to know!
FYI. I see a DgnPlatformNET.ViewPort.SetNeedsRefresh(), though I did not look at the code behind (yet).
Robert Hook said:I see a DgnPlatformNET.ViewPort.SetNeedsRefresh()
That looked hopeful, but doesn't cause an immediate view refresh. Nor does it prevent one — but I must still perform a manual view update.
I will see if I can review the code behind the view refresh for a (missing/unknown) C# call/event to trigger the view update vs a C++/C call or key-in. If not, I will return back with an enhancement request for the missing.
Thank you,Bob
Thanks Robert, I have been using the keyin "Update all" and "Update [ViewNumber]" since I have also not been able to find a solution. Would be great to have a DgnPlatformNet way of doing it.
I have been using P/Invoke to the C API. It's much faster than the keyins.
[DllImport("ustation.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int mdlView_updateSingle(int viewNumber);