Skip to content

Commit

Permalink
Merge branch '870_RemoveLoadLocationValueFromGH' into 22.9.0_Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Pellegrino committed Oct 24, 2023
2 parents 6442072 + 0927dc1 commit 2583923
Show file tree
Hide file tree
Showing 30 changed files with 182 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// https://strusoft.com/
using System;
using Grasshopper.Kernel;

namespace FemDesign.Grasshopper
{
public class TopBotLocValDeconstruct_OBSOLETE2209: FEM_Design_API_Component
{
public TopBotLocValDeconstruct_OBSOLETE2209(): base("TopBotLocVal.Deconstruct", "Deconstruct", "Deconstruct a TopBottomLocationValue.", "FEM-Design", "Deconstruct")
{

}
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("TopBottomLocationValue", "TopBotLocVal", "TopBottomLocationValue.", GH_ParamAccess.item);
}
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddPointParameter("Point", "Point", "Point." , GH_ParamAccess.item);
pManager.AddNumberParameter("TopValue", "TopVal", "TopValue.", GH_ParamAccess.item);
pManager.AddNumberParameter("BottomValue", "BotVal", "BotValue.", GH_ParamAccess.item);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
// get input
FemDesign.Loads.TopBotLocationValue obj = null;
if (!DA.GetData(0, ref obj))
{
return;
}
if (obj == null)
{
return;
}

// return
DA.SetData(0, obj.GetFdPoint().ToRhino());
DA.SetData(1, obj.TopVal);
DA.SetData(2, obj.BottomVal);
}
protected override System.Drawing.Bitmap Icon
{
get
{
return FemDesign.Properties.Resources.TopBottomValueDeconstruct;
}
}
public override Guid ComponentGuid
{
get { return new Guid("46e7462c-80a8-4894-a43f-1a00fb5a4e52"); }
}
public override GH_Exposure Exposure => GH_Exposure.hidden;
}
}
55 changes: 28 additions & 27 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@
<Compile Include="Extension\GH_AsyncComponent.cs" />
<Compile Include="Extension\WorkerInstance.cs" />
<Compile Include="Helpers\CustomAttributes.cs" />
<Compile Include="Loads\LineLoadDefine.cs" />
<Compile Include="Loads\LoadCombinationSetupCalculation.cs" />
<Compile Include="Loads\LoadGroupToLoadComb.cs" />
<Compile Include="Loads\MovingLoad.cs" />
<Compile Include="Loads\PointLoadDefine.cs" />
<Compile Include="Loads\VehicleDeconstruct.cs" />
<Compile Include="Loads\VehicleFromStruxml.cs" />
<Compile Include="Loads\Loads\LineLoadDefine.cs" />
<Compile Include="Loads\Load combinations\LoadCombinationSetupCalculation.cs" />
<Compile Include="Loads\Load groups\LoadGroupToLoadComb.cs" />
<Compile Include="Loads\Loads\MovingLoad.cs" />
<Compile Include="Loads\Loads\PointLoadDefine.cs" />
<Compile Include="Loads\Loads\SurfaceLoadVariable.cs" />
<Compile Include="Loads\Loads\VehicleDeconstruct.cs" />
<Compile Include="Loads\Loads\VehicleFromStruxml.cs" />
<Compile Include="Materials\MaterialDatabase.cs" />
<Compile Include="Materials\MaterialSetTimberMaterialProperties.cs" />
<Compile Include="ModellingTools\PointConnection.cs" />
Expand Down Expand Up @@ -195,12 +196,12 @@
<Compile Include="Drawing\DimensionLinear.cs" />
<Compile Include="Helpers\_FileName.cs" />
<Compile Include="Helpers\_GhRibbonLayout.cs" />
<Compile Include="Loads\LineStressLoad.cs" />
<Compile Include="Loads\Loads\LineStressLoad.cs" />
<Compile Include="Loads\OBSOLETE\LineLoadForce_OBSOLETE.cs" />
<Compile Include="Loads\OBSOLETE\LineLoadMoment_OBSOLETE.cs" />
<Compile Include="Loads\LineTemperatureLoadDefine.cs" />
<Compile Include="Loads\LoadCategoryConstruct.cs" />
<Compile Include="Loads\SurfaceTemperatureLoad.cs" />
<Compile Include="Loads\Loads\LineTemperatureLoadDefine.cs" />
<Compile Include="Loads\Load categories\LoadCategoryConstruct.cs" />
<Compile Include="Loads\Loads\SurfaceTemperatureLoad.cs" />
<Compile Include="Materials\CustomMaterial.cs" />
<Compile Include="Materials\MaterialGetByNameIndex.cs" />
<Compile Include="Materials\OBSOLETE\MaterialGetMaterialByNameOBSOLETE2.cs" />
Expand Down Expand Up @@ -292,10 +293,10 @@
<Compile Include="Supports\StiffnessPoints.cs" />
<Compile Include="Extension\HtmlWriter.cs" />
<Compile Include="Utils\LoadGroupCombineGeneral.cs" />
<Compile Include="Loads\LoadGroupConstruct.cs" />
<Compile Include="Loads\LoadCategoryDatabaseDefault.cs" />
<Compile Include="Loads\LoadCategoryDatabaseListLoadCategoryNames.cs" />
<Compile Include="Loads\LoadCategoryGetLoadCatergoryByName.cs" />
<Compile Include="Loads\Load groups\LoadGroupConstruct.cs" />
<Compile Include="Loads\Load categories\LoadCategoryDatabaseDefault.cs" />
<Compile Include="Loads\Load categories\LoadCategoryDatabaseListLoadCategoryNames.cs" />
<Compile Include="Loads\Load categories\LoadCategoryGetLoadCatergoryByName.cs" />
<Compile Include="Obsolete\BarsDeconstructOBSOLETE.cs" />
<Compile Include="Deconstruct\ModellingTools\DiaphragmDeconstruct.cs" />
<Compile Include="Obsolete\ModelAddElementsSimpleOBSOLETE.cs" />
Expand Down Expand Up @@ -348,24 +349,24 @@
<Compile Include="Deconstruct\Loads\TopBotLocValDeconstruct.cs" />
<Compile Include="Deconstruct\Reinforcement\WireDeconstruct.cs" />
<Compile Include="Geometry\Convert.cs" />
<Compile Include="Loads\FootfallSelfExcitation.cs" />
<Compile Include="Loads\Loads\FootfallSelfExcitation.cs" />
<Compile Include="Obsolete\LineLoadForceOBSOLETE.cs" />
<Compile Include="Obsolete\LineLoadMomentOBSOLETE.cs" />
<Compile Include="Loads\OBSOLETE\LineTemperatureLoadDefineOBSOLETE.cs" />
<Compile Include="Loads\LoadCaseConstruct.cs" />
<Compile Include="Loads\LoadCaseGetLoadCaseByName.cs" />
<Compile Include="Loads\LoadCombinationConstruct.cs" />
<Compile Include="Loads\Load cases\LoadCaseConstruct.cs" />
<Compile Include="Loads\Load cases\LoadCaseGetLoadCaseByName.cs" />
<Compile Include="Loads\Load combinations\LoadCombinationConstruct.cs" />
<Compile Include="Loads\OBSOLETE\LoadCombinationSetupCalculation_OBSOLETE.cs" />
<Compile Include="Loads\LoadLocationValueConstruct.cs" />
<Compile Include="Loads\MassConversionTableConstruct.cs" />
<Compile Include="Loads\FootfallFullExcitation.cs" />
<Compile Include="Loads\OBSOLETE\LoadLocationValueConstruct_OBSOLETE2209.cs" />
<Compile Include="Loads\Loads\MassConversionTableConstruct.cs" />
<Compile Include="Loads\Loads\FootfallFullExcitation.cs" />
<Compile Include="Loads\OBSOLETE\PointLoadForce_OBSOLETE.cs" />
<Compile Include="Loads\OBSOLETE\PointLoadMoment_OBSOLETE.cs" />
<Compile Include="Loads\PressureLoadDefine.cs" />
<Compile Include="Loads\SurfaceLoadUniform.cs" />
<Compile Include="Loads\SurfaceLoadVariable.cs" />
<Compile Include="Loads\SurfaceTemperatureLoadOBSOLETE.cs" />
<Compile Include="Loads\TopBotLocationValueConstructOBSOLETE.cs" />
<Compile Include="Loads\Loads\PressureLoadDefine.cs" />
<Compile Include="Loads\Loads\SurfaceLoadUniform.cs" />
<Compile Include="Loads\OBSOLETE\SurfaceLoadVariable_OBSOLETE2209.cs" />
<Compile Include="Loads\OBSOLETE\SurfaceTemperatureLoadOBSOLETE.cs" />
<Compile Include="Loads\OBSOLETE\TopBotLocationValueConstructOBSOLETE.cs" />
<Compile Include="Materials\OBSOLETE\MaterialDatabaseDefault_OBSOLETE2.cs" />
<Compile Include="Materials\OBSOLETE\MaterialDatabaseFromStruxml_OBSOLETE2.cs" />
<Compile Include="Materials\OBSOLETE\MaterialDatabaseListMaterialNamesOBSOLETE.cs" />
Expand Down
File renamed without changes.
93 changes: 93 additions & 0 deletions FemDesign.Grasshopper/Loads/Loads/SurfaceLoadVariable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// https://strusoft.com/
using System;
using System.Collections.Generic;
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", "Surface", "Surface.", GH_ParamAccess.item);
pManager.AddVectorParameter("Direction", "Direction", "Vector. Direction of force.", GH_ParamAccess.item);
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;
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)
{
pManager.AddGenericParameter("SurfaceLoad", "SurfaceLoad", "SurfaceLoad.", GH_ParamAccess.item);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
Brep surface = null;
Vector3d direction = Vector3d.Zero;
List<Point3d> locationValues = new List<Point3d>();
List<double> loadValues = new List<double>();
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);


if (locationValues.Count != 3)
{
throw new System.ArgumentException("'locationValues' must contain exactly 3 items");
}

if (loadValues.Count != 3)
{
throw new System.ArgumentException("'LoadValues' must contain exactly 3 items");
}

// Convert geometry
FemDesign.Geometry.Region region = surface.FromRhino();
FemDesign.Geometry.Vector3d fdVector = direction.FromRhino().Normalize();

var loadLocationValues = new List<Loads.LoadLocationValue>();

int index = 0;
foreach (var pos in locationValues)
{
var loadLocation = new LoadLocationValue(pos.FromRhino(), loadValues[index]);
loadLocationValues.Add(loadLocation);
index++;
}

FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loadLocationValues, 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("{FDB73ABC-1EEA-48F1-9087-68EC76A95964}"); }
}

public override GH_Exposure Exposure => GH_Exposure.tertiary;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{

}
Expand Down Expand Up @@ -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;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{

}
Expand Down Expand Up @@ -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;

}
}

0 comments on commit 2583923

Please sign in to comment.