I have two plugins—one for Rhino 5 the other for Rhino 6—which use similar code. But when acting on the same file each yields different results for PageToModelRatio. Given detail is an instance of Rhino.DocObjects.DetailViewObject:
double ratio = detail.DetailGeometry.PageToModelRatio
In Rhino 5 ratio will be 0.17891563008952949. In Rhino 6, for the the same detail view from the same file ratio will be 0.031881150585873874.
Is there a difference between the two environments or some property that I need to ensure is set in order to get the same value in both versions?
An update: while trying to recreate this in a file that I could share (i.e. without any company specific information) I noticed that this problem does not occur if I run the same code against v5_teacup.3dm from the openNURBS examples. So this does seem to be something peculiar about the specific file(s) that I’m dealing with. I am still working on getting a file that reproduces the error that it’d be okay to share.
For additional context our plugin adds one or more traditional drawings as a tab in the Rhino file, and it and the various points of view (top, left, right, etc) are the detail view objects where we’re observing PageToModelRatio
import Rhino
import scriptcontext as sc
page_view = sc.doc.Views.ActiveView
if page_view and isinstance(page_view, Rhino.Display.RhinoPageView):
details = page_view.GetDetailViews()
if details:
for detail in details:
name = detail.Name
if not name: name = "<none>"
ratio = detail.DetailGeometry.PageToModelRatio
print "Name: " + name + ", Ratio: " + str(ratio)
Produces the same out put in Rhino 5 and 6 when run against your test file.