From 65217a46a4092b69c5fc918772ab59239e8397f9 Mon Sep 17 00:00:00 2001 From: lorinczandrea Date: Fri, 20 Oct 2023 15:46:06 +0200 Subject: [PATCH 1/3] waiting for test #870 --- .../TopBotLocValDeconstruct_OBSOLETE2209.cs} | 5 +- .../FemDesign.Grasshopper.csproj | 57 ++++----- .../{ => Load cases}/LoadCaseConstruct.cs | 0 .../LoadCaseGetLoadCaseByName.cs | 0 .../LoadCategoryConstruct.cs | 0 .../LoadCategoryDatabaseDefault.cs | 0 ...adCategoryDatabaseListLoadCategoryNames.cs | 0 .../LoadCategoryGetLoadCatergoryByName.cs | 0 .../LoadCombinationConstruct.cs | 0 .../LoadCombinationSetupCalculation.cs | 0 .../{ => Load groups}/LoadGroupConstruct.cs | 0 .../{ => Load groups}/LoadGroupToLoadComb.cs | 0 .../{ => Loads}/FootfallFullExcitation.cs | 0 .../{ => Loads}/FootfallSelfExcitation.cs | 0 .../Loads/{ => Loads}/LineLoadDefine.cs | 0 .../Loads/{ => Loads}/LineStressLoad.cs | 0 .../{ => Loads}/LineTemperatureLoadDefine.cs | 0 .../MassConversionTableConstruct.cs | 0 .../Loads/{ => Loads}/MovingLoad.cs | 0 .../Loads/{ => Loads}/PointLoadDefine.cs | 0 .../Loads/{ => Loads}/PressureLoadDefine.cs | 0 .../Loads/{ => Loads}/SurfaceLoadUniform.cs | 0 .../Loads/Loads/SurfaceLoadVariable.cs | 118 ++++++++++++++++++ .../{ => Loads}/SurfaceTemperatureLoad.cs | 2 +- .../Loads/{ => Loads}/VehicleDeconstruct.cs | 0 .../Loads/{ => Loads}/VehicleFromStruxml.cs | 0 ...oadLocationValueConstruct_OBSOLETE2209.cs} | 6 +- .../SurfaceLoadVariable_OBSOLETE2209.cs} | 6 +- .../SurfaceTemperatureLoadOBSOLETE.cs | 0 .../TopBotLocationValueConstructOBSOLETE.cs | 0 30 files changed, 157 insertions(+), 37 deletions(-) rename FemDesign.Grasshopper/Deconstruct/{TopBotLocValDeconstruct.cs => OBSOLETE/TopBotLocValDeconstruct_OBSOLETE2209.cs} (83%) rename FemDesign.Grasshopper/Loads/{ => Load cases}/LoadCaseConstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load cases}/LoadCaseGetLoadCaseByName.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load categories}/LoadCategoryConstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load categories}/LoadCategoryDatabaseDefault.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load categories}/LoadCategoryDatabaseListLoadCategoryNames.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load categories}/LoadCategoryGetLoadCatergoryByName.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load combinations}/LoadCombinationConstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load combinations}/LoadCombinationSetupCalculation.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load groups}/LoadGroupConstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Load groups}/LoadGroupToLoadComb.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/FootfallFullExcitation.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/FootfallSelfExcitation.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/LineLoadDefine.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/LineStressLoad.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/LineTemperatureLoadDefine.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/MassConversionTableConstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/MovingLoad.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/PointLoadDefine.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/PressureLoadDefine.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/SurfaceLoadUniform.cs (100%) create mode 100644 FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs rename FemDesign.Grasshopper/Loads/{ => Loads}/SurfaceTemperatureLoad.cs (97%) rename FemDesign.Grasshopper/Loads/{ => Loads}/VehicleDeconstruct.cs (100%) rename FemDesign.Grasshopper/Loads/{ => Loads}/VehicleFromStruxml.cs (100%) rename FemDesign.Grasshopper/Loads/{LoadLocationValueConstruct.cs => OBSOLETE/LoadLocationValueConstruct_OBSOLETE2209.cs} (79%) rename FemDesign.Grasshopper/Loads/{SurfaceLoadVariable.cs => OBSOLETE/SurfaceLoadVariable_OBSOLETE2209.cs} (91%) rename FemDesign.Grasshopper/Loads/{ => OBSOLETE}/SurfaceTemperatureLoadOBSOLETE.cs (100%) rename FemDesign.Grasshopper/Loads/{ => OBSOLETE}/TopBotLocationValueConstructOBSOLETE.cs (100%) diff --git a/FemDesign.Grasshopper/Deconstruct/TopBotLocValDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/OBSOLETE/TopBotLocValDeconstruct_OBSOLETE2209.cs similarity index 83% rename from FemDesign.Grasshopper/Deconstruct/TopBotLocValDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/OBSOLETE/TopBotLocValDeconstruct_OBSOLETE2209.cs index 1046278f3..c92dd6805 100644 --- a/FemDesign.Grasshopper/Deconstruct/TopBotLocValDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/OBSOLETE/TopBotLocValDeconstruct_OBSOLETE2209.cs @@ -4,9 +4,9 @@ namespace FemDesign.Grasshopper { - public class TopBotLocValDeconstruct: FEM_Design_API_Component + public class TopBotLocValDeconstruct_OBSOLETE2209: FEM_Design_API_Component { - public TopBotLocValDeconstruct(): base("TopBotLocVal.Deconstruct", "Deconstruct", "Deconstruct a TopBottomLocationValue.", "FEM-Design", "Deconstruct") + public TopBotLocValDeconstruct_OBSOLETE2209(): base("TopBotLocVal.Deconstruct", "Deconstruct", "Deconstruct a TopBottomLocationValue.", "FEM-Design", "Deconstruct") { } @@ -49,5 +49,6 @@ public override Guid ComponentGuid { get { return new Guid("46e7462c-80a8-4894-a43f-1a00fb5a4e52"); } } + public override GH_Exposure Exposure => GH_Exposure.hidden; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj index 8551d9222..6522a9f7c 100644 --- a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj +++ b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj @@ -126,13 +126,14 @@ - - - - - - - + + + + + + + + @@ -188,12 +189,12 @@ - + - - - + + + @@ -286,10 +287,10 @@ - - - - + + + + @@ -339,27 +340,27 @@ - + - + - - - + + + - - - + + + - - - - - + + + + + diff --git a/FemDesign.Grasshopper/Loads/LoadCaseConstruct.cs b/FemDesign.Grasshopper/Loads/Load cases/LoadCaseConstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCaseConstruct.cs rename to FemDesign.Grasshopper/Loads/Load cases/LoadCaseConstruct.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCaseGetLoadCaseByName.cs b/FemDesign.Grasshopper/Loads/Load cases/LoadCaseGetLoadCaseByName.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCaseGetLoadCaseByName.cs rename to FemDesign.Grasshopper/Loads/Load cases/LoadCaseGetLoadCaseByName.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCategoryConstruct.cs b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryConstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCategoryConstruct.cs rename to FemDesign.Grasshopper/Loads/Load categories/LoadCategoryConstruct.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCategoryDatabaseDefault.cs b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCategoryDatabaseDefault.cs rename to FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCategoryDatabaseListLoadCategoryNames.cs b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseListLoadCategoryNames.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCategoryDatabaseListLoadCategoryNames.cs rename to FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseListLoadCategoryNames.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCategoryGetLoadCatergoryByName.cs b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryGetLoadCatergoryByName.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCategoryGetLoadCatergoryByName.cs rename to FemDesign.Grasshopper/Loads/Load categories/LoadCategoryGetLoadCatergoryByName.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCombinationConstruct.cs b/FemDesign.Grasshopper/Loads/Load combinations/LoadCombinationConstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCombinationConstruct.cs rename to FemDesign.Grasshopper/Loads/Load combinations/LoadCombinationConstruct.cs diff --git a/FemDesign.Grasshopper/Loads/LoadCombinationSetupCalculation.cs b/FemDesign.Grasshopper/Loads/Load combinations/LoadCombinationSetupCalculation.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadCombinationSetupCalculation.cs rename to FemDesign.Grasshopper/Loads/Load combinations/LoadCombinationSetupCalculation.cs diff --git a/FemDesign.Grasshopper/Loads/LoadGroupConstruct.cs b/FemDesign.Grasshopper/Loads/Load groups/LoadGroupConstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadGroupConstruct.cs rename to FemDesign.Grasshopper/Loads/Load groups/LoadGroupConstruct.cs diff --git a/FemDesign.Grasshopper/Loads/LoadGroupToLoadComb.cs b/FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LoadGroupToLoadComb.cs rename to FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs diff --git a/FemDesign.Grasshopper/Loads/FootfallFullExcitation.cs b/FemDesign.Grasshopper/Loads/Loads/FootfallFullExcitation.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/FootfallFullExcitation.cs rename to FemDesign.Grasshopper/Loads/Loads/FootfallFullExcitation.cs diff --git a/FemDesign.Grasshopper/Loads/FootfallSelfExcitation.cs b/FemDesign.Grasshopper/Loads/Loads/FootfallSelfExcitation.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/FootfallSelfExcitation.cs rename to FemDesign.Grasshopper/Loads/Loads/FootfallSelfExcitation.cs diff --git a/FemDesign.Grasshopper/Loads/LineLoadDefine.cs b/FemDesign.Grasshopper/Loads/Loads/LineLoadDefine.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LineLoadDefine.cs rename to FemDesign.Grasshopper/Loads/Loads/LineLoadDefine.cs diff --git a/FemDesign.Grasshopper/Loads/LineStressLoad.cs b/FemDesign.Grasshopper/Loads/Loads/LineStressLoad.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LineStressLoad.cs rename to FemDesign.Grasshopper/Loads/Loads/LineStressLoad.cs diff --git a/FemDesign.Grasshopper/Loads/LineTemperatureLoadDefine.cs b/FemDesign.Grasshopper/Loads/Loads/LineTemperatureLoadDefine.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/LineTemperatureLoadDefine.cs rename to FemDesign.Grasshopper/Loads/Loads/LineTemperatureLoadDefine.cs diff --git a/FemDesign.Grasshopper/Loads/MassConversionTableConstruct.cs b/FemDesign.Grasshopper/Loads/Loads/MassConversionTableConstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/MassConversionTableConstruct.cs rename to FemDesign.Grasshopper/Loads/Loads/MassConversionTableConstruct.cs diff --git a/FemDesign.Grasshopper/Loads/MovingLoad.cs b/FemDesign.Grasshopper/Loads/Loads/MovingLoad.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/MovingLoad.cs rename to FemDesign.Grasshopper/Loads/Loads/MovingLoad.cs diff --git a/FemDesign.Grasshopper/Loads/PointLoadDefine.cs b/FemDesign.Grasshopper/Loads/Loads/PointLoadDefine.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/PointLoadDefine.cs rename to FemDesign.Grasshopper/Loads/Loads/PointLoadDefine.cs diff --git a/FemDesign.Grasshopper/Loads/PressureLoadDefine.cs b/FemDesign.Grasshopper/Loads/Loads/PressureLoadDefine.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/PressureLoadDefine.cs rename to FemDesign.Grasshopper/Loads/Loads/PressureLoadDefine.cs diff --git a/FemDesign.Grasshopper/Loads/SurfaceLoadUniform.cs b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadUniform.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/SurfaceLoadUniform.cs rename to FemDesign.Grasshopper/Loads/Loads/SurfaceLoadUniform.cs diff --git a/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs new file mode 100644 index 000000000..1da6c48b3 --- /dev/null +++ b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs @@ -0,0 +1,118 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using FemDesign.Loads; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SurfaceLoadVariable : FEM_Design_API_Component + { + public SurfaceLoadVariable() : base("SurfaceLoad.Variable", "Variable", "Create a variable surface load.", CategoryName.Name(), SubCategoryName.Cat3()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Srf", "Surface.", GH_ParamAccess.item); + pManager.AddVectorParameter("Direction", "Dir", "Vector. Direction of force.", GH_ParamAccess.item); + //pManager.AddGenericParameter("LoadLocationValue", "LoadLocationValue", "LoadLocationValue objects. List of 3 items [q1, q2, q3]. [kN/m²]", GH_ParamAccess.list); + pManager.AddPointParameter("Positions", "Pos", "Positions of Load. Either 1 value (uniform) or 3 values (variable). [m]", GH_ParamAccess.list); + pManager.AddNumberParameter("Intensity", "Int", "Intensity of load. Either 1 value (uniform) or 3 values (variable). [kN/m˛]", GH_ParamAccess.list); + + pManager.AddBooleanParameter("LoadProjection", "Proj", "LoadProjection. \nFalse: Intensity meant along action line (eg. dead load). \nTrue: Intensity meant perpendicular to direction of load (eg. snow load).", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("LoadCase", "Case", "LoadCase.", GH_ParamAccess.item); + pManager.AddTextParameter("Comment", "Comm", "Comment.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("SurfaceLoad", "SurfaceLoad", "SurfaceLoad.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Brep surface = null; + if (!DA.GetData("Surface", ref surface)) { return; } + + Vector3d direction = Vector3d.Zero; + if (!DA.GetData("Direction", ref direction)) { return; } + + List points = null; + if (!DA.GetDataList("Positions", points)) { return; } + if (points.Count < 1 || points.Count == 2 || points.Count > 3) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Length of Positions must be 1 (uniform load) or 3 (variable load), but it is {points.Count}."); + return; + } + + List intensity = null; + if (!DA.GetDataList("Intensity", intensity)) { return; } + if(intensity.Count > points.Count) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Number of positions ({points.Count}) is less than Intensity length ({intensity.Count})."); + } + + bool loadProjection = false; + DA.GetData("LoadProjection", ref loadProjection); + + FemDesign.Loads.LoadCase loadCase = null; + if (!DA.GetData("LoadCase", ref loadCase)) { return; } + + string comment = ""; + DA.GetData("Comment", ref comment); + + // check input + if (surface == null || points == null || intensity == null || loadCase == null) { return; } + + // Convert geometry + FemDesign.Geometry.Region region = surface.FromRhino(); + FemDesign.Geometry.Vector3d fdVector = direction.FromRhino().Normalize(); + List positions = points.Select(p => p.FromRhino()).ToList(); + + List loads = new List(); + if (intensity.Count == 1) + { + foreach (var pos in positions) + { + var load = new LoadLocationValue(pos, intensity[0]); + loads.Add(load); + } + } + else if (intensity.Count == 3) + { + for (int i = 0; i < points.Count; i++) + { + var load = new LoadLocationValue(positions[i], intensity[i]); + loads.Add(load); + } + } + else + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Length of Intensity must be 1 (uniform load) or 3 (variable load), but it is {intensity.Count}."); + return; + } + + FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loads, loadCase, loadProjection, comment); + + DA.SetData("SurfaceLoad", obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SurfaceLoadVariable; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{B19B7E82-6265-4627-83F6-F448B9A68DD4}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Loads/SurfaceTemperatureLoad.cs b/FemDesign.Grasshopper/Loads/Loads/SurfaceTemperatureLoad.cs similarity index 97% rename from FemDesign.Grasshopper/Loads/SurfaceTemperatureLoad.cs rename to FemDesign.Grasshopper/Loads/Loads/SurfaceTemperatureLoad.cs index 4f8e0d8fe..342f4d2d6 100644 --- a/FemDesign.Grasshopper/Loads/SurfaceTemperatureLoad.cs +++ b/FemDesign.Grasshopper/Loads/Loads/SurfaceTemperatureLoad.cs @@ -15,7 +15,7 @@ public SurfaceTemperatureLoad() : base("SurfaceTemperatureLoad.Construct", "Cons protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddSurfaceParameter("Surface", "Surface", "Surface.", GH_ParamAccess.item); - pManager.AddPointParameter("Point", "Point", "Point of top bottom location value. [m]", GH_ParamAccess.list); + pManager.AddPointParameter("Point", "Point", "Points of top & bottom location values. [m]", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddNumberParameter("TopVal", "TopVal", "Top value. Either 1 value (uniform) or 3 values (variable). [\x00B0C]", GH_ParamAccess.list); pManager.AddNumberParameter("BottomVal", "BottomVal", "Bottom value. Either 1 value (uniform) or 3 values (variable). [\x00B0C]", GH_ParamAccess.list); diff --git a/FemDesign.Grasshopper/Loads/VehicleDeconstruct.cs b/FemDesign.Grasshopper/Loads/Loads/VehicleDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/VehicleDeconstruct.cs rename to FemDesign.Grasshopper/Loads/Loads/VehicleDeconstruct.cs diff --git a/FemDesign.Grasshopper/Loads/VehicleFromStruxml.cs b/FemDesign.Grasshopper/Loads/Loads/VehicleFromStruxml.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/VehicleFromStruxml.cs rename to FemDesign.Grasshopper/Loads/Loads/VehicleFromStruxml.cs diff --git a/FemDesign.Grasshopper/Loads/LoadLocationValueConstruct.cs b/FemDesign.Grasshopper/Loads/OBSOLETE/LoadLocationValueConstruct_OBSOLETE2209.cs similarity index 79% rename from FemDesign.Grasshopper/Loads/LoadLocationValueConstruct.cs rename to FemDesign.Grasshopper/Loads/OBSOLETE/LoadLocationValueConstruct_OBSOLETE2209.cs index 17ed62815..411bf9be1 100644 --- a/FemDesign.Grasshopper/Loads/LoadLocationValueConstruct.cs +++ b/FemDesign.Grasshopper/Loads/OBSOLETE/LoadLocationValueConstruct_OBSOLETE2209.cs @@ -6,9 +6,9 @@ namespace FemDesign.Grasshopper { - public class LoadLocationValueConstruct: FEM_Design_API_Component + public class LoadLocationValueConstruct_OBSOLETE2209 : FEM_Design_API_Component { - public LoadLocationValueConstruct(): base("LoadLocationValue.Construct", "Construct", "Construct a LoadLocationValue object. LoadLocationValue objects are used to define a SurfaceLoad with variable intensity [q1, q2, q3].", CategoryName.Name(), SubCategoryName.Cat3()) + public LoadLocationValueConstruct_OBSOLETE2209(): base("LoadLocationValue.Construct", "Construct", "Construct a LoadLocationValue object. LoadLocationValue objects are used to define a SurfaceLoad with variable intensity [q1, q2, q3].", CategoryName.Name(), SubCategoryName.Cat3()) { } @@ -50,7 +50,7 @@ public override Guid ComponentGuid { get { return new Guid("d7c9d6be-3474-41f6-b58c-0029fd24729f"); } } - public override GH_Exposure Exposure => GH_Exposure.quinary; + public override GH_Exposure Exposure => GH_Exposure.hidden; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Loads/SurfaceLoadVariable.cs b/FemDesign.Grasshopper/Loads/OBSOLETE/SurfaceLoadVariable_OBSOLETE2209.cs similarity index 91% rename from FemDesign.Grasshopper/Loads/SurfaceLoadVariable.cs rename to FemDesign.Grasshopper/Loads/OBSOLETE/SurfaceLoadVariable_OBSOLETE2209.cs index 0e385c2ed..93bc1f573 100644 --- a/FemDesign.Grasshopper/Loads/SurfaceLoadVariable.cs +++ b/FemDesign.Grasshopper/Loads/OBSOLETE/SurfaceLoadVariable_OBSOLETE2209.cs @@ -6,9 +6,9 @@ namespace FemDesign.Grasshopper { - public class SurfaceLoadVariable: FEM_Design_API_Component + public class SurfaceLoadVariable_OBSOLETE2209: FEM_Design_API_Component { - public SurfaceLoadVariable(): base("SurfaceLoad.Variable", "Variable", "Create a variable surface load.", CategoryName.Name(), SubCategoryName.Cat3()) + public SurfaceLoadVariable_OBSOLETE2209(): base("SurfaceLoad.Variable", "Variable", "Create a variable surface load.", CategoryName.Name(), SubCategoryName.Cat3()) { } @@ -68,7 +68,7 @@ public override Guid ComponentGuid get { return new Guid("3be4e5aa-63df-4ea9-bbd1-99d59c694b31"); } } - public override GH_Exposure Exposure => GH_Exposure.tertiary; + public override GH_Exposure Exposure => GH_Exposure.hidden; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Loads/SurfaceTemperatureLoadOBSOLETE.cs b/FemDesign.Grasshopper/Loads/OBSOLETE/SurfaceTemperatureLoadOBSOLETE.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/SurfaceTemperatureLoadOBSOLETE.cs rename to FemDesign.Grasshopper/Loads/OBSOLETE/SurfaceTemperatureLoadOBSOLETE.cs diff --git a/FemDesign.Grasshopper/Loads/TopBotLocationValueConstructOBSOLETE.cs b/FemDesign.Grasshopper/Loads/OBSOLETE/TopBotLocationValueConstructOBSOLETE.cs similarity index 100% rename from FemDesign.Grasshopper/Loads/TopBotLocationValueConstructOBSOLETE.cs rename to FemDesign.Grasshopper/Loads/OBSOLETE/TopBotLocationValueConstructOBSOLETE.cs From ac4b5c090b831a30c2f26f728877f8a7fe51e96c Mon Sep 17 00:00:00 2001 From: MP <53620289+Marco-Pellegrino@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:54:35 +0200 Subject: [PATCH 2/3] Update SurfaceLoadVariable.cs --- .../Loads/Loads/SurfaceLoadVariable.cs | 89 +++++++------------ 1 file changed, 32 insertions(+), 57 deletions(-) diff --git a/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs index 1da6c48b3..4754813e3 100644 --- a/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs +++ b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs @@ -1,7 +1,6 @@ // https://strusoft.com/ using System; using System.Collections.Generic; -using System.Linq; using FemDesign.Loads; using Grasshopper.Kernel; using Rhino.Geometry; @@ -16,16 +15,14 @@ public SurfaceLoadVariable() : base("SurfaceLoad.Variable", "Variable", "Create } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddSurfaceParameter("Surface", "Srf", "Surface.", GH_ParamAccess.item); - pManager.AddVectorParameter("Direction", "Dir", "Vector. Direction of force.", GH_ParamAccess.item); - //pManager.AddGenericParameter("LoadLocationValue", "LoadLocationValue", "LoadLocationValue objects. List of 3 items [q1, q2, q3]. [kN/m²]", GH_ParamAccess.list); - pManager.AddPointParameter("Positions", "Pos", "Positions of Load. Either 1 value (uniform) or 3 values (variable). [m]", GH_ParamAccess.list); - pManager.AddNumberParameter("Intensity", "Int", "Intensity of load. Either 1 value (uniform) or 3 values (variable). [kN/m˛]", GH_ParamAccess.list); - - pManager.AddBooleanParameter("LoadProjection", "Proj", "LoadProjection. \nFalse: Intensity meant along action line (eg. dead load). \nTrue: Intensity meant perpendicular to direction of load (eg. snow load).", GH_ParamAccess.item); + pManager.AddSurfaceParameter("Surface", "Surface", "Surface.", GH_ParamAccess.item); + pManager.AddVectorParameter("Direction", "Direction", "Vector. Direction of force.", GH_ParamAccess.item); + pManager.AddPointParameter("Positions", "Position", "Location Values. List of 3 items [pt1, pt2, pt3].", GH_ParamAccess.list); + pManager.AddNumberParameter("Intensity", "Intensity", "Load Values. List of 3 items [q1, q2, q3]. [kN/m²]", GH_ParamAccess.list); + pManager.AddBooleanParameter("LoadProjection", "LoadProjection", "LoadProjection. \nFalse: Intensity meant along action line (eg. dead load). \nTrue: Intensity meant perpendicular to direction of load (eg. snow load).", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("LoadCase", "Case", "LoadCase.", GH_ParamAccess.item); - pManager.AddTextParameter("Comment", "Comm", "Comment.", GH_ParamAccess.item); + pManager.AddGenericParameter("LoadCase", "LoadCase", "LoadCase.", GH_ParamAccess.item); + pManager.AddTextParameter("Comment", "Comment", "Comment.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -34,69 +31,47 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input Brep surface = null; - if (!DA.GetData("Surface", ref surface)) { return; } - Vector3d direction = Vector3d.Zero; + List locationValues = new List(); + List loadValues = new List(); + FemDesign.Loads.LoadCase loadCase = null; + bool loadProjection = false; + string comment = ""; + if (!DA.GetData("Surface", ref surface)) { return; } if (!DA.GetData("Direction", ref direction)) { return; } + if (!DA.GetDataList("Positions", locationValues)) { return; } + if (!DA.GetDataList("Intensity", loadValues)) { return; } + DA.GetData("LoadProjection", ref loadProjection); + if (!DA.GetData("LoadCase", ref loadCase)) { return; } + DA.GetData("Comment", ref comment); + - List points = null; - if (!DA.GetDataList("Positions", points)) { return; } - if (points.Count < 1 || points.Count == 2 || points.Count > 3) + if (locationValues.Count != 3) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Length of Positions must be 1 (uniform load) or 3 (variable load), but it is {points.Count}."); - return; + throw new System.ArgumentException("'locationValues' must contain exactly 3 items"); } - List intensity = null; - if (!DA.GetDataList("Intensity", intensity)) { return; } - if(intensity.Count > points.Count) + if (loadValues.Count != 3) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Number of positions ({points.Count}) is less than Intensity length ({intensity.Count})."); + throw new System.ArgumentException("'LoadValues' must contain exactly 3 items"); } - - bool loadProjection = false; - DA.GetData("LoadProjection", ref loadProjection); - - FemDesign.Loads.LoadCase loadCase = null; - if (!DA.GetData("LoadCase", ref loadCase)) { return; } - - string comment = ""; - DA.GetData("Comment", ref comment); - - // check input - if (surface == null || points == null || intensity == null || loadCase == null) { return; } // Convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); FemDesign.Geometry.Vector3d fdVector = direction.FromRhino().Normalize(); - List positions = points.Select(p => p.FromRhino()).ToList(); - List loads = new List(); - if (intensity.Count == 1) - { - foreach (var pos in positions) - { - var load = new LoadLocationValue(pos, intensity[0]); - loads.Add(load); - } - } - else if (intensity.Count == 3) - { - for (int i = 0; i < points.Count; i++) - { - var load = new LoadLocationValue(positions[i], intensity[i]); - loads.Add(load); - } - } - else + var loadLocationValues = new List(); + + int index = 0; + foreach (var pos in locationValues) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Length of Intensity must be 1 (uniform load) or 3 (variable load), but it is {intensity.Count}."); - return; + var loadLocation = new LoadLocationValue(pos.FromRhino(), loadValues[index]); + loadLocationValues.Add(loadLocation); + index++; } - FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loads, loadCase, loadProjection, comment); + FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loadLocationValues, loadCase, loadProjection, comment); DA.SetData("SurfaceLoad", obj); } @@ -109,7 +84,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{B19B7E82-6265-4627-83F6-F448B9A68DD4}"); } + get { return new Guid("{FDB73ABC-1EEA-48F1-9087-68EC76A95964}"); } } public override GH_Exposure Exposure => GH_Exposure.tertiary; From 0927dc114fc60f84e13aebe8368849929ba171a2 Mon Sep 17 00:00:00 2001 From: MP <53620289+Marco-Pellegrino@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:31:03 +0200 Subject: [PATCH 3/3] :pencil2: typo --- FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs index 4754813e3..f8c2db9fa 100644 --- a/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs +++ b/FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs @@ -17,7 +17,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddSurfaceParameter("Surface", "Surface", "Surface.", GH_ParamAccess.item); pManager.AddVectorParameter("Direction", "Direction", "Vector. Direction of force.", GH_ParamAccess.item); - pManager.AddPointParameter("Positions", "Position", "Location Values. List of 3 items [pt1, pt2, pt3].", GH_ParamAccess.list); + pManager.AddPointParameter("Positions", "Positions", "Location Values. List of 3 items [pt1, pt2, pt3].", GH_ParamAccess.list); pManager.AddNumberParameter("Intensity", "Intensity", "Load Values. List of 3 items [q1, q2, q3]. [kN/m²]", GH_ParamAccess.list); pManager.AddBooleanParameter("LoadProjection", "LoadProjection", "LoadProjection. \nFalse: Intensity meant along action line (eg. dead load). \nTrue: Intensity meant perpendicular to direction of load (eg. snow load).", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true;