How to synchronize all views?


#1

Hi all,

I’ve re-set coordinates of construction plane, then update all viewports by Redraw(), but only active viewport changed, 3 viewports did not change. Here is my code:

Rhino.ApplicationSettings.ModelAidSettings.UniversalConstructionPlaneMode = true;
var cplane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();
Vector3d delta = new Vector3d(cplane.Origin);
cplane.Translate(-delta);
doc.Views.ActiveView.ActiveViewport.SetConstructionPlane(cplane);
ConstructionPlane constructionPlane = new ConstructionPlane();
constructionPlane.Plane = cplane;
doc.Views.ActiveView.ActiveViewport.PushConstructionPlane(constructionPlane);
doc.Views.ActiveView.MainViewport.SetConstructionPlane(cplane);
doc.Views.Redraw();

So, how to synchronize all views by code?

Help me please!
Thank you!


#2

Haizzz,

I’ve just found the way to solve this problem:
List all views then update each of them :smile:
Here is my code:

Rhino.ApplicationSettings.ModelAidSettings.UniversalConstructionPlaneMode = true;
Rhino.ApplicationSettings.ViewSettings.LinkedViewports = true;
var rhViewList = doc.Views.GetViewList(true, false);
foreach (var view in rhViewList)
{
var cplane = view.ActiveViewport.ConstructionPlane();
Vector3d delta = new Vector3d(cplane.Origin);
cplane.Translate(-delta);
view.ActiveViewport.SetConstructionPlane(cplane);
}
doc.Views.Redraw();