public static BHX.Surface ToGBXML(this BHE.Panel element, List <List <BHE.Panel> > adjacentSpaces, List <BHE.Panel> space) { BHX.Surface surface = element.ToGBXML(); surface.SurfaceType = element.ToGBXMLType(adjacentSpaces); surface.ExposedToSun = Query.ExposedToSun(surface.SurfaceType).ToString().ToLower(); BHG.Polyline pLine = element.Polyline(); if (!pLine.NormalAwayFromSpace(space)) { pLine = pLine.Flip(); surface.PlanarGeometry.PolyLoop = pLine.ToGBXML(); surface.RectangularGeometry.Tilt = Math.Round(pLine.Tilt(), 3); surface.RectangularGeometry.Azimuth = Math.Round(pLine.Azimuth(BHG.Vector.YAxis), 3); } List <BHX.AdjacentSpaceId> adjIDs = new List <BHX.AdjacentSpaceId>(); foreach (List <BHE.Panel> sp in adjacentSpaces) { adjIDs.Add(sp.AdjacentSpaceID()); } surface.AdjacentSpaceID = adjIDs.ToArray(); return(surface); }