Can I get Model Scale in Page View using C# scripts, please see the attachment below.
I need to get this value and then dynamically change the size of the model I draw, is this possible because if I don’t dynamically change the size of the model, the model I draw will always be a fixed size, which is obviously incorrect, or does anyone know of any other way to accomplish this?
//GetScale
private void RunScript(Guid id, ref object A)
{
var dvo = RhinoDocument.Objects.Find(id);
if (dvo is Rhino.DocObjects.DetailViewObject)
{
DetailView dv = (DetailView) dvo.Geometry;
A = 1.0 / dv.PageToModelRatio;
}
}
//SetScale
private void RunScript(Guid id, ref object A)
{
var dvo = RhinoDocument.Objects.Find(id);
if (dvo is Rhino.DocObjects.DetailViewObject)
{
DetailView dv = (DetailView) dvo.Geometry;
dv.SetScale(1.0, UnitSystem.Millimeters, 1.0 / sc, UnitSystem.Millimeters);
dvo.CommitChanges();
}
}
DetailViewScale.gh (13.6 KB)
How do I listen to the Scale value in code, or is there any other way I can dynamically change the Scale value of a fixed graphic I’m drawing to fit the Model Scale value in the PageView that changes with the mouse wheel?