diff --git a/Grasshopper_Engine/Compute/RenderMeshes.cs b/Grasshopper_Engine/Compute/RenderMeshes.cs index 7ef33499..5a51db57 100644 --- a/Grasshopper_Engine/Compute/RenderMeshes.cs +++ b/Grasshopper_Engine/Compute/RenderMeshes.cs @@ -160,7 +160,11 @@ public static void RenderMeshes(BHG.Loft surface, Rhino.Display.DisplayPipeline public static void RenderMeshes(BHG.NurbsSurface surface, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material) { - pipeline.DrawBrepShaded(RHG.Brep.CreateFromSurface(surface.ToRhino()), material); + RHG.GeometryBase geometry = surface.ToRhino(); + if (geometry is RHG.Surface) + geometry = RHG.Brep.CreateFromSurface((RHG.Surface)geometry); + + pipeline.DrawBrepShaded((RHG.Brep)geometry, material); } /***************************************************/ diff --git a/Grasshopper_Engine/Compute/RenderWires.cs b/Grasshopper_Engine/Compute/RenderWires.cs index 75daa936..0f0c0d9b 100644 --- a/Grasshopper_Engine/Compute/RenderWires.cs +++ b/Grasshopper_Engine/Compute/RenderWires.cs @@ -156,8 +156,11 @@ public static void RenderWires(BHG.Loft surface, Rhino.Display.DisplayPipeline p public static void RenderWires(BHG.NurbsSurface surface, Rhino.Display.DisplayPipeline pipeline, Color bhColour) { - RHG.Surface rSurface = surface.ToRhino(); - pipeline.DrawSurface(rSurface, bhColour, 2); + RHG.GeometryBase geometry = surface.ToRhino(); + if (geometry is RHG.Surface) + geometry = RHG.Brep.CreateFromSurface((RHG.Surface)geometry); + + pipeline.DrawBrepWires((RHG.Brep)geometry, bhColour, 2); } /***************************************************/ diff --git a/Grasshopper_Engine/Convert/FromGoo.cs b/Grasshopper_Engine/Convert/FromGoo.cs index b5d7099d..66cdb5e3 100644 --- a/Grasshopper_Engine/Convert/FromGoo.cs +++ b/Grasshopper_Engine/Convert/FromGoo.cs @@ -75,7 +75,8 @@ public static T FromGoo(this GH_Surface goo, IGH_TypeHint hint = null) Brep brep = goo.ScriptVariable() as Brep; if (brep.IsSurface) return (T)(brep.Faces[0].UnderlyingSurface() as dynamic); - return default(T); + else + return (T)(brep as dynamic); } } }