Closed pearswj closed 3 years ago
Hi @pearswj, thanks for reporting this.
Quick question: how are the tolerance values defined in scriptcontext.doc
, when running inside Rhino? Does it inherit the values from ActiveDoc
, or has its own standard tolerance values?
I am asking because I would like to retain the possibility of affecting tolerances in Wasp by changing the doc tolerance values. So I am wondering if it would make more sense to still use ActiveDoc
, and switch to scriptcontext.doc
only when ActiveDoc
is null.
Good question! I didn't explain that well at all. Here's what happens when you call scriptcontext.doc.ModelAbsoluteTolerance
...
const double _defaultModelAbsoluteTolerance = RhinoMath.DefaultDistanceToleranceMillimeters; // 0.01
...
if (RhinoApp.IsRunningHeadless && RhinoDoc.ActiveDoc == null)
return _defaultModelAbsoluteTolerance;
return RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
Allright, thanks for explaining that. And thanks again for the suggestion. I will include this in the next Wasp release.
Hey @ar0551, I ran into this one recently while experimenting with installing Wasp on a machine running Rhino Compute.
ActiveDoc
will be null when Rhino is running in "headless" mode (as it does when running in Rhino Compute). To workaround this you can usescriptcontext.doc
which defines default values for tolerances and units when no active document exists.