public static BHX.RectangularGeometry ToGBXMLGeometry(this BHE.Panel element, GBXMLSettings settings) { BHX.RectangularGeometry geom = new BHX.RectangularGeometry(); BHG.Polyline pLine = element.Polyline(); geom.Tilt = Math.Round(element.Tilt(settings.AngleTolerance), settings.RoundingSettings.GeometryTilt); geom.Azimuth = Math.Round(element.Azimuth(BHG.Vector.YAxis), settings.RoundingSettings.GeometryAzimuth); geom.Height = Math.Round(element.Height(), settings.RoundingSettings.GeometryHeight); geom.Width = Math.Round(element.Width(), settings.RoundingSettings.GeometryWidth); geom.CartesianPoint = pLine.ControlPoints.First().ToGBXML(settings); geom.ID = "geom-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); if (geom.Height == 0) { geom.Height = Math.Round(element.Area() / geom.Width, settings.RoundingSettings.GeometryHeight); } if (geom.Width == 0) { geom.Width = Math.Round(element.Area() / geom.Height, settings.RoundingSettings.GeometryWidth); } if (geom.Tilt == -1) { BH.Engine.Reflection.Compute.RecordWarning("Warning, panel " + element.BHoM_Guid + " has been calculated to have a tilt of -1."); } return(geom); }
public static BHX.RectangularGeometry ToGBXMLGeometry(this BHE.Panel element) { BHX.RectangularGeometry geom = new BHX.RectangularGeometry(); BHG.Polyline pLine = element.Polyline(); geom.Tilt = Math.Round(element.Tilt(), 3); geom.Azimuth = Math.Round(element.Azimuth(BHG.Vector.YAxis), 3); geom.Height = Math.Round(element.Height(), 3); geom.Width = Math.Round(element.Width(), 3); geom.CartesianPoint = pLine.ControlPoints.First().ToGBXML(); geom.ID = "geom-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); if (geom.Height == 0) { geom.Height = Math.Round(element.Area() / geom.Width, 3); } if (geom.Width == 0) { geom.Width = Math.Round(element.Area() / geom.Height, 3); } return(geom); }