Hello everyone and thank you in advance for the help
I am currently trying to duplicate layout pages and copying all objects.
I am having a slight issue when duplicating the detail views. It seems that I managed to reproduce the same detail view but the locking is not passing.
I am starting from a layout page with a locked detail view (debugging with Visual Studio it shows as locked) but when setting the IsProjectionLocked in the new detailView it does not work.
Here is my code that copy the properties from the old detail view to the new one.
//Setting the new layout active
layoutCopy.SetPageAsActive();
//Setting the new detail view active
layoutCopy.SetActiveDetail(objectGuid);
//Get the right projection view and set it
if (Enum.TryParse(detailView.Viewport.Name, true, out DefinedViewportProjection viewportProjection)) {
detailViewCopy.Viewport.SetProjection(viewportProjection, string.Empty, false);
detailViewCopy.CommitViewportChanges();
}
//Set the same display mode
detailViewCopy.Viewport.DisplayMode = detailView.Viewport.DisplayMode;
//Set the same scale
detailViewCopy.DetailGeometry.SetScale(1, rhDoc.ModelUnitSystem, detailView.DetailGeometry.PageToModelRatio, rhDoc.ModelUnitSystem);
//Set the same Camera target
detailViewCopy.Viewport.SetCameraTarget(detailView.Viewport.CameraTarget, true);
//Set the lock (NOT WORKING)
detailViewCopy.DetailGeometry.IsProjectionLocked = detailView.DetailGeometry.IsProjectionLocked;
//Commiting changes
detailViewCopy.CommitChanges();
detailViewCopy.CommitViewportChanges();
layoutCopy.SetPageAsActive();