Rhinocommon: scale AND reposition a detail.viewport


#1
            var detail = pageview.AddDetailView("ModelView", top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top);
            if (detail != null)
            {
                pageview.SetActiveDetail(detail.Id);
                detail.DetailGeometry.SetScale(detail_scale, doc.ModelUnitSystem, 1, doc.PageUnitSystem);
                detail.DetailGeometry.IsProjectionLocked = true;
                detail.Viewport.SetCameraTarget(cpt, true);
                detail.CommitViewportChanges();

             //   detail.CommitChanges();
            }

When I use the snippet above, the detail view gets made and repositioned to cpt (which is a Point3d).
However, the scale does not get applied, when I uncomment the last line, the detail view gets set up properly with the correct scale, but is not repositioned.

This behavior is peculiar and does not seem correct. Is it a bug ?
Is there a workaround available ?

thx,
Sander


#2

This here seems to work:

detail.CommitChanges();
pageview.SetPageAsActive();
doc.Views.ActiveView = pageview;
doc.Views.Redraw();

pageview.SetActiveDetail(detail.Id);
detail.Viewport.SetCameraTarget(cpt, true);
detail.CommitViewportChanges();

Still, it feels like a bug to me.


(Dale Fugier) #3

Hi Sandy,

Can you provide the code to a full working command, so I can build here, along with any instructions I need to run it?

Thanks,

– Dale