protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var rc = Result.Cancel; OpaqueConstructionAbridged construction = null; if (mode == RunMode.Interactive) { var dialog = new UI.LibraryDialog_Constructions(); dialog.RestorePosition(); var dialog_rc = dialog.ShowSemiModal(doc, RhinoEtoApp.MainWindow); dialog.SavePosition(); if (dialog_rc != null) { construction = dialog_rc; rc = Result.Success; } } else { var msg = string.Format($"Scriptable version of {EnglishName} command not implemented."); RhinoApp.WriteLine(msg); } if (construction == null) { RhinoApp.WriteLine("No valid room energy property was set!"); return(Result.Nothing); } return(rc); }
public static Construction ToSAM(this OpaqueConstructionAbridged opaqueConstructionAbridged, Core.MaterialLibrary materialLibrary = null) { if (opaqueConstructionAbridged == null) { return(null); } List <ConstructionLayer> constructionLayers = Query.ConstructionLayers(materialLibrary, opaqueConstructionAbridged.Materials); Construction result = new Construction(opaqueConstructionAbridged.Identifier, constructionLayers); return(result); }
public void Init() { instance = new OpaqueConstructionAbridged( "Exterior Wall ASHRAE 2009", new List <string>() { "1 in Gypsum", "8in Concrete HW", "Wall Insulation", "1.5 in Gypsum" } ); var json = this.instance.ToJson(); instanceFromJson = OpaqueConstructionAbridged.FromJson(json); }
public static OpaqueConstructionAbridged ToLadybugTools(this HostPartitionType hostPartitionType, bool reverse = true) { if (hostPartitionType == null) { return(null); } List <Architectural.MaterialLayer> materialLayers = hostPartitionType.MaterialLayers; if (materialLayers == null || materialLayers.Count == 0) { return(null); } if (reverse) { materialLayers.Reverse(); } OpaqueConstructionAbridged result = new OpaqueConstructionAbridged(Query.UniqueName(hostPartitionType, reverse), materialLayers.ConvertAll(x => x.Name), hostPartitionType.Name); return(result); }
public static OpaqueConstructionAbridged ToLadybugTools(this Construction construction, bool reverse = true) { if (construction == null) { return(null); } List <ConstructionLayer> constructionLayers = construction.ConstructionLayers; if (constructionLayers == null || constructionLayers.Count == 0) { return(null); } if (reverse) { constructionLayers.Reverse(); } OpaqueConstructionAbridged result = new OpaqueConstructionAbridged(Query.UniqueName(construction, reverse), constructionLayers.ConvertAll(x => x.Name), construction.Name); return(result); }
public void Test_TestSampleModel() { //var sampleModel = @"D:\Dev\Test\HB\model_energy_shoe_box.json"; var bbox = new BoundingBox(new Point3d(0, 0, 0), new Point3d(10, 10, 3)); var box = new Box(bbox).ToBrep(); var hbFaces = box.Faces.Select(_ => _.ToHBFace(maxRoofFloorAngle: 30)).ToList(); var room = new Room($"Room_{Guid.NewGuid()}", hbFaces, new RoomPropertiesAbridged(energy: new RoomEnergyPropertiesAbridged())); var modelProp = new ModelProperties(energy: ModelEnergyProperties.Default); var stone = new EnergyMaterial( name: "Thick Stone", thickness: 0.3, conductivity: 2.31, density: 2322, specificHeat: 832, roughness: EnergyMaterial.RoughnessEnum.Rough, thermalAbsorptance: 0.95, solarAbsorptance: 0.75, visibleAbsorptance: 0.8 ); modelProp.Energy.Materials.Add(stone); var thermalMassConstr = new OpaqueConstructionAbridged("Thermal Mass Floor", new List <string>() { stone.Name }); modelProp.Energy.Constructions.Add(thermalMassConstr); var faceEnergyProp = new FaceEnergyPropertiesAbridged(); faceEnergyProp.Construction = thermalMassConstr.Name; room.Faces[0].Properties.Energy = faceEnergyProp; var model = new Model( "modelName", modelProp, "a new displace name" ); model.Rooms = new List <HoneybeeSchema.Room>(); model.Rooms.Add(room); var json = model.ToJson(); var modelPath = @"D:\Dev\test\HB\model.json"; File.WriteAllText(modelPath, json); var studyFolder = @"D:\Dev\test\HB"; var simuParPath = @"D:\Dev\test\HB\simPar.json"; Runner.RunOpenStudio(studyFolder, modelPath, simuParPath); //TestContext.WriteLine(room.ToJson()); Assert.AreEqual(room.Faces.Count, 6); }