diff --git a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs index 16689945..ee4ea711 100644 --- a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs +++ b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs @@ -24,9 +24,11 @@ public class ApplicationRun : FEM_Design_API_Component public ApplicationRun() : base("Application.Run", "RunApplication", "Run application for a model.", CategoryName.Name(), SubCategoryName.Cat7a()) { _minimised = false; + _keepOpen = false; } public bool _minimised { get; set; } + public bool _keepOpen { get; set; } protected override void RegisterInputParams(GH_InputParamManager pManager) { @@ -57,7 +59,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager.AddTextParameter("DocxTemplatePath", "DocxTemplatePath", "File path to documentation template file (.dsc). The documentation will be saved in the `FEM-Design API` folder. Optional parameter.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("SaveFilePath", "SaveFilePath", "File path where to save the model as .strux.\nIf not specified, the file will be saved in the `FEM-Design API` folder adjacent to your .gh script.", GH_ParamAccess.item); + pManager.AddTextParameter("SaveFilePath", "SaveFilePath", "File path where to save the model as .struxml.\nIf not specified, the file will be saved in the `FEM-Design API` folder adjacent to your .gh script.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddBooleanParameter("RunNode", "RunNode", "If true node will execute. If false node will not execute.", GH_ParamAccess.item, true); pManager[pManager.ParamCount - 1].Optional = true; @@ -85,7 +87,8 @@ public dynamic _getResults(FemDesignConnection connection, Type resultType, Resu protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu) { // Append the item to the menu, making sure it's always enabled and checked if Absolute is True. - ToolStripMenuItem item = Menu_AppendItem(menu, "Minimise FEM-Design", Menu_AbsoluteClicked, null, true, _minimised); + ToolStripMenuItem minimisedItem = Menu_AppendItem(menu, "Minimise FEM-Design", Menu_AbsoluteClicked, null, true, _minimised); + ToolStripMenuItem keepOpenItem = Menu_AppendItem(menu, "Keep open", keepOpenClick, null, true, _keepOpen); } private void Menu_AbsoluteClicked(object sender, EventArgs e) @@ -94,6 +97,12 @@ private void Menu_AbsoluteClicked(object sender, EventArgs e) ExpireSolution(true); } + private void keepOpenClick(object sender, EventArgs e) + { + _keepOpen = !_keepOpen; + ExpireSolution(true); + } + protected override void SolveInstance(IGH_DataAccess DA) { @@ -184,7 +193,7 @@ protected override void SolveInstance(IGH_DataAccess DA) // Create Task var t = Task.Run((Action)(() => { - var connection = new FemDesign.FemDesignConnection(minimized: _minimised); + var connection = new FemDesign.FemDesignConnection(minimized: _minimised, keepOpen: _keepOpen); connection.Open(_model.Value); @@ -284,4 +293,4 @@ public override Guid ComponentGuid public override GH_Exposure Exposure => GH_Exposure.primary; } -} +} \ No newline at end of file