From 7919866060655891ce4193acd6ade175f4338134 Mon Sep 17 00:00:00 2001 From: Alessio Lombardi Date: Tue, 23 Feb 2021 13:50:48 +0000 Subject: [PATCH] Fix for Grasshopper to build. --- Rhinoceros_Engine/Convert/ToRhino.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Rhinoceros_Engine/Convert/ToRhino.cs b/Rhinoceros_Engine/Convert/ToRhino.cs index ca255a0..dec5452 100644 --- a/Rhinoceros_Engine/Convert/ToRhino.cs +++ b/Rhinoceros_Engine/Convert/ToRhino.cs @@ -443,7 +443,7 @@ public static RHG.Brep ToRhino(this List surfaces) /***************************************************/ - public static RHG.GeometryBase ToRhino(this BHG.Extrusion extrusion) + public static Rhino.Geometry.Surface ToRhino(this BHG.Extrusion extrusion) { if (!extrusion.Curve.IIsPlanar()) { @@ -493,7 +493,13 @@ public static RHG.GeometryBase ToRhino(this BHG.Extrusion extrusion) .PerformSweep(rail, planarCurve) .Aggregate((b1, b2) => { b1.Join(b2, tolerance, true); return b1; }); - return joinedSweep; + if (joinedSweep.IsSurface) + return joinedSweep.Surfaces[0]; + + BH.Engine.Reflection.Compute.RecordError("Could not convert this BHoM Extrusion to a Rhino Surface. The extrusion direction is not perpendicular to the base curve, and the base curve is too complex for a Sweep to return a valid Surface."); + + + return null; }