public static Aperture ToSAM(this HoneybeeSchema.Aperture aperture, bool @internal, IEnumerable <ApertureConstruction> apertureConstructions = null) { if (aperture == null) { return(null); } Geometry.Spatial.Face3D face3D = Geometry.LadybugTools.Convert.ToSAM(aperture.Geometry); if (face3D == null) { return(null); } ApertureConstruction apertureConstruction = null; if (apertureConstructions != null && aperture.Properties?.Energy?.Construction != null) { foreach (ApertureConstruction apertureConstruction_Temp in apertureConstructions) { if (apertureConstruction_Temp == null) { continue; } if (apertureConstruction_Temp.ApertureType != ApertureType.Window) { continue; } if (aperture.Properties.Energy.Construction == apertureConstruction_Temp.Name) { apertureConstruction = apertureConstruction_Temp; break; } } } if (apertureConstruction == null) { AnyOf <OpaqueConstructionAbridged, WindowConstructionAbridged, ShadeConstruction, AirBoundaryConstructionAbridged> construction_Honeybee = Query.DefaultApertureConstruction(ApertureType.Window, @internal); if (construction_Honeybee != null) { apertureConstruction = construction_Honeybee.ToSAM_ApertureConstruction(); } } if (apertureConstruction == null) { apertureConstruction = new ApertureConstruction(aperture.DisplayName, ApertureType.Window); } Aperture result = new Aperture(apertureConstruction, face3D, Analytical.Query.OpeningLocation(face3D)); return(result); }
public ApertureEntity(HB.Aperture hbObj) { this.HBObject = hbObj; }
public static Face ToLadybugTools_Face(this IPartition partition, BuildingModel buildingModel, Space space) { Face3D face3D = Geometry.LadybugTools.Convert.ToLadybugTools(partition?.Face3D); if (face3D == null) { return(null); } FaceType?faceType = partition.FaceType(); if (faceType == null || !faceType.HasValue) { return(null); } int index = -1; int index_Adjacent = -1; bool reverse = true; List <Space> spaces = buildingModel.GetSpaces(partition); if (spaces != null && spaces.Count != 0) { index = spaces.FindIndex(x => x.Guid == space.Guid); index = buildingModel.UniqueIndex(spaces[index]); index_Adjacent = spaces.FindIndex(x => x.Guid != space.Guid); index_Adjacent = buildingModel.UniqueIndex(spaces[index_Adjacent]); reverse = buildingModel.UniqueIndex(spaces[0]) != index; } AnyOf <Ground, Outdoors, Adiabatic, Surface> boundaryCondition = partition.ToLadybugTools_BoundaryCondition(buildingModel, space); FaceEnergyPropertiesAbridged faceEnergyPropertiesAbridged = new FaceEnergyPropertiesAbridged(); if (partition is IHostPartition) { faceEnergyPropertiesAbridged.Construction = Query.UniqueName(((IHostPartition)partition).Type(), reverse); } Face face = new Face(Query.UniqueName(partition, index), face3D, faceType.Value, boundaryCondition, new FacePropertiesAbridged(faceEnergyPropertiesAbridged), partition.Name); if (partition is IHostPartition) { List <IOpening> openings = ((IHostPartition)partition).GetOpenings(); if (openings != null && openings.Count != 0) { List <HoneybeeSchema.Aperture> apertures = new List <HoneybeeSchema.Aperture>(); List <HoneybeeSchema.Door> doors = new List <HoneybeeSchema.Door>(); foreach (IOpening opening in openings) { MaterialType materialType = MaterialType.Opaque; OpeningType openingType = opening.Type(); if (openingType != null) { materialType = buildingModel.GetMaterialType(openingType.PaneMaterialLayers); } if (opening is Window && materialType != MaterialType.Opaque) { HoneybeeSchema.Aperture aperture = ((Window)opening).ToLadybugTools(buildingModel, space); if (aperture != null) { apertures.Add(aperture); } } else { HoneybeeSchema.Door door = opening.ToLadybugTools(buildingModel, space); if (door != null) { doors.Add(door); } } } if (apertures != null && apertures.Count != 0) { face.Apertures = apertures; } if (doors != null && doors.Count != 0) { face.Doors = doors; } } } return(face); }