public static window ToT3D(this IOpening opening, Building building) { if (opening == null) { return(null); } uint colour; if (!Core.Query.TryGetValue(opening, "Color", out colour)) { colour = Core.Convert.ToUint(Color.Black); } Geometry.Spatial.BoundingBox3D boundingBox3D = opening.Face3D?.GetBoundingBox(); double width = double.NaN; if (!Core.Query.TryGetValue(opening, "Width", out width)) { if (boundingBox3D == null) { return(null); } } double height = double.NaN; double level = double.NaN; throw new System.NotImplementedException(); // double height = double.NaN; //double level = double.NaN; //PlanarBoundary3D planarBoundary3D = opening.PlanarBoundary3D; //if(planarBoundary3D == null) //{ // if (!Core.Query.TryGetValue(opening, "Width", out width)) // return null; // if (!Core.Query.TryGetValue(opening, "Height", out height)) // return null; // if (!Core.Query.TryGetValue(opening, "Level", out level)) // return null; //} //else //{ // width = planarBoundary3D.Width(); // height = planarBoundary3D.Height(); // level = Analytical.Query.MinElevation(planarBoundary3D); //} window result = building.AddWindow(opening.Name, Query.OpeningType(opening), colour, height, width, level); return(result); }
public static bool TryGetSpaceAdjacency(this IEnumerable <Panel> panels, IEnumerable <Space> spaces, double tolerance, out List <Geometry.Spatial.ISAMGeometry3D> geometryList, out List <List <string> > names) { Geometry.Spatial.BoundingBox3D boundingBox3D = null; List <Face> faceList = new List <Face>(); foreach (Panel panel in panels) { if (panel == null) { continue; } Face face = Convert.ToTopologic(panel); if (face == null) { continue; } if (boundingBox3D == null) { boundingBox3D = panel.GetBoundingBox(); } else { Geometry.Spatial.BoundingBox3D boundingBox3D_Temp = panel.GetBoundingBox(); if (boundingBox3D_Temp != null) { boundingBox3D = new Geometry.Spatial.BoundingBox3D(new Geometry.Spatial.BoundingBox3D[] { boundingBox3D, boundingBox3D_Temp }); } } faceList.Add(face); } List <Topology> topologyList = new List <Topology>(); foreach (Space space in spaces) { if (space == null) { continue; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary["Name"] = space.Name; Geometry.Spatial.Point3D point3D = space.Location; if (point3D.Z - boundingBox3D.Max.Z >= 0) { point3D = (Geometry.Spatial.Point3D)point3D.GetMoved(new Geometry.Spatial.Vector3D(0, 0, (boundingBox3D.Max.Z - boundingBox3D.Min.Z) / 2)); } if (point3D.Z - boundingBox3D.Min.Z <= 0) { point3D = (Geometry.Spatial.Point3D)point3D.GetMoved(new Geometry.Spatial.Vector3D(0, 0, (boundingBox3D.Max.Z - boundingBox3D.Min.Z) / 2)); } Vertex vertex = Geometry.Topologic.Convert.ToTopologic(point3D); vertex = (Vertex)vertex.SetDictionary(dictionary); topologyList.Add(vertex); } return(TryGetSpaceAdjacency(faceList, topologyList, tolerance, out geometryList, out names)); }