From e1b1b714bd927da0e64a7e30e4d188a7f34b006b Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Mon, 16 Jan 2023 18:59:16 +0100 Subject: [PATCH] fix(rh/gh): scale intervals in BoxToNative conversion --- .../ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs index e129c2c91f..c5dca09f71 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs @@ -117,9 +117,11 @@ public Interval IntervalToSpeckle(RH.Interval interval) return speckleInterval; } - public RH.Interval IntervalToNative(Interval interval) + public RH.Interval IntervalToNative(Interval interval, string units = Units.None) { - return new RH.Interval((double)interval.start, (double)interval.end); + return new RH.Interval( + ScaleToNative((double)interval.start, units), + ScaleToNative((double)interval.end, units)); } // Interval2d @@ -619,7 +621,7 @@ public Box BoxToSpeckle(RH.Box box, string units = null) public RH.Box BoxToNative(Box box) { - return new RH.Box(PlaneToNative(box.basePlane), IntervalToNative(box.xSize), IntervalToNative(box.ySize), IntervalToNative(box.zSize)); + return new RH.Box(PlaneToNative(box.basePlane), IntervalToNative(box.xSize, box.units), IntervalToNative(box.ySize, box.units), IntervalToNative(box.zSize, box.units)); } // Meshes