Skip to content

Commit

Permalink
Merge pull request #2072 from specklesystems/rhino-gh/fix-box-tonative
Browse files Browse the repository at this point in the history
fix(rh/gh): scale intervals in BoxToNative conversion
  • Loading branch information
teocomi authored Jan 17, 2023
2 parents 084fd3c + e1b1b71 commit 7703075
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7703075

Please sign in to comment.