public static void AddEnergyMaterial(this HB.Model model, List <HB.IEnergyMaterial> materials) { foreach (var material in materials) { var exist = model.Properties.Energy.Materials.Any(_ => _ == material); if (exist) { continue; } switch (material) { case HB.EnergyMaterial em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyMaterialNoMass em: model.Properties.Energy.Materials.Add(em); break; default: break; } } }
public static void AddConstructions(this HB.Model model, List <HB.AirBoundaryConstructionAbridged> constructions) { foreach (var item in constructions) { var exist = model.Properties.Energy.Constructions.Any(_ => _ == item); if (exist) { continue; } model.Properties.Energy.Constructions.Add(item); } }
public ModelEntity(HB.Model hbModel = default, bool newID = false) { var id = System.Guid.NewGuid(); var modelName = $"Model_{id}"; var hbObj = hbModel ?? new HoneybeeSchema.Model(modelName, new HoneybeeSchema.ModelProperties(energy: HoneybeeSchema.ModelEnergyProperties.Default)); if (newID) { hbObj.Name = modelName; hbObj.DisplayName = $"My Honeybee Model {id.ToString().Substring(0, 5)}"; } this.HBObject = hbObj; }
//public EventHandler<EventArgs> ModelPropertyButtonClicked; //public EventHandler<EventArgs> RoomsButtonClicked; //public EventHandler<EventArgs> RunSimulationButtonClicked; public Dialog_ModelResources(HB.Model honeybeeObj) { try { //var dup = HB.Face.FromJson(honeybeeObj.ToJson()); Padding = new Padding(5); Resizable = true; Title = $"Model Resources - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(450, 650); this.Icon = DialogHelper.HoneybeeIcon; DefaultButton = new Button { Text = "OK" }; DefaultButton.Click += (sender, e) => Close(); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); //var layout = new DynamicLayout(); ////layout.DefaultPadding = new Padding(10); ////layout.DefaultSpacing = new Size(5,5); //Create layout var panel = new Panel_ModelResources(honeybeeObj); //panel.ModelPropertyBtn.Click += (s, e) => ModelPropertyButtonClicked.Invoke(s, e); //panel.RoomsBtn.Click += (s, e) => RoomsButtonClicked.Invoke(s, e); //panel.RunSimulationBtn.Click += (s, e) => RunSimulationButtonClicked.Invoke(s, e); panel.AddSeparateRow(null, this.DefaultButton, this.AbortButton, null); panel.AddSeparateRow(null); //Create layout Content = panel; } catch (Exception e) { throw e; } }
public static void AddEnergyWindowMaterial(this HB.Model model, List <HB.IEnergyWindowMaterial> materials) { foreach (var material in materials) { var exist = model.Properties.Energy.Materials.Any(_ => _ == material); if (exist) { continue; } switch (material) { case HB.EnergyWindowMaterialBlind em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialGas em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialGasCustom em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialGasMixture em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialGlazing em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialShade em: model.Properties.Energy.Materials.Add(em); break; case HB.EnergyWindowMaterialSimpleGlazSys em: model.Properties.Energy.Materials.Add(em); break; default: break; } } }
//private static SimulationParameter _simulationParameter; public Panel_ModelResources(HB.Model model) { _model = model; var resourceGroup = new GroupBox(); resourceGroup.Text = "In-Model Resources"; var groupPanel = new DynamicLayout(); //groupPanel.DefaultPadding = new Padding(5); groupPanel.DefaultSpacing = new Size(5, 5); var materialBtn = new Button(); materialBtn.Text = "Materials"; groupPanel.AddRow(materialBtn); var constrcutionBtn = new Button(); constrcutionBtn.Text = "Constructions"; groupPanel.AddRow(constrcutionBtn); var constrSetbtn = new Button(); constrSetbtn.Text = "Construction Sets"; groupPanel.AddRow(constrSetbtn); var scheduleBtn = new Button(); scheduleBtn.Text = "Schedules"; groupPanel.AddRow(scheduleBtn); var programTypeBtn = new Button(); programTypeBtn.Text = "Program Types"; groupPanel.AddRow(programTypeBtn); resourceGroup.Content = groupPanel; //this.Content = resourceGroup; this.AddRow(resourceGroup); materialBtn.Click += (s, e) => { if (_model == null) { MessageBox.Show(this, "Invalid model"); return; } var lib = _model.Properties.Energy; var dialog = new Dialog_MaterialManager(ref lib); var dialog_rc = dialog.ShowModal(this); if (dialog_rc != null) { _model.Properties.Energy.Materials.Clear(); _model.AddMaterials(dialog_rc); } }; constrcutionBtn.Click += (s, e) => { if (_model == null) { MessageBox.Show(this, "Invalid model"); return; } var lib = _model.Properties.Energy; var dialog = new Dialog_ConstructionManager(ref lib); var dialog_rc = dialog.ShowModal(this); if (dialog_rc != null) { _model.Properties.Energy.Constructions.Clear(); _model.AddConstructions(dialog_rc); } }; constrSetbtn.Click += (s, e) => { if (_model == null) { MessageBox.Show(this, "Invalid model"); return; } var lib = _model.Properties.Energy; var dialog = new Dialog_ConstructionSetManager(ref lib); var dialog_rc = dialog.ShowModal(this); if (dialog_rc != null) { _model.Properties.Energy.ConstructionSets.Clear(); _model.AddConstructionSets(dialog_rc); } //MessageBox.Show(this, "Working in progress"); }; scheduleBtn.Click += (s, e) => { if (_model == null) { MessageBox.Show(this, "Invalid model"); return; } var lib = _model.Properties.Energy; var dialog = new Dialog_ScheduleRulesetManager(ref lib); var dialog_rc = dialog.ShowModal(this); if (dialog_rc != null) { // sch list } }; programTypeBtn.Click += (s, e) => { if (_model == null) { MessageBox.Show(this, "Invalid model"); return; } var lib = _model.Properties; var dialog = new Dialog_ProgramTypeManager(ref lib); var dialog_rc = dialog.ShowModal(this); if (dialog_rc != null) { _model.Properties.Energy.ProgramTypes.Clear(); _model.AddProgramTypes(dialog_rc); } //MessageBox.Show(this, "Working in progress"); }; }