public static Furnishing ToDIALux(this Opening opening, Panel hostPanel) { Furnishing furnishing = new Furnishing(); furnishing.Type = opening.Type.ToDIALux(); furnishing.Reference = ""; furnishing.RotationX = 0; furnishing.RotationY = 0; furnishing.RotationZ = 0; Point centre = opening.Polyline().Centroid(); centre.Z -= (opening.Polyline().Height() / 2); double bottomHost = hostPanel.Polyline().ControlPoints.Select(x => x.Z).Min(); centre.Z -= bottomHost; furnishing.Position = centre; furnishing.Height = Math.Round(opening.Polyline().Height(), 3); furnishing.Width = Math.Round(opening.Polyline().Width(), 3); furnishing.Depth = 0; return(furnishing); }
private void WriteFurnishings(StreamWriter sw, Furnishing furnishing, string roomReference, int index) { furnishing.Reference = roomReference + ".F" + index.ToString(); string furnIndex = "Furn" + index.ToString(); sw.WriteLine(furnIndex + "=" + furnishing.Type); sw.WriteLine(furnIndex + ".Ref=" + furnishing.Reference); sw.WriteLine(furnIndex + ".Rot=" + furnishing.RotationX.ToString() + " " + furnishing.RotationY.ToString() + " " + furnishing.RotationZ.ToString()); sw.WriteLine(furnIndex + ".Pos=" + furnishing.Position.ToDIALux()); sw.WriteLine(furnIndex + ".Size=" + furnishing.Width.ToString() + " " + furnishing.Height.ToString() + " " + furnishing.Depth.ToString()); }