Hi,
I’ve created a new Layout and Detail via Code.
Now I’m trying to zoom into a special object at the scale (1:5)
The Object should be centered and the the view scale should be set.
I’ve had a look at http://wiki.mcneel.com/developer/rhinocommonsamples/addlayout
Here is my code.
//Add Detail
DetailViewObject detail = pageView.AddDetailView(“MyDetail”, new Point2d(20, 20), new Point2d(1000, 800), Rhino.Display.DefinedViewportProjection.Top);
RhinoApp.WriteLine(objectIds[0].ToString()); if (detail != null) { pageView.SetActiveDetail(detail.Id);
doc.Objects.UnselectAll(); //Select an Object doc.Objects.Select(objectIds[0]);
detail.Viewport.ZoomExtentsSelected();
detail.DetailGeometry.SetScale(5, doc.ModelUnitSystem, 1, doc.PageUnitSystem);
// Commit changes tells the document to replace the document's detail object // with the modified one that we just adjusted detail.CommitChanges();
}
pageView.SetPageAsActive();
I replaced the
detail.Viewport.ZoomExtents();
and deleted the line:
detail.DetailGeometry.IsProjectionLocked = true;
My Code doesn’t work though - and I can’t find a working solution. So I was wondering if anyone could help me with finding a solution.
Thanks
Martin