/***************************************************/ public static BHG.IGeometry FromRhino(this RHG.Extrusion extrusion) { if (extrusion == null) { return(null); } RHG.LineCurve line = extrusion.PathLineCurve(); BHG.Vector extrVec = BH.Engine.Geometry.Create.Vector(line.PointAtStart.FromRhino(), line.PointAtEnd.FromRhino()); List <BHG.Extrusion> extrs = new List <BHG.Extrusion>(); // Exploits the fact that GetWireframe returns first the "profile" curves of the extrusion. var profileCurves = extrusion.GetWireframe(); for (int i = 0; i < extrusion.ProfileCount; i++) { var profileConverted = profileCurves.ElementAt(i).FromRhino(); BHG.Extrusion extr = BH.Engine.Geometry.Create.Extrusion(profileConverted, extrVec, extrusion.IsCappedAtBottom && extrusion.IsCappedAtTop); extrs.Add(extr); } if (extrs.Count == 1) { return(extrs[0]); } if (extrs.Count > 1) { return new BH.oM.Geometry.CompositeGeometry() { Elements = extrs.OfType <BH.oM.Geometry.IGeometry>().ToList() } } ; BH.Engine.Reflection.Compute.RecordError("Could not convert the extrusion."); return(null); }