I got something similar working from C# - synchronizes all currently opened 3d views and also works with other view types (plans, elevations, sections etc.). If syncing 3d views it only "pans" and "zooms", but doesn't rotate yet. Also syncing 2d views with 3d works well, but not the other way around yet. Also doesn't handle sheets yet (not sure how it would work, perhaps only if a view was activated).
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Collections.Generic;
using System.Linq;
namespace scripts
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class SynchronizeSelectedViews : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
Document doc = commandData.Application.ActiveUIDocument.Document;
UIDocument uidoc = commandData.Application.ActiveUIDocument;
View activeView = doc.ActiveView;
UIView activeuiView = uidoc?.GetOpenUIViews()?.FirstOrDefault(item => item.ViewId == uidoc.ActiveView.Id);
// Get the corners of the current UIView
IList<XYZ> corners = activeuiView.GetZoomCorners();
XYZ topLeft = corners[0];
XYZ bottomRight = corners[1];
// Loop through all other open UI views and move them to the same position
foreach (UIView otherUIView in commandData.Application.ActiveUIDocument.GetOpenUIViews())
{
if (otherUIView.ViewId != activeView.Id)
{
if (!(doc.GetElement(otherUIView.ViewId) is ViewSheet))
{
otherUIView.ZoomAndCenterRectangle(topLeft, bottomRight);
}
}
}
return Result.Succeeded;
}
}
}