From c4be0e8e453e4d80d21f5d65db655245ca3254df Mon Sep 17 00:00:00 2001 From: lorinczandrea Date: Fri, 30 Aug 2024 15:09:03 +0200 Subject: [PATCH] :sparkles: #1067 GlobalConfigurations dynamic GH comp (sqashed commit) commit a74c768bb36c7f6e74c30757e377af47ee30d3a6 Author: lorinczandrea Date: Fri Aug 30 15:06:41 2024 +0200 :bug: error handling #1067 commit 09ed39ed27f14c0210ff4b303bb166023208e590 Author: lorinczandrea Date: Thu Aug 29 20:42:26 2024 +0200 :construction: fix SetGlobalCfg #1067 still testing commit fa3d3fb63107363e2f039ce6b93a0de8d54d6581 Author: lorinczandrea Date: Wed Aug 28 19:59:54 2024 +0200 :construction: dynamic GlobalConfig GH component #1067 waiting for test --- FemDesign.Core/Calculate/CmdGlobalCfg.cs | 721 +++++++++++++++--- FemDesign.Core/FemDesignConnection.cs | 10 + .../GenericClasses/RestrictedDouble.cs | 34 +- .../GenericClasses/RestrictedInteger.cs | 18 +- .../Configs}/ConcreteDesignConfig.cs | 0 .../{ => Configurations/Configs}/Configs.cs | 4 +- .../Configs}/SteelBarCalculationParameters.cs | 0 .../Configs}/SteelBarDesignParameters.cs | 0 .../Configs}/SteelDesignConfiguration.cs | 0 .../GlobalConfigs/GlobalConfigs.cs | 124 +++ .../GlobalConfigs/MeshElementSettings.cs | 80 ++ .../GlobalConfigs/MeshFunctionSettings.cs | 124 +++ .../GlobalConfigs/MeshGeneralSettings.cs | 36 + .../GlobalConfigs/MeshPrepareSettings.cs | 199 +++++ .../GlobalConfigs/PeakSmAutoSettings.cs | 133 ++++ .../GlobalConfigs/PeakSmMethodSettings.cs | 60 ++ .../GlobalConfigs/SoilCalculationSettings.cs | 36 + .../FemDesign.Grasshopper.csproj | 19 +- .../OBSOLETE/PipeSetGlobalCfg_OBSOLETE2306.cs | 111 +++ FemDesign.Grasshopper/Pipe/PipeSetCfg.cs | 6 +- .../Pipe/PipeSetGlobalCfg.cs | 107 ++- 21 files changed, 1659 insertions(+), 163 deletions(-) rename FemDesign.Grasshopper/Calculate/{ => Configurations/Configs}/ConcreteDesignConfig.cs (100%) rename FemDesign.Grasshopper/Calculate/{ => Configurations/Configs}/Configs.cs (97%) rename FemDesign.Grasshopper/Calculate/{ => Configurations/Configs}/SteelBarCalculationParameters.cs (100%) rename FemDesign.Grasshopper/Calculate/{ => Configurations/Configs}/SteelBarDesignParameters.cs (100%) rename FemDesign.Grasshopper/Calculate/{ => Configurations/Configs}/SteelDesignConfiguration.cs (100%) create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/GlobalConfigs.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshElementSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshFunctionSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshGeneralSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshPrepareSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmAutoSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmMethodSettings.cs create mode 100644 FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/SoilCalculationSettings.cs create mode 100644 FemDesign.Grasshopper/Pipe/OBSOLETE/PipeSetGlobalCfg_OBSOLETE2306.cs diff --git a/FemDesign.Core/Calculate/CmdGlobalCfg.cs b/FemDesign.Core/Calculate/CmdGlobalCfg.cs index 98ce05641..f3365897c 100644 --- a/FemDesign.Core/Calculate/CmdGlobalCfg.cs +++ b/FemDesign.Core/Calculate/CmdGlobalCfg.cs @@ -1,9 +1,12 @@ // https://strusoft.com/ +using System; using System.Xml.Serialization; using System.Xml.Linq; using System.IO; +using System.Collections.Generic; using System.Reflection; using System.Linq; +using FemDesign.GenericClasses; namespace FemDesign.Calculate { @@ -55,6 +58,67 @@ public CmdGlobalCfg(MeshGeneral meshGeneral, MeshElements meshElements, MeshFunc this.SoilCalculation = soilCalculation; } + public CmdGlobalCfg(params GlobConfig[] globConfigs) + { + this.Initialize(globConfigs.ToList()); + } + + public CmdGlobalCfg(List globConfigs) + { + this.Initialize(globConfigs); + } + + private void Initialize(List globConfigs) + { + //this.MeshGeneral = MeshGeneral.Default(); + //this.MeshElements = MeshElements.Default(); + //this.Meshfunctions = MeshFunctions.Default(); + //this.MeshPrepare = MeshPrepare.Default(); + //this.PeaksmMethod = PeaksmMethod.Default(); + //this.PeaksmAuto = PeaksmAuto.Default(); + //this.SoilCalculation = SoilCalculation.Default(); + + List types = new List(); + foreach (var config in globConfigs) + { + string type = config.GetType().Name; + if (types.Contains(type)) + throw new Exception($"The input list contains items of the same type. You can only specify one {type} object in the input list!"); + + switch (type) + { + case nameof(Calculate.MeshGeneral): + this.MeshGeneral = (MeshGeneral)config; + break; + case nameof(Calculate.MeshElements): + this.MeshElements = (MeshElements)config; + break; + case nameof(Calculate.MeshFunctions): + this.Meshfunctions = (MeshFunctions)config; + break; + case nameof(Calculate.MeshPrepare): + this.MeshPrepare = (MeshPrepare)config; + break; + case nameof(Calculate.PeaksmMethod): + this.PeaksmMethod = (PeaksmMethod)config; + break; + case nameof(Calculate.PeaksmAuto): + this.PeaksmAuto = (PeaksmAuto)config; + break; + case nameof(Calculate.SoilCalculation): + this.SoilCalculation = (SoilCalculation)config; + break; + case null: + throw new ArgumentNullException("Input has null elements!"); + default: + throw new ArgumentException($"Input has elemets with invalid type! Valid types are: {nameof(Calculate.SoilCalculation)}, {nameof(Calculate.MeshGeneral)}, {nameof(Calculate.MeshElements)}, " + + $"{nameof(Calculate.MeshFunctions)}, {nameof(Calculate.MeshPrepare)}, {nameof(Calculate.PeaksmMethod)}, {nameof(Calculate.PeaksmAuto)}"); + } + + types.Add(type); + } + } + public static CmdGlobalCfg Default() { var meshGeneral = MeshGeneral.Default(); @@ -99,10 +163,17 @@ public override XElement ToXElement() } - public partial class MeshGeneral + public partial class MeshGeneral : GlobConfig { [XmlAttribute("fAdjustToLoads")] - public int _adjustToLoads { get; set; } + public int _adjustToLoads; + + [XmlIgnore] + public bool AdjustToLoads + { + get => Convert.ToBoolean(_adjustToLoads); + set => _adjustToLoads = Convert.ToInt32(value); + } /// /// Parameterless constructor for serialization. @@ -111,34 +182,62 @@ private MeshGeneral() { } + public MeshGeneral(bool adjustToLoad = false) { - this._adjustToLoads = System.Convert.ToInt32(adjustToLoad); + AdjustToLoads = adjustToLoad; } public static MeshGeneral Default() { return new MeshGeneral(adjustToLoad : false); } - } - public partial class MeshElements + public partial class MeshElements : GlobConfig { - [XmlAttribute("fAdjustToLoads")] - public int _elemCalcRegion { get; set; } + [XmlAttribute("fElemCalcRegion")] + public int _elemCalcRegion; + + [XmlIgnore] + public bool ElemCalcRegion + { + get => Convert.ToBoolean(_elemCalcRegion); + set => _elemCalcRegion = Convert.ToInt32(value); + } [XmlAttribute("rElemSizeDiv")] public double ElemSizeDiv { get; set; } [XmlAttribute("fCorrectToMinDivNum")] - public int _correctToMinDivNum { get; set; } + public int _correctToMinDivNum; + + [XmlIgnore] + public bool CorrectToMinDivNum + { + get => Convert.ToBoolean(_correctToMinDivNum); + set => _correctToMinDivNum = Convert.ToInt32(value); + } [XmlAttribute("sDefaultDivision")] - public int DefaultDivision { get; set; } + public int _defaultDivision; + + [XmlIgnore] + public int DefaultDivision + { + get => _defaultDivision; + set => _defaultDivision = RestrictedInteger.DefaultBarElemDiv(value); + } [XmlAttribute("rDefaultAngle")] - public double DefaultAngle { get; set; } + public double _defaultAngle; + + [XmlIgnore] + public double DefaultAngle + { + get => _defaultAngle; + set => _defaultAngle = RestrictedDouble.NonNegMax_90(value); + } /// /// Parameterless constructor for serialization. @@ -150,9 +249,9 @@ private MeshElements() public MeshElements(bool elemCalcRegion = true, double elemeSizeDiv = 6.0, bool correctToMinDivNum = true, int defaultDiv = 2, double defaultAngle = 15.0) { - this._elemCalcRegion = System.Convert.ToInt32(elemCalcRegion); + this.ElemCalcRegion = elemCalcRegion; this.ElemSizeDiv = elemeSizeDiv; - this._correctToMinDivNum = System.Convert.ToInt32(correctToMinDivNum); + this.CorrectToMinDivNum = correctToMinDivNum; this.DefaultDivision = defaultDiv; this.DefaultAngle = defaultAngle; } @@ -164,40 +263,110 @@ public static MeshElements Default() } - public partial class MeshFunctions + public partial class MeshFunctions : GlobConfig { [XmlAttribute("fRefineLocally")] - public int _refineLocally { get; set; } + public int _refineLocally; + + [XmlIgnore] + public bool RefineLocally + { + get => Convert.ToBoolean(_refineLocally); + set => _refineLocally = Convert.ToInt32(value); + } [XmlAttribute("sRefineMaxStepNum")] public int RefineMaxStepNum { get; set; } [XmlAttribute("fMaxIterWarning")] - public int _maxIterWarning { get; set; } + public int _maxIterWarning; + + [XmlIgnore] + public bool MaxIterWarning + { + get => Convert.ToBoolean(_maxIterWarning); + set => _maxIterWarning = Convert.ToInt32(value); + } [XmlAttribute("fReduceSize")] - public int _reduceSize { get; set; } + public int _reduceSize; + + [XmlIgnore] + public bool ReduceSize + { + get => Convert.ToBoolean(_reduceSize); + set => _reduceSize = Convert.ToInt32(value); + } [XmlAttribute("sSmoothStepNum")] - public int SmoothStepNum { get; set; } + public int _smoothStepNum; + + [XmlIgnore] + public int SmoothStepNum + { + get => _smoothStepNum; + set => _smoothStepNum = RestrictedInteger.MeshSmoothSteps(value); + } [XmlAttribute("fCheckMeshGeom")] - public int _checkMeshGeom { get; set; } + public int _checkMeshGeom; + + [XmlIgnore] + public bool CheckMeshGeom + { + get => Convert.ToBoolean(_checkMeshGeom); + set => _checkMeshGeom = Convert.ToInt32(value); + } [XmlAttribute("rCheckGeomMinAngle")] - public double CheckGeomMinAngle { get; set; } + public double _checkGeomMinAngle; + + [XmlIgnore] + public double CheckGeomMinAngle + { + get => _checkGeomMinAngle; + set => _checkGeomMinAngle = RestrictedDouble.NonNegMax_90(value); + } [XmlAttribute("rCheckGeomMaxAngle")] - public double CheckGeomMaxAngle { get; set; } + public double _checkGeomMaxAngle; + + [XmlIgnore] + public double CheckGeomMaxAngle + { + get => _checkGeomMaxAngle; + set => _checkGeomMaxAngle = RestrictedDouble.MeshMaxAngle(value); + } [XmlAttribute("rCheckGeomMaxSideRatio")] - public double CheckGeomMaxSideRatio { get; set; } + public double _checkGeomMaxSideRatio; + + [XmlIgnore] + public double CheckGeomMaxSideRatio + { + get => _checkGeomMaxSideRatio; + set => _checkGeomMaxSideRatio = RestrictedDouble.MeshMaxRatio(value); + } [XmlAttribute("fCheckMeshOverlap")] - public int _checkMeshOverLap { get; set; } + public int _checkMeshOverLap; + + [XmlIgnore] + public bool CheckMeshOverLap + { + get => Convert.ToBoolean(_checkMeshOverLap); + set => _checkMeshOverLap = Convert.ToInt32(value); + } [XmlAttribute("fCheckMeshTopology")] - public int _checkMeshTopology { get; set; } + public int _checkMeshTopology; + + [XmlIgnore] + public bool CheckMeshTopology + { + get => Convert.ToBoolean(_checkMeshTopology); + set => _checkMeshTopology = Convert.ToInt32(value); + } /// /// Parameterless constructor for serialization. @@ -209,17 +378,17 @@ private MeshFunctions() public MeshFunctions(bool refineLocally = true, int refineMaxStepNum = 5, bool iterWarning = false, bool reduceSize = true, int smoothStepNum = 3, bool checkMeshGeom = true, double checkGeomMinangle = 10.0, double checkGeomMaxangle = 170.0, double checkGeomMaxSideRatio = 8.0, bool checkMeshOverlap = true, bool checkMeshTopology = true) { - this._refineLocally = System.Convert.ToInt32(refineLocally); + this.RefineLocally = refineLocally; this.RefineMaxStepNum = refineMaxStepNum; - this._maxIterWarning = System.Convert.ToInt32(iterWarning); - this._reduceSize = System.Convert.ToInt32(reduceSize); + this.MaxIterWarning = iterWarning; + this.ReduceSize = reduceSize; this.SmoothStepNum = smoothStepNum; - this._checkMeshGeom = System.Convert.ToInt32(checkMeshGeom); + this.CheckMeshGeom = checkMeshGeom; this.CheckGeomMinAngle = checkGeomMinangle; this.CheckGeomMaxAngle = checkGeomMaxangle; this.CheckGeomMaxSideRatio = checkGeomMaxSideRatio; - this._checkMeshOverLap = System.Convert.ToInt32(checkMeshOverlap); - this._checkMeshTopology = System.Convert.ToInt32(checkMeshTopology); + this.CheckMeshOverLap = checkMeshOverlap; + this.CheckMeshTopology = checkMeshTopology; } public static MeshFunctions Default() @@ -228,76 +397,237 @@ public static MeshFunctions Default() } } - public partial class MeshPrepare + public partial class MeshPrepare : GlobConfig { [XmlAttribute("fAutoRegen")] - public int _autoRegen { get; set; } + public int _autoRegen; + + [XmlIgnore] + public bool AutoRegen + { + get => Convert.ToBoolean(_autoRegen); + set => _autoRegen = Convert.ToInt32(value); + } [XmlAttribute("fThPeak")] - public int _thPeak { get; set; } + public int _thPeak; + + [XmlIgnore] + public bool ThPeak + { + get => Convert.ToBoolean(_thPeak); + set => _thPeak = Convert.ToInt32(value); + } [XmlAttribute("fThBeam")] - public int _thBeam { get; set; } + public int _thBeam; + + [XmlIgnore] + public bool ThBeam + { + get => Convert.ToBoolean(_thBeam); + set => _thBeam = Convert.ToInt32(value); + } [XmlAttribute("fThColumn")] - public int _thColumn { get; set; } + public int _thColumn; + + [XmlIgnore] + public bool ThColumn + { + get => Convert.ToBoolean(_thColumn); + set => _thColumn = Convert.ToInt32(value); + } [XmlAttribute("fThTruss")] - public int _thTruss { get; set; } + public int _thTruss; + + [XmlIgnore] + public bool ThTruss + { + get => Convert.ToBoolean(_thTruss); + set => _thTruss = Convert.ToInt32(value); + } [XmlAttribute("fThFicBeam")] - public int _thFicBeam { get; set; } + public int _thFicBeam; + + [XmlIgnore] + public bool ThFicBeam + { + get => Convert.ToBoolean(_thFicBeam); + set => _thFicBeam = Convert.ToInt32(value); + } [XmlAttribute("fThFreeEdge")] - public int _thFreeEdge { get; set; } + public int _thFreeEdge; + + [XmlIgnore] + public bool ThFreeEdge + { + get => Convert.ToBoolean(_thFreeEdge); + set => _thFreeEdge = Convert.ToInt32(value); + } [XmlAttribute("fThRegionBorder")] - public int _thRegionBordger { get; set; } + public int _thRegionBordger; + + [XmlIgnore] + public bool ThRegionBordger + { + get => Convert.ToBoolean(_thRegionBordger); + set => _thRegionBordger = Convert.ToInt32(value); + } [XmlAttribute("fThSuppPt")] - public int _thSupptPt { get; set; } + public int _thSupptPt; + + [XmlIgnore] + public bool ThSupptPt + { + get => Convert.ToBoolean(_thSupptPt); + set => _thSupptPt = Convert.ToInt32(value); + } [XmlAttribute("fThSuppLn")] - public int _thSuppLn { get; set; } + public int _thSuppLn; + + [XmlIgnore] + public bool ThSuppLn + { + get => Convert.ToBoolean(_thSuppLn); + set => _thSuppLn = Convert.ToInt32(value); + } [XmlAttribute("fThSuppSf")] - public int _thSuppSf { get; set; } + public int _thSuppSf; + + [XmlIgnore] + public bool ThSuppSf + { + get => Convert.ToBoolean(_thSuppSf); + set => _thSuppSf = Convert.ToInt32(value); + } [XmlAttribute("fThEdgeConn")] - public int _thEdgeConn { get; set; } + public int _thEdgeConn; + + [XmlIgnore] + public bool ThEdgeConn + { + get => Convert.ToBoolean(_thEdgeConn); + set => _thEdgeConn = Convert.ToInt32(value); + } [XmlAttribute("fThConnPt")] - public int _thConnPt { get; set; } + public int _thConnPt; + + [XmlIgnore] + public bool ThConnPt + { + get => Convert.ToBoolean(_thConnPt); + set => _thConnPt = Convert.ToInt32(value); + } [XmlAttribute("fThConnLn")] - public int _thConnLn { get; set; } + public int _thConnLn; + + [XmlIgnore] + public bool ThConnLn + { + get => Convert.ToBoolean(_thConnLn); + set => _thConnLn = Convert.ToInt32(value); + } [XmlAttribute("fThConnSf")] - public int _thConnSf { get; set; } + public int _thConnSf; + + [XmlIgnore] + public bool ThConnSf + { + get => Convert.ToBoolean(_thConnSf); + set => _thConnSf = Convert.ToInt32(value); + } [XmlAttribute("fThLoadPt")] - public int _thLoadPt { get; set; } + public int _thLoadPt; + + [XmlIgnore] + public bool ThLoadPt + { + get => Convert.ToBoolean(_thLoadPt); + set => _thLoadPt = Convert.ToInt32(value); + } [XmlAttribute("fThLoadLn")] - public int _thLoadLn { get; set; } + public int _thLoadLn; + + [XmlIgnore] + public bool ThLoadLn + { + get => Convert.ToBoolean(_thLoadLn); + set => _thLoadLn = Convert.ToInt32(value); + } [XmlAttribute("fThLoadSf")] - public int _thLoadSf { get; set; } + public int _thLoadSf; + + [XmlIgnore] + public bool ThLoadSf + { + get => Convert.ToBoolean(_thLoadSf); + set => _thLoadSf = Convert.ToInt32(value); + } [XmlAttribute("fThFixPt")] - public int _thFixPt { get; set; } + public int _thFixPt; + + [XmlIgnore] + public bool ThFixPt + { + get => Convert.ToBoolean(_thFixPt); + set => _thFixPt = Convert.ToInt32(value); + } [XmlAttribute("fThFixLn")] - public int _thFixLn { get; set; } + public int _thFixLn; + + [XmlIgnore] + public bool ThFixLn + { + get => Convert.ToBoolean(_thFixLn); + set => _thFixLn = Convert.ToInt32(value); + } [XmlAttribute("fAutoRebuild")] - public int _autoRebuild { get; set; } + public int _autoRebuild; + + [XmlIgnore] + public bool AutoRebuild + { + get => Convert.ToBoolean(_autoRebuild); + set => _autoRebuild = Convert.ToInt32(value); + } [XmlAttribute("fAutoSmooth")] - public int _autoSmooth { get; set; } + public int _autoSmooth; + + [XmlIgnore] + public bool AutoSmooth + { + get => Convert.ToBoolean(_autoSmooth); + set => _autoSmooth = Convert.ToInt32(value); + } [XmlAttribute("fAutoCheck")] - public int _autoCheck { get; set; } + public int _autoCheck; + + [XmlIgnore] + public bool AutoCheck + { + get => Convert.ToBoolean(_autoCheck); + set => _autoCheck = Convert.ToInt32(value); + } /// /// Parameterless constructor for serialization. @@ -306,31 +636,33 @@ private MeshPrepare() { } - public MeshPrepare(bool autoRegen = true, bool thPeak = true, bool thBeam = false, bool thColumn = true, bool thTruss = false, bool thFicBeam = false, bool thFreeEdge = false, bool thRegionBorder = false, bool thSuppPt = true, bool thSuppLn = false, bool thSuppSf = false, bool thEdgeConn = false, bool thConnPt = false, bool thConnLn = false, bool thConnSf = false, bool thLoadPt = false, bool thLoadLn = false, bool thLoadSf = false, bool thFixPt = false, bool thFixLn = false, bool autoRebuild = true, bool autoSmooth = true, bool autoCheck = false) - { - this._autoRegen = System.Convert.ToInt32(autoRegen); - this._thPeak = System.Convert.ToInt32(thPeak); - this._thBeam = System.Convert.ToInt32(thBeam); - this._thColumn = System.Convert.ToInt32(thColumn); - this._thTruss = System.Convert.ToInt32(thTruss); - this._thFicBeam = System.Convert.ToInt32(thFicBeam); - this._thFreeEdge = System.Convert.ToInt32(thFreeEdge); - this._thRegionBordger = System.Convert.ToInt32(thRegionBorder); - this._thSupptPt = System.Convert.ToInt32(thSuppPt); - this._thSuppLn = System.Convert.ToInt32(thSuppLn); - this._thSuppSf = System.Convert.ToInt32(thSuppSf); - this._thEdgeConn = System.Convert.ToInt32(thEdgeConn); - this._thConnPt = System.Convert.ToInt32(thConnPt); - this._thConnLn = System.Convert.ToInt32(thConnLn); - this._thConnSf = System.Convert.ToInt32(thConnSf); - this._thLoadPt = System.Convert.ToInt32(thLoadPt); - this._thLoadLn = System.Convert.ToInt32(thLoadLn); - this._thLoadSf = System.Convert.ToInt32(thLoadSf); - this._thFixPt = System.Convert.ToInt32(thFixPt); - this._thFixLn = System.Convert.ToInt32(thFixLn); - this._autoRebuild = System.Convert.ToInt32(autoRebuild); - this._autoSmooth = System.Convert.ToInt32(autoSmooth); - this._autoCheck = System.Convert.ToInt32(autoCheck); + public MeshPrepare(bool autoRegen = true, bool thPeak = true, bool thBeam = false, bool thColumn = true, bool thTruss = false, bool thFicBeam = false, bool thFreeEdge = false, bool thRegionBorder = false, + bool thSuppPt = true, bool thSuppLn = false, bool thSuppSf = false, bool thEdgeConn = false, bool thConnPt = false, bool thConnLn = false, bool thConnSf = false, bool thLoadPt = false, + bool thLoadLn = false, bool thLoadSf = false, bool thFixPt = false, bool thFixLn = false, bool autoRebuild = true, bool autoSmooth = true, bool autoCheck = false) + { + this.AutoRegen = autoRegen; + this.ThPeak = thPeak; + this.ThBeam = thBeam; + this.ThColumn = thColumn; + this.ThTruss = thTruss; + this.ThFicBeam = thFicBeam; + this.ThFreeEdge = thFreeEdge; + this.ThRegionBordger = thRegionBorder; + this.ThSupptPt = thSuppPt; + this.ThSuppLn = thSuppLn; + this.ThSuppSf = thSuppSf; + this.ThEdgeConn = thEdgeConn; + this.ThConnPt = thConnPt; + this.ThConnLn = thConnLn; + this.ThConnSf = thConnSf; + this.ThLoadPt = thLoadPt; + this.ThLoadLn = thLoadLn; + this.ThLoadSf = thLoadSf; + this.ThFixPt = thFixPt; + this.ThFixLn = thFixLn; + this.AutoRebuild = autoRebuild; + this.AutoSmooth = autoSmooth; + this.AutoCheck = autoCheck; } public static MeshPrepare Default() @@ -339,16 +671,37 @@ public static MeshPrepare Default() } } - public partial class PeaksmMethod + public partial class PeaksmMethod : GlobConfig { [XmlAttribute("sPeakFormFunc_M")] - public int PeakFormM { get; set; } + public int _peakFormM { get; set; } + + [XmlIgnore] + public PeaksmMethodOptions PeakFormM + { + get => (PeaksmMethodOptions)_peakFormM; + set => _peakFormM = (int)value; + } [XmlAttribute("sPeakFormFunc_N")] - public int PeakFormN { get; set; } + public int _peakFormN { get; set; } + + [XmlIgnore] + public PeaksmMethodOptions PeakFormN + { + get => (PeaksmMethodOptions)_peakFormN; + set => _peakFormN = (int)value; + } [XmlAttribute("sPeakFormFunc_V")] - public int PeakFormV { get; set; } + public int _peakFormV { get; set; } + + [XmlIgnore] + public PeaksmMethodOptions PeakFormV + { + get => (PeaksmMethodOptions)_peakFormV; + set => _peakFormV = (int)value; + } /// /// Parameterless constructor for serialization. @@ -359,6 +712,13 @@ private PeaksmMethod() } public PeaksmMethod(int peakFormM = 1, int peakFormN = 1, int peakFormV = 1) + { + this._peakFormM = peakFormM; + this._peakFormN = peakFormN; + this._peakFormV = peakFormV; + } + + public PeaksmMethod(PeaksmMethodOptions peakFormM = PeaksmMethodOptions.HigherOrderShapeFunc, PeaksmMethodOptions peakFormN = PeaksmMethodOptions.HigherOrderShapeFunc, PeaksmMethodOptions peakFormV = PeaksmMethodOptions.HigherOrderShapeFunc) { this.PeakFormM = peakFormM; this.PeakFormN = peakFormN; @@ -369,51 +729,169 @@ public static PeaksmMethod Default() { return new PeaksmMethod(peakFormM : 1); } + + public enum PeaksmMethodOptions + { + [XmlEnum("0")] + [Parseable("DontSmooth", "dontSmooth", "dontsmooth", "Don't Smooth", "Don't smooth", "don't smooth", "No smooth", "Don't", "don't", "Dont", "dont")] + DontSmooth = 0, + + [XmlEnum("1")] + [Parseable("HigherOrderShapeFunc", "higherOrderShapeFunc", "HigherOrderShapeFunction", "HigherOrderShape", "higherOrderShape", "HigherOrder", "higherOrder", "Higher", "Use higher order shape function", "Use higher order shape functions", "Use higher order shape", "Higher order shape function", "higher order shape function", "higher order shape", "higher order", "Higher order shape", "Higher order", "higher")] + HigherOrderShapeFunc = 1, + + [XmlEnum("2")] + [Parseable("ConstShapeFunc", "ConstantShapeFunc", "constShapeFunc", "constantShapeFunc", "ConstShapeFunction", "ConstantShapeFunction", "constShapeFunction", "constantShapeFunction", "ConstShape", "constShape", "Const", "const", "Use constant shape function", "Use const shape function", "Use const shape", "Constant shape function", "constant shape function", "Use constant shape", "constant shape", "const shape", "Constant", "constant")] + ConstShapeFunc = 2, + + [XmlEnum("3")] + [Parseable("SetToZero", "Set To Zero", "Set to zero", "Zero", "zero")] + SetToZero = 3 + } } + - public partial class PeaksmAuto + public partial class PeaksmAuto : GlobConfig { [XmlAttribute("fPeakBeam")] - public int _peakBeam { get; set; } + public int _peakBeam; + + [XmlIgnore] + public bool PeakBeam + { + get => Convert.ToBoolean(_peakBeam); + set => _peakBeam = Convert.ToInt32(value); + } [XmlAttribute("fPeakColumn")] - public int _peakColumn { get; set; } + public int _peakColumn; + + [XmlIgnore] + public bool PeakColumn + { + get => Convert.ToBoolean(_peakColumn); + set => _peakColumn = Convert.ToInt32(value); + } [XmlAttribute("fPeakTruss")] - public int _peakTruss { get; set; } + public int _peakTruss; + + [XmlIgnore] + public bool PeakTruss + { + get => Convert.ToBoolean(_peakTruss); + set => _peakTruss = Convert.ToInt32(value); + } [XmlAttribute("fPeakFicBeam")] - public int _peakFicBeam { get; set; } + public int _peakFicBeam; + + [XmlIgnore] + public bool PeakFicBeam + { + get => Convert.ToBoolean(_peakFicBeam); + set => _peakFicBeam = Convert.ToInt32(value); + } [XmlAttribute("fPeakPlate")] - public int _peakPlate { get; set; } + public int _peakPlate; + + [XmlIgnore] + public bool PeakPlate + { + get => Convert.ToBoolean(_peakPlate); + set => _peakPlate = Convert.ToInt32(value); + } [XmlAttribute("fPeakWall")] - public int _peakWall { get; set; } + public int _peakWall; + + [XmlIgnore] + public bool PeakWall + { + get => Convert.ToBoolean(_peakWall); + set => _peakWall = Convert.ToInt32(value); + } [XmlAttribute("fPeakFicShell")] - public int _peakFicShell { get; set; } + public int _peakFicShell; + + [XmlIgnore] + public bool PeakFicShell + { + get => Convert.ToBoolean(_peakFicShell); + set => _peakFicShell = Convert.ToInt32(value); + } [XmlAttribute("fPeakSuppPt")] - public int _peakSuppPt { get; set; } + public int _peakSuppPt; + + [XmlIgnore] + public bool PeakSuppPt + { + get => Convert.ToBoolean(_peakSuppPt); + set => _peakSuppPt = Convert.ToInt32(value); + } [XmlAttribute("fPeakSuppLn")] - public int _peakSuppLn { get; set; } + public int _peakSuppLn; + + [XmlIgnore] + public bool PeakSuppLn + { + get => Convert.ToBoolean(_peakSuppLn); + set => _peakSuppLn = Convert.ToInt32(value); + } [XmlAttribute("fPeakSuppSf")] - public int _peakSuppSf { get; set; } + public int _peakSuppSf; + + [XmlIgnore] + public bool PeakSuppSf + { + get => Convert.ToBoolean(_peakSuppSf); + set => _peakSuppSf = Convert.ToInt32(value); + } [XmlAttribute("fPeakConnPt")] - public int _peakConnPt { get; set; } + public int _peakConnPt; + + [XmlIgnore] + public bool PeakConnPt + { + get => Convert.ToBoolean(_peakConnPt); + set => _peakConnPt = Convert.ToInt32(value); + } [XmlAttribute("fPeakConnLn")] - public int _peakConnLn { get; set; } + public int _peakConnLn; + + [XmlIgnore] + public bool PeakConnLn + { + get => Convert.ToBoolean(_peakConnLn); + set => _peakConnLn = Convert.ToInt32(value); + } [XmlAttribute("fPeakConnSf")] - public int _peakConnSf { get; set; } + public int _peakConnSf; + + [XmlIgnore] + public bool PeakConnSf + { + get => Convert.ToBoolean(_peakConnSf); + set => _peakConnSf = Convert.ToInt32(value); + } [XmlAttribute("rPeakFactor")] - public double PeakFactor { get; set; } + public double _peakFactor; + + [XmlIgnore] + public double PeakFactor + { + get => _peakFactor; + set => _peakFactor = RestrictedDouble.NonNegMax_5(value); + } /// /// Parameterless constructor for serialization. @@ -424,19 +902,19 @@ private PeaksmAuto() } public PeaksmAuto(bool peakBeam = false, bool peakColumn = true, bool peakTruss = false, bool peakficBeam = false, bool peakPlate = false, bool peakWall = false, bool peakFicShell = false, bool peakSuppPt = true, bool peakSuppLn = false, bool peakSuppSf = false, bool peakConnPt = false, bool peakConnLn = false, bool peakConnSf = false, double peakFactor = 0.5) { - this._peakBeam = System.Convert.ToInt32(peakBeam); - this._peakColumn = System.Convert.ToInt32(peakColumn); - this._peakTruss = System.Convert.ToInt32(peakTruss); - this._peakFicBeam = System.Convert.ToInt32(peakficBeam); - this._peakPlate = System.Convert.ToInt32(peakPlate); - this._peakWall = System.Convert.ToInt32(peakWall); - this._peakFicShell = System.Convert.ToInt32(peakFicShell); - this._peakSuppPt = System.Convert.ToInt32(peakSuppPt); - this._peakSuppLn = System.Convert.ToInt32(peakSuppLn); - this._peakSuppSf = System.Convert.ToInt32(peakSuppSf); - this._peakConnPt = System.Convert.ToInt32(peakConnPt); - this._peakConnLn = System.Convert.ToInt32(peakConnLn); - this._peakConnSf = System.Convert.ToInt32(peakConnSf); + this.PeakBeam = peakBeam; + this.PeakColumn = peakColumn; + this.PeakTruss = peakTruss; + this.PeakFicBeam = peakficBeam; + this.PeakPlate = peakPlate; + this.PeakWall = peakWall; + this.PeakFicShell = peakFicShell; + this.PeakSuppPt = peakSuppPt; + this.PeakSuppLn = peakSuppLn; + this.PeakSuppSf = peakSuppSf; + this.PeakConnPt = peakConnPt; + this.PeakConnLn = peakConnLn; + this.PeakConnSf = peakConnSf; this.PeakFactor = peakFactor; } @@ -446,10 +924,17 @@ public static PeaksmAuto Default() } } - public partial class SoilCalculation + public partial class SoilCalculation : GlobConfig { [XmlAttribute("fSoilAsSolid")] - public int _soilAsSolid { get; set; } + public int _soilAsSolid; + + [XmlIgnore] + public bool SoilAsSolid + { + get => Convert.ToBoolean(_soilAsSolid); + set => _soilAsSolid = Convert.ToInt32(value); + } /// /// Parameterless constructor for serialization. @@ -461,7 +946,7 @@ private SoilCalculation() public SoilCalculation(bool soilAsSolid = true) { - this._soilAsSolid = System.Convert.ToInt32(soilAsSolid); + this.SoilAsSolid = soilAsSolid; } public static SoilCalculation Default() @@ -470,4 +955,14 @@ public static SoilCalculation Default() } } + /// + /// Base class for all GlobalConfigs that can be use for CmdGlobalCfg + /// + public abstract class GlobConfig + { + public override string ToString() + { + return Results.ResultsReader.ObjectRepresentation(this); + } + } } diff --git a/FemDesign.Core/FemDesignConnection.cs b/FemDesign.Core/FemDesignConnection.cs index 1545dbe38..6e1ea00fe 100644 --- a/FemDesign.Core/FemDesignConnection.cs +++ b/FemDesign.Core/FemDesignConnection.cs @@ -262,6 +262,16 @@ public void SetGlobalConfig(Calculate.CmdGlobalCfg cmdglobalconfig) this.RunScript(script, "SetGlobalConfig"); } + /// + /// Set global settings for a FEM-Design model. + /// + /// Can be any type of configuration from CmdGlobalCfg (e.g. MeshGeneral, MeshSettings, Meshfunctions, etc.). See the properties of Calculate.CmdGlobalCfg class. + public void SetGlobalConfig(params Calculate.GlobConfig[] globConfig) + { + var cmd = new CmdGlobalCfg(globConfig); + this.SetGlobalConfig(cmd); + } + /// /// Set global settings for a FEM-Design model using a global configuration file. /// diff --git a/FemDesign.Core/GenericClasses/RestrictedDouble.cs b/FemDesign.Core/GenericClasses/RestrictedDouble.cs index d2ddfecb7..cc9da2a32 100644 --- a/FemDesign.Core/GenericClasses/RestrictedDouble.cs +++ b/FemDesign.Core/GenericClasses/RestrictedDouble.cs @@ -119,6 +119,14 @@ internal static double NonNegMax_1(double val) return RestrictedDouble.ValueInClosedInterval(val, 0, 1); } + /// + /// non_neg_max_5 + /// + internal static double NonNegMax_5(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 0, 5); + } + /// /// non_neg_max_10 /// @@ -144,13 +152,21 @@ internal static double NonZeroMax_10_2(double val) } /// - /// non_neg_max_10 + /// non_neg_max_20 /// internal static double NonNegMax_20(double val) { return RestrictedDouble.ValueInClosedInterval(val, 0, 20); } + /// + /// non_neg_max_90 + /// + internal static double NonNegMax_90(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 0, 90); + } + /// /// non_neg_max_100 /// @@ -247,6 +263,22 @@ internal static double NonZeroMax_1e30(double val) return RestrictedDouble.ValueInClosedInterval(val, 1E-5, 1E30); } + /// + /// Check if val in range [90.0, 180.0] + /// + internal static double MeshMaxAngle(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 90, 180); + } + + /// + /// Check if val in range [2.0, 500.0] + /// + internal static double MeshMaxRatio(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 2, 500); + } + /// /// material_base_value /// diff --git a/FemDesign.Core/GenericClasses/RestrictedInteger.cs b/FemDesign.Core/GenericClasses/RestrictedInteger.cs index 222d72ad9..f0a3a0b94 100644 --- a/FemDesign.Core/GenericClasses/RestrictedInteger.cs +++ b/FemDesign.Core/GenericClasses/RestrictedInteger.cs @@ -18,10 +18,26 @@ internal static int ValueInRange(int val, int min, int max) } else { - throw new System.ArgumentOutOfRangeException($"Value should be between {min} and {max}"); + throw new System.ArgumentOutOfRangeException($"Value should be between or equal to {min} and {max}"); } } + /// + /// Check if val in range [1, 250] + /// + internal static int DefaultBarElemDiv(int val) + { + return RestrictedInteger.ValueInRange(val, 1, 250); + } + + /// + /// Check if val in range [1, 50] + /// + internal static int MeshSmoothSteps(int val) + { + return RestrictedInteger.ValueInRange(val, 1, 50); + } + /// /// timber_service_class /// diff --git a/FemDesign.Grasshopper/Calculate/ConcreteDesignConfig.cs b/FemDesign.Grasshopper/Calculate/Configurations/Configs/ConcreteDesignConfig.cs similarity index 100% rename from FemDesign.Grasshopper/Calculate/ConcreteDesignConfig.cs rename to FemDesign.Grasshopper/Calculate/Configurations/Configs/ConcreteDesignConfig.cs diff --git a/FemDesign.Grasshopper/Calculate/Configs.cs b/FemDesign.Grasshopper/Calculate/Configurations/Configs/Configs.cs similarity index 97% rename from FemDesign.Grasshopper/Calculate/Configs.cs rename to FemDesign.Grasshopper/Calculate/Configurations/Configs/Configs.cs index 70270dcf8..acaa45f3b 100644 --- a/FemDesign.Grasshopper/Calculate/Configs.cs +++ b/FemDesign.Grasshopper/Calculate/Configurations/Configs/Configs.cs @@ -28,7 +28,7 @@ public class Configs : GH_SwitcherComponent protected override Bitmap Icon => FemDesign.Properties.Resources.Config; public Configs() - : base("Config", "Config", + : base("Config", "Configuration", "Calculation and design configurations", CategoryName.Name(), SubCategoryName.Cat7a()) { @@ -41,7 +41,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) protected override void RegisterOutputParams(GH_OutputParamManager pManager) { - pManager.RegisterParam(new Param_GenericObject(), "Config", "Config", "Config"); + pManager.RegisterParam(new Param_GenericObject(), "Config", "Configuration", "Configurations."); } protected override void RegisterEvaluationUnits(EvaluationUnitManager mngr) diff --git a/FemDesign.Grasshopper/Calculate/SteelBarCalculationParameters.cs b/FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelBarCalculationParameters.cs similarity index 100% rename from FemDesign.Grasshopper/Calculate/SteelBarCalculationParameters.cs rename to FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelBarCalculationParameters.cs diff --git a/FemDesign.Grasshopper/Calculate/SteelBarDesignParameters.cs b/FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelBarDesignParameters.cs similarity index 100% rename from FemDesign.Grasshopper/Calculate/SteelBarDesignParameters.cs rename to FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelBarDesignParameters.cs diff --git a/FemDesign.Grasshopper/Calculate/SteelDesignConfiguration.cs b/FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelDesignConfiguration.cs similarity index 100% rename from FemDesign.Grasshopper/Calculate/SteelDesignConfiguration.cs rename to FemDesign.Grasshopper/Calculate/Configurations/Configs/SteelDesignConfiguration.cs diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/GlobalConfigs.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/GlobalConfigs.cs new file mode 100644 index 000000000..76c4fb7df --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/GlobalConfigs.cs @@ -0,0 +1,124 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Rhino.Geometry; +using FemDesign.Grasshopper; +using System.Windows.Forms; +using FemDesign.Grasshopper.Extension.ComponentExtension; +using FemDesign.Loads; +using Grasshopper.Kernel.Special; + +namespace FemDesign.Grasshopper +{ + public class GlobalConfigs : GH_SwitcherComponent + { + private List _subcomponents = new List(); + public override string UnitMenuName => "GlobalConfigs"; + protected override string DefaultEvaluationUnit => _subcomponents[1].name(); + public override Guid ComponentGuid => new Guid("{41175D83-48B2-4614-A074-DC8BE7F71CAC}"); + public override GH_Exposure Exposure => GH_Exposure.quinary; + + protected override Bitmap Icon => FemDesign.Properties.Resources.Config; + + public GlobalConfigs() + : base("GlobConfig", "GlobalConfigurations", + "General calculation settings for a FEM-Design model.", + CategoryName.Name(), SubCategoryName.Cat7a()) + { + ((GH_Component)this).Hidden = true; + } + + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.RegisterParam(new Param_GenericObject(), "GlobConfig", "GlobalConfiguration", "Global configurations."); + } + + protected override void RegisterEvaluationUnits(EvaluationUnitManager mngr) + { + //_subcomponents.Add(new SoilCalculationSettings()); + _subcomponents.Add(new MeshGeneralSettings()); + _subcomponents.Add(new MeshElementSettings()); + _subcomponents.Add(new MeshFunctionSettings()); + _subcomponents.Add(new MeshPrepareSettings()); + _subcomponents.Add(new PeakSmMethodSettings()); + _subcomponents.Add(new PeakSmAutoSettings()); + + foreach (SubComponent item in _subcomponents) + { + item.registerEvaluationUnits(mngr); + } + } + + protected override void OnComponentLoaded() + { + base.OnComponentLoaded(); + foreach (SubComponent item in _subcomponents) + { + item.OnComponentLoaded(); + } + } + + protected override void SolveInstance(IGH_DataAccess DA, EvaluationUnit unit) + { + if (unit == null) + { + return; + } + foreach (SubComponent item in _subcomponents) + { + if (unit.Name.Equals(item.name())) + { + item.SolveInstance(DA, out var msg, out var level); + if (msg != "") + { + ((GH_ActiveObject)this).AddRuntimeMessage(level, msg); + } + return; + } + } + throw new Exception("Invalid sub-component"); + } + // Part of the code that allows to extend the menu with additional items + // Right click on the component to see the options + public override void AppendAdditionalMenuItems(ToolStripDropDown menu) + { + base.AppendAdditionalMenuItems(menu); + if (evalUnits.Units.Count > 0) + { + Menu_AppendSeparator(menu); + ToolStripMenuItem toolStripMenuItem = Menu_AppendItem(menu, "GlobConfigs"); + foreach (EvaluationUnit unit in evalUnits.Units) + { + Menu_AppendItem(toolStripMenuItem.DropDown, unit.Name, Menu_ActivateUnit, null, true, unit.Active).Tag = unit; + } + Menu_AppendSeparator(menu); + } + } + private void Menu_ActivateUnit(object sender, EventArgs e) + { + try + { + EvaluationUnit evaluationUnit = (EvaluationUnit)((ToolStripMenuItem)sender).Tag; + if (evaluationUnit != null) + { + SwitchUnit(evaluationUnit); + } + } + catch (Exception ex) + { + throw ex; + } + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshElementSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshElementSettings.cs new file mode 100644 index 000000000..88987893f --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshElementSettings.cs @@ -0,0 +1,80 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + + +namespace FemDesign.Grasshopper +{ + public class MeshElementSettings : SubComponent + { + public override string name() => "MeshElementSettings"; + public override string display_name() => "MeshElementSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Finite element mesh elements settings. For more details, see the FEM-Design GUI > Settings > Calculation > Mesh."); + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Number(), "Scale", "Scale", "Scale.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Correct", "Correct", "Correct according to the minimum division numbers.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "RegionByRegion", "RegionByRegion", "Region by region.\nDefault is True. If false, the `Consider all regions together` option is set.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Integer(), "MinDivNumber", "MinDivNumber", "Lowest minimum division number.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Number(), "MaxCentralAngle", "MaxCentralAngle", "Maximal central angle for arcs.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + + GH_ExtendableMenu gH_ExtendableMenu0 = new GH_ExtendableMenu(0, ""); + gH_ExtendableMenu0.Name = "Calculated average element size"; + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[0]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[1]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[2]); + evaluationUnit.AddMenu(gH_ExtendableMenu0); + + + GH_ExtendableMenu gH_ExtendableMenu1 = new GH_ExtendableMenu(1, ""); + gH_ExtendableMenu1.Name = "Bar element"; + gH_ExtendableMenu1.Expand(); + gH_ExtendableMenu1.RegisterInputPlug(evaluationUnit.Inputs[3]); + gH_ExtendableMenu1.RegisterInputPlug(evaluationUnit.Inputs[4]); + evaluationUnit.AddMenu(gH_ExtendableMenu1); + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + double scale = 6.0; + DA.GetData(0, ref scale); + + bool correct = true; + DA.GetData(1, ref correct); + + bool regByReg = true; + DA.GetData(2, ref regByReg); + + int minDiv = 2; + DA.GetData(3, ref minDiv); + + double angle = 10.00; + DA.GetData(4, ref angle); + + var meshElem = new Calculate.MeshElements(regByReg, scale, correct, minDiv, angle); + DA.SetData(0, meshElem); + } + + protected void setModelProps() + { + this.Parent_Component.ExpireSolution(true); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshFunctionSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshFunctionSettings.cs new file mode 100644 index 000000000..02563f7c2 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshFunctionSettings.cs @@ -0,0 +1,124 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + + +namespace FemDesign.Grasshopper +{ + public class MeshFunctionSettings : SubComponent + { + public override string name() => "MeshFunctionSettings"; + public override string display_name() => "MeshFunctionSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Finite element mesh functions settings. For more details, see the FEM-Design GUI > Settings > Calculation > Mesh."); + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "RefineLocally", "RefineLocally", "Refine locally where needed.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Integer(), "MaxStep", "MaxStep", "Max. step.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Warn", "Warn", "Warn about reaching max. step.\nDefault is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "ReduceElementSize", "ReduceElementSize", "Reduce average element size if neccessary.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Integer(), "Steps", "Steps", "Steps.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Geometry", "Geometry", "Geometry.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Number(), "MinAngle", "MinAngle", "Min. angle. [°]", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Number(), "MaxAngle", "MaxAngle", "Max. angle. [°]", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Number(), "MaxSideRatio", "MaxSideRatio", "Max. side ratio", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Overlap&Cut", "Overlap&Cut", "Overlap & cut.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Topology&Gap", "Topology&Gap", "Topology & gap.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + + GH_ExtendableMenu gH_ExtendableMenu0 = new GH_ExtendableMenu(0, ""); + gH_ExtendableMenu0.Name = "Generate surface mesh"; + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[0]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[1]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[2]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[3]); + evaluationUnit.AddMenu(gH_ExtendableMenu0); + + GH_ExtendableMenu gH_ExtendableMenu1 = new GH_ExtendableMenu(1, ""); + gH_ExtendableMenu1.Name = "Smooth mesh"; + gH_ExtendableMenu1.RegisterInputPlug(evaluationUnit.Inputs[4]); + evaluationUnit.AddMenu(gH_ExtendableMenu1); + + GH_ExtendableMenu gH_ExtendableMenu2 = new GH_ExtendableMenu(2, ""); + gH_ExtendableMenu2.Name = "Check mesh"; + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[5]); + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[6]); + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[7]); + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[8]); + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[9]); + gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[10]); + evaluationUnit.AddMenu(gH_ExtendableMenu2); + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + bool refine = true; + DA.GetData(0, ref refine); + + int maxStep = 5; + DA.GetData(1, ref maxStep); + + bool warn = false; + DA.GetData(2, ref warn); + + bool reduce = true; + DA.GetData(3, ref reduce); + + int steps = 3; + DA.GetData(4, ref steps); + + bool geometry = true; + DA.GetData(5, ref geometry); + + double minAngle = 5.0; + DA.GetData(6, ref minAngle); + + double maxAngle = 175.0; + DA.GetData(7, ref maxAngle); + + double ratio = 16.0; + DA.GetData(8, ref ratio); + + bool overlap = true; + DA.GetData(9, ref overlap); + + bool topology = true; + DA.GetData(10, ref topology); + + var meshFunc = new Calculate.MeshFunctions(refine, maxStep, warn, reduce, steps, geometry, minAngle, maxAngle, ratio, overlap, topology); + DA.SetData(0, meshFunc); + } + + protected void setModelProps() + { + this.Parent_Component.ExpireSolution(true); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshGeneralSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshGeneralSettings.cs new file mode 100644 index 000000000..2d4fdd1a9 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshGeneralSettings.cs @@ -0,0 +1,36 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + +namespace FemDesign.Grasshopper +{ + public class MeshGeneralSettings : SubComponent + { + public override string name() => "MeshGeneralSettings"; + public override string display_name() => "MeshGeneralSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Finite element mesh general settings. For more details, see the FEM-Design GUI > Settings > Calculation > Mesh."); + evaluationUnit.Icon = FemDesign.Properties.Resources.Config; + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "AdjustMeshToLoads", "AdjustMeshToLoads", "Adjust mesh to load positions.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + bool adjust = true; + DA.GetData(0, ref adjust); + + var meshGen = new Calculate.MeshGeneral(adjust); + + DA.SetData(0, meshGen); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshPrepareSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshPrepareSettings.cs new file mode 100644 index 000000000..6b5291305 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/MeshPrepareSettings.cs @@ -0,0 +1,199 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + + +namespace FemDesign.Grasshopper +{ + public class MeshPrepareSettings : SubComponent + { + public override string name() => "MeshPrepareSettings"; + public override string display_name() => "MeshPrepareSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Finite element mesh preparation settings. For more details, see the FEM-Design GUI > Settings > Calculation > Mesh."); + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "CheckMesh", "CheckMesh", "Default is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "AutoregenerateMesh", "AutoregenerateMesh", "Regenerate mesh automatically on the changed objects.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "OptimalRebuild", "OptimalRebuild", "Optimal rebuild surface mesh after refine.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SmoothMesh", "SmoothMesh", "Smooth mesh after optimal rebuild.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PeakSmoothing", "PeakSmoothing", "Default is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Beams", "Beams", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Columns", "Columns", "Default is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Trusses", "Trusses", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FictitiousBars", "FictitiousBars", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FreeEdges", "FreeEdges", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "RegionBorders", "RegionBorders", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PointSupports", "PointSupports", "Default is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "LineSupports", "LineSupports", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SurfaceSupportEdges", "SurfaceSupportEdges", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "EdgeConnections", "EdgeConnections", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PointConnections", "PointConnections", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "LineConnections", "LineConnections", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SurfaceConnectionEdges", "SurfaceConnectionEdges", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PointLoads", "PointLoads", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "LineLoads", "LineLoads", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SurfaceLoadEdges", "SurfaceLoadEdges", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FixedPoints", "FixedPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FixedLines", "FixedLines", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + + GH_ExtendableMenu gH_ExtendableMenu0 = new GH_ExtendableMenu(0, ""); + gH_ExtendableMenu0.Name = "Refine mesh after regenerate around..."; + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[4]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[5]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[6]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[7]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[8]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[9]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[10]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[11]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[12]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[13]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[14]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[15]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[16]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[17]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[18]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[19]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[20]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[21]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[22]); + evaluationUnit.AddMenu(gH_ExtendableMenu0); + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + bool autoCheck = true; + DA.GetData(0, ref autoCheck); + + bool autoRegen = true; + DA.GetData(1, ref autoRegen); + + bool autoRebuild = true; + DA.GetData(2, ref autoRebuild); + + bool autoSmooth = true; + DA.GetData(3, ref autoSmooth); + + bool peakSmth = true; + DA.GetData(4, ref peakSmth); + + bool beams = false; + DA.GetData(5, ref beams); + + bool columns = true; + DA.GetData(6, ref columns); + + bool trusses = false; + DA.GetData(7, ref trusses); + + bool fictBars = false; + DA.GetData(8, ref fictBars); + + bool freeEdges= false; + DA.GetData(9, ref freeEdges); + + bool regionBorders = false; + DA.GetData(10, ref regionBorders); + + bool ptSupp = true; + DA.GetData(11, ref ptSupp); + + bool LnSupp = false; + DA.GetData(12, ref LnSupp); + + bool SrfSuppEdges = false; + DA.GetData(13, ref SrfSuppEdges); + + bool EdgeConn = false; + DA.GetData(14, ref EdgeConn); + + bool PtConn = false; + DA.GetData(15, ref PtConn); + + bool LnConn = false; + DA.GetData(16, ref LnConn); + + bool SrfConnEdges = false; + DA.GetData(17, ref SrfConnEdges); + + bool PtLoads = false; + DA.GetData(18, ref PtLoads); + + bool LnLoads = false; + DA.GetData(19, ref LnLoads); + + bool SrfLoadEdges = false; + DA.GetData(20, ref SrfLoadEdges); + + bool FixedPts = false; + DA.GetData(21, ref FixedPts); + + bool FixedLns = false; + DA.GetData(22, ref FixedLns); + + + + var meshFunc = new Calculate.MeshPrepare(autoRegen, peakSmth, beams, columns, trusses, fictBars, freeEdges, regionBorders, ptSupp, LnSupp, + SrfSuppEdges, EdgeConn, PtConn, LnConn, SrfConnEdges, PtLoads, LnLoads, SrfLoadEdges, FixedPts, FixedLns, autoRebuild, autoSmooth, autoCheck); + DA.SetData(0, meshFunc); + } + + protected void setModelProps() + { + this.Parent_Component.ExpireSolution(true); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmAutoSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmAutoSettings.cs new file mode 100644 index 000000000..178b5dfa5 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmAutoSettings.cs @@ -0,0 +1,133 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + +namespace FemDesign.Grasshopper +{ + public class PeakSmAutoSettings : SubComponent + { + public override string name() => "PeakSmoothingAutoSettings"; + public override string display_name() => "PeakSmoothingAutoSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Auto peak smoothing region around the specified objects. For more details, see the FEM-Design GUI > Settings > Calculation > Peak smoothing."); + evaluationUnit.Icon = FemDesign.Properties.Resources.Config; + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Number(), "Factor", "Factor", "Peak smoothing region factor.\n\nr = t/2 + f*v\n" + + "Where:\n'r' is the distance between the axis of the pile and the edge of the pk. smoothing region projected onto the mid-plane of the slab;" + + "\n't' is the thickness of the pile head;\n'v' is the slab thickness;\n'f' value can be set between 0.00 and 5.00;\nFor more details, see the FEM-Design GUI.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "BeamEndPoints", "BeamEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "ColumnEndPoints", "ColumnEndPoints", "Pile head.\nDefault is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "TrussEndPoints", "TrussEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FictitiousBarEndPoints", "FictitiousBarEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PlateIntersectionEndPoints", "PlateIntersectionEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "WallIntersectionEndPoints", "WallIntersectionEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "FictShellIntersectionEndPoints", "FictShellIntersectionEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PointSupports", "PointSupports", "Default is True.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "LineSupportEndPoints", "LineSupportEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SurfaceSupportBreakPoints", "SurfaceSupportBreakPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "PointConnections", "PointConnections", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "LineConnectionEndPoints", "LineConnectionEndPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "SurfaceConnectionBreakPoints", "SurfaceConnectionBreakPoints", "Default is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + + GH_ExtendableMenu gH_ExtendableMenu0 = new GH_ExtendableMenu(0, ""); + gH_ExtendableMenu0.Name = "Auto peak smoothing region around..."; + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[1]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[2]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[3]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[4]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[5]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[6]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[7]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[8]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[9]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[10]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[11]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[12]); + gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[13]); + evaluationUnit.AddMenu(gH_ExtendableMenu0); + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + double factor = 0.5; + DA.GetData(0, ref factor); + + bool beam = false; + DA.GetData(1, ref beam); + + bool pile = true; + DA.GetData(2, ref pile); + + bool truss = false; + DA.GetData(3, ref truss); + + bool fictBar = false; + DA.GetData(4, ref fictBar); + + bool plateIntsec = false; + DA.GetData(5, ref plateIntsec); + + bool wallIntsec = false; + DA.GetData(6, ref wallIntsec); + + bool fictShell = false; + DA.GetData(7, ref fictShell); + + bool ptSupp = true; + DA.GetData(8, ref ptSupp); + + bool lnSupp = false; + DA.GetData(9, ref lnSupp); + + bool srfSupp = false; + DA.GetData(10, ref srfSupp); + + bool ptConn = false; + DA.GetData(11, ref ptConn); + + bool lnConn = false; + DA.GetData(12, ref lnConn); + + bool srfConn = false; + DA.GetData(13, ref srfConn); + + var autoPkSm = new Calculate.PeaksmAuto(beam, pile, truss, fictBar, plateIntsec, wallIntsec, fictShell, ptSupp, lnSupp, srfSupp, ptConn, lnConn, srfConn, factor); + + DA.SetData(0, autoPkSm); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmMethodSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmMethodSettings.cs new file mode 100644 index 000000000..e182cba14 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/PeakSmMethodSettings.cs @@ -0,0 +1,60 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; +using System; +using System.Linq; +using FemDesign.Calculate; + +namespace FemDesign.Grasshopper +{ + public class PeakSmMethodSettings : SubComponent + { + public override string name() => "PeakSmoothingMethodSettings"; + public override string display_name() => "PeakSmoothingMethodSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Peak smoothing method settings. For more details, see the FEM-Design GUI > Settings > Calculation > Peak smoothing."); + evaluationUnit.Icon = FemDesign.Properties.Resources.Config; + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_String(), "M", "M", "Mx', My' and Mx'y'.\n\nConnect 'ValueList' to get the options:\nDontSmooth\nHigherOrderShapeFunc\nConstShapeFunc\nSetToZero", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].EnumInput = Enum.GetNames(typeof(PeaksmMethod.PeaksmMethodOptions)).ToList(); + + evaluationUnit.RegisterInputParam(new Param_String(), "N", "N", "Nx', Ny' and Nx'y'.\n\nConnect 'ValueList' to get the options:\nDontSmooth\nHigherOrderShapeFunc\nConstShapeFunc\nSetToZero", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].EnumInput = Enum.GetNames(typeof(PeaksmMethod.PeaksmMethodOptions)).ToList(); + + evaluationUnit.RegisterInputParam(new Param_String(), "V", "V", "Vx', Vy' and Vx'y'.\n\nConnect 'ValueList' to get the options:\nDontSmooth\nHigherOrderShapeFunc\nConstShapeFunc\nSetToZero", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].EnumInput = Enum.GetNames(typeof(PeaksmMethod.PeaksmMethodOptions)).ToList(); + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + string _moment = "HigherOrderShapeFunc"; + DA.GetData(0, ref _moment); + + var moment = GenericClasses.EnumParser.Parse(_moment); + + string _normal = "HigherOrderShapeFunc"; + DA.GetData(1, ref _normal); + + var normal = GenericClasses.EnumParser.Parse(_normal); + + string _shear = "HigherOrderShapeFunc"; + DA.GetData(2, ref _shear); + + var shear = GenericClasses.EnumParser.Parse(_shear); + + var pkSmMethod = new Calculate.PeaksmMethod(moment, normal, shear); + + DA.SetData(0, pkSmMethod); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/SoilCalculationSettings.cs b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/SoilCalculationSettings.cs new file mode 100644 index 000000000..afbd0fc19 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/Configurations/GlobalConfigs/SoilCalculationSettings.cs @@ -0,0 +1,36 @@ +using Grasshopper.Kernel; +using Grasshopper.Kernel.Parameters; +using Grasshopper.Kernel.Types; +using FemDesign.Grasshopper.Components.UIWidgets; + +namespace FemDesign.Grasshopper +{ + public class SoilCalculationSettings : SubComponent + { + public override string name() => "SoilCalculationSettings"; + public override string display_name() => "SoilCalculationSettings"; + + public override void registerEvaluationUnits(EvaluationUnitManager mngr) + { + EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "For more details, see the FEM-Design GUI > Settings > Calculation > Soil calculation."); + evaluationUnit.Icon = FemDesign.Properties.Resources.Config; + mngr.RegisterUnit(evaluationUnit); + + evaluationUnit.RegisterInputParam(new Param_Boolean(), "Calc. as solid", "Calc. as solid", "Calculate soil as solid element.\nDefault is False.", GH_ParamAccess.item); + evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true; + } + + public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) + { + msg = ""; + level = GH_RuntimeMessageLevel.Warning; + + bool solid = false; + DA.GetData(0, ref solid); + + var soilCalc = new Calculate.SoilCalculation(solid); + + DA.SetData(0, soilCalc); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj index 41fd44a91..0195166e1 100644 --- a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj +++ b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj @@ -72,9 +72,19 @@ + + + + + + + + + + + - - + @@ -85,9 +95,7 @@ - - - + @@ -201,6 +209,7 @@ + diff --git a/FemDesign.Grasshopper/Pipe/OBSOLETE/PipeSetGlobalCfg_OBSOLETE2306.cs b/FemDesign.Grasshopper/Pipe/OBSOLETE/PipeSetGlobalCfg_OBSOLETE2306.cs new file mode 100644 index 000000000..bc942d72a --- /dev/null +++ b/FemDesign.Grasshopper/Pipe/OBSOLETE/PipeSetGlobalCfg_OBSOLETE2306.cs @@ -0,0 +1,111 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper; +using Grasshopper.Kernel; +using Grasshopper.Kernel.Data; +using System.Linq; +using System.Windows.Forms; +using FemDesign.Grasshopper.Extension.ComponentExtension; +using GrasshopperAsyncComponent; +using System.Reflection; + +namespace FemDesign.Grasshopper +{ + public class PipeSetGlobalCfg_OBSOLETE2306 : GH_AsyncComponent + { + public PipeSetGlobalCfg_OBSOLETE2306() : base("FEM-Design.SetGlobalConfigurations", "SetGlobalCfg", "Set global settings for a FEM-Design model using a global configuration file. It defines the calculation settings that will instruct FEM-Design in operation like creating the finite element mesh.", CategoryName.Name(), SubCategoryName.Cat8()) + { + BaseWorker = new ApplicationSetGlobalCfg_OBSOLETE2306Worker(this); + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("Connection", "Connection", "FEM-Design connection.", GH_ParamAccess.item); + pManager.AddTextParameter("GlobalCfg", "GlobalCfg", "Filepath of the global configuration file. If file path is not provided, the component will read the cmdglobalcfg.xml file in the package manager library folder.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", 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; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Connection", "Connection", "FEM-Design connection.", GH_ParamAccess.item); + pManager.AddBooleanParameter("Success", "Success", "True if session has exited. False if session is open or was closed manually.", GH_ParamAccess.item); + } + + protected override System.Drawing.Bitmap Icon => FemDesign.Properties.Resources.FEM_Config; + public override Guid ComponentGuid => new Guid("{58B5D154-A7AB-4D05-878D-010BF05EA7D6}"); + public override GH_Exposure Exposure => GH_Exposure.hidden; + } + + public class ApplicationSetGlobalCfg_OBSOLETE2306Worker : WorkerInstance + { + /* INPUT/OUTPUT */ + private FemDesignConnection _connection = null; + private string _globalCfgPath = null; + private bool _runNode = true; + private bool _success = false; + + public ApplicationSetGlobalCfg_OBSOLETE2306Worker(GH_Component component) : base(component) { } + + + public override void DoWork(Action ReportProgress, Action Done) + { + if (_runNode == false) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Run node set to false."); + ReportProgress(Id, 0.0.ToString()); + return; + } + + if (_connection == null) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Connection is null."); + return; + } + + if (_connection.IsDisconnected) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Connection to FEM-Design have been lost."); + return; + } + + if (_connection.HasExited) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "FEM-Design have been closed."); + return; + } + + // Run the Analysis + + if (_globalCfgPath == null) + { + string assemblyLocation = Assembly.GetExecutingAssembly().Location; + _globalCfgPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(assemblyLocation), @"cmdglobalcfg.xml"); + } + + _connection.SetGlobalConfig(_globalCfgPath); + _success = true; + + Done(); + } + + public override WorkerInstance Duplicate() => new ApplicationSetGlobalCfg_OBSOLETE2306Worker(Parent); + + public override void GetData(IGH_DataAccess DA, GH_ComponentParamServer Params) + { + if (!DA.GetData("Connection", ref _connection)) return; + DA.GetData("GlobalCfg", ref _globalCfgPath); + DA.GetData("RunNode", ref _runNode); + } + + public override void SetData(IGH_DataAccess DA) + { + DA.SetData("Connection", _connection); + DA.SetData("Success", _success); + } + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Pipe/PipeSetCfg.cs b/FemDesign.Grasshopper/Pipe/PipeSetCfg.cs index 1a9db0923..74352a15e 100644 --- a/FemDesign.Grasshopper/Pipe/PipeSetCfg.cs +++ b/FemDesign.Grasshopper/Pipe/PipeSetCfg.cs @@ -22,7 +22,7 @@ public class PipeSetCfg : GH_AsyncComponent protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddGenericParameter("Connection", "Connection", "FEM-Design connection.", GH_ParamAccess.item); - pManager.AddGenericParameter("Cfg", "Cfg", "Filepath of the configuration file or Config objects.\nIf file path is not provided, the component will read the cfg.xml file in the package manager library folder.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.list); + pManager.AddGenericParameter("Config", "Cfg", "Filepath of the configuration file or Config objects.\nIf file path is not provided, the component will read the cfg.xml file in the package manager library folder.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.list); 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; @@ -42,9 +42,9 @@ public class ApplicationSetCfgWorker : WorkerInstance { /* INPUT/OUTPUT */ private FemDesignConnection _connection = null; + private List _cfg = new List(); private bool _runNode = true; private bool _success = false; - private List _cfg = new List(); public ApplicationSetCfgWorker(GH_Component component) : base(component) { } @@ -115,7 +115,7 @@ public override void DoWork(Action ReportProgress, Action Done) public override void GetData(IGH_DataAccess DA, GH_ComponentParamServer Params) { if (!DA.GetData("Connection", ref _connection)) return; - DA.GetDataList("Cfg", _cfg); + DA.GetDataList("Config", _cfg); DA.GetData("RunNode", ref _runNode); } diff --git a/FemDesign.Grasshopper/Pipe/PipeSetGlobalCfg.cs b/FemDesign.Grasshopper/Pipe/PipeSetGlobalCfg.cs index 49615d884..73c36df67 100644 --- a/FemDesign.Grasshopper/Pipe/PipeSetGlobalCfg.cs +++ b/FemDesign.Grasshopper/Pipe/PipeSetGlobalCfg.cs @@ -21,7 +21,7 @@ public class PipeSetGlobalCfg : GH_AsyncComponent protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddGenericParameter("Connection", "Connection", "FEM-Design connection.", GH_ParamAccess.item); - pManager.AddTextParameter("GlobalCfg", "GlobalCfg", "Filepath of the global configuration file. If file path is not provided, the component will read the cmdglobalcfg.xml file in the package manager library folder.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.item); + pManager.AddGenericParameter("GlobalConfig", "GlobCfg", "Filepath of the global configuration file or GlobConfig objects.\nIf file path is not provided, the component will read the cmdglobalcfg.xml file in the package manager library folder.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.list); 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; @@ -33,7 +33,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override System.Drawing.Bitmap Icon => FemDesign.Properties.Resources.FEM_Config; - public override Guid ComponentGuid => new Guid("{58B5D154-A7AB-4D05-878D-010BF05EA7D6}"); + public override Guid ComponentGuid => new Guid("{FDEDD8F7-99CC-48F0-8FF8-2946921DC9F6}"); public override GH_Exposure Exposure => GH_Exposure.obscure; } @@ -41,7 +41,7 @@ public class ApplicationSetGlobalCfgWorker : WorkerInstance { /* INPUT/OUTPUT */ private FemDesignConnection _connection = null; - private string _globalCfgPath = null; + private List _globCfg = new List(); private bool _runNode = true; private bool _success = false; @@ -50,46 +50,72 @@ public ApplicationSetGlobalCfgWorker(GH_Component component) : base(component) { public override void DoWork(Action ReportProgress, Action Done) { - if (_runNode == false) + try { - _success = false; - Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Run node set to false."); - ReportProgress(Id, 0.0.ToString()); - return; - } - - if (_connection == null) - { - _success = false; - Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Connection is null."); - return; - } - - if (_connection.IsDisconnected) - { - _success = false; - Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Connection to FEM-Design have been lost."); - return; + if (_runNode == false) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Run node set to false."); + ReportProgress(Id, 0.0.ToString()); + return; + } + + if (_connection == null) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Connection is null."); + return; + } + + if (_connection.IsDisconnected) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Connection to FEM-Design have been lost."); + return; + } + + if (_connection.HasExited) + { + _success = false; + Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "FEM-Design have been closed."); + return; + } + + + // Run the Analysis + + if (_globCfg.Count == 0) + { + string assemblyLocation = Assembly.GetExecutingAssembly().Location; + var _globCfgfilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(assemblyLocation), @"cmdglobalcfg.xml"); + _connection.SetConfig(_globCfgfilePath); + } + else + { + foreach (var config in _globCfg) + { + // Check if the value is a string + if (config.Value is string filePath) + { + _connection.SetGlobalConfig(filePath); + } + // Check if the value is of type FemDesign.Calculate.CONFIG + else if (config.Value is FemDesign.Calculate.GlobConfig globConfig) + { + _connection.SetGlobalConfig(globConfig); + } + } + } + + _success = true; } - - if (_connection.HasExited) + catch (Exception ex) { + RuntimeMessages.Add((GH_RuntimeMessageLevel.Error, ex.Message)); _success = false; - Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "FEM-Design have been closed."); - return; - } - - // Run the Analysis - - if (_globalCfgPath == null) - { - string assemblyLocation = Assembly.GetExecutingAssembly().Location; - _globalCfgPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(assemblyLocation), @"cmdglobalcfg.xml"); + _connection = null; } - _connection.SetGlobalConfig(_globalCfgPath); - _success = true; - Done(); } @@ -98,12 +124,17 @@ public override void DoWork(Action ReportProgress, Action Done) public override void GetData(IGH_DataAccess DA, GH_ComponentParamServer Params) { if (!DA.GetData("Connection", ref _connection)) return; - DA.GetData("GlobalCfg", ref _globalCfgPath); + DA.GetDataList("GlobalConfig", _globCfg); DA.GetData("RunNode", ref _runNode); } public override void SetData(IGH_DataAccess DA) { + foreach (var (level, message) in RuntimeMessages) + { + Parent.AddRuntimeMessage(level, message); + } + DA.SetData("Connection", _connection); DA.SetData("Success", _success); }