Skip to content

Commit

Permalink
🚧 DeltaBeam and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinczandrea committed Oct 2, 2024
1 parent 1c1cebd commit ea20fb0
Show file tree
Hide file tree
Showing 8 changed files with 303 additions and 83 deletions.
241 changes: 169 additions & 72 deletions FemDesign.Core/Composites/CompositeSection.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
<Compile Include="Sections\Composite\FilledCruciformProfile.cs" />
<Compile Include="Sections\Composite\EffectiveCompositeSlab.cs" />
<Compile Include="Sections\Composite\FilledIProfile.cs" />
<Compile Include="Sections\Composite\DeltaBeamProfile.cs" />
<Compile Include="Sections\Composite\SteelTubeWithIProfile.cs" />
<Compile Include="Sections\Composite\SteelTubeWithSteelCore.cs" />
<Compile Include="Sections\Composite\RHSProfile.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CompositeSectionDefine : GH_SwitcherComponent
{
private List<SubComponent> _subcomponents = new List<SubComponent>();
public override string UnitMenuName => "CompositeSection.Define";
protected override string DefaultEvaluationUnit => _subcomponents[0].name();
protected override string DefaultEvaluationUnit => _subcomponents[2].name();
public override Guid ComponentGuid => new Guid("{A6B804EA-F254-4ABE-BEC5-FA69E92069AA}");
public override GH_Exposure Exposure => GH_Exposure.tertiary;

Expand All @@ -48,6 +48,7 @@ protected override void RegisterEvaluationUnits(EvaluationUnitManager mngr)
{
_subcomponents.Add(new EffectiveCompositeSlab());
_subcomponents.Add(new HSQProfile());
_subcomponents.Add(new DeltaBeamProfile());
_subcomponents.Add(new FilledIProfile());
_subcomponents.Add(new FilledCruciformProfile());
_subcomponents.Add(new RHSProfile());
Expand Down
73 changes: 73 additions & 0 deletions FemDesign.Grasshopper/Sections/Composite/DeltaBeamProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
using FemDesign.Grasshopper.Components.UIWidgets;


namespace FemDesign.Grasshopper
{
public class DeltaBeamProfile : SubComponent
{
public override string name() => "DeltaBeamProfile";
public override string display_name() => "DeltaBeamProfile";

public override void registerEvaluationUnits(EvaluationUnitManager mngr)
{
EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Create a composite section for Deltabeam sections. For more information, see FEM-Design GUI.");
mngr.RegisterUnit(evaluationUnit);

evaluationUnit.RegisterInputParam(new Param_String(), "SectionName", "SectionName", "Composite section name.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "Steel", "Steel", "Steel material.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "Concrete", "Concrete", "Concrete material.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "DeltaBeamProfile", "DeltaBeamProfile", "Steel DeltaBeam profile. Can be 'D' or 'DR' section family types.", 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;

// get input
string name = null;
if (!DA.GetData(0, ref name)) { return; }

Materials.Material steel = new Materials.Material();
if (!DA.GetData(1, ref steel)) { return; }

Materials.Material concrete = new Materials.Material();
if (!DA.GetData(2, ref concrete)) { return; }

Sections.Section deltaProf = null;
if (!DA.GetData(3, ref deltaProf)) { return; }

// check input data
if (steel.Family != Materials.Family.Steel)
{
throw new ArgumentException($"Steel input must be steel material but it is {steel.Family}");
}
if (concrete.Family != Materials.Family.Concrete)
{
throw new ArgumentException($"Concrete input must be concrete material but it is {concrete.Family}");
}

// create composite section
Composites.CompositeSection compositeSection = Composites.CompositeSection.FilledDeltaBeamProfile(name, steel, concrete, deltaProf);

// get output
DA.SetData(0, compositeSection);
}

protected void setModelProps()
{
this.Parent_Component.ExpireSolution(true);
}
}
}
20 changes: 17 additions & 3 deletions FemDesign.Grasshopper/Sections/Composite/EffectiveCompositeSlab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
using FemDesign.Grasshopper.Components.UIWidgets;

using System.Threading.Tasks;

namespace FemDesign.Grasshopper
{
Expand Down Expand Up @@ -94,8 +94,22 @@ public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_Run
throw new ArgumentException($"Concrete input must be concrete material but it is {concrete.Family}");
}

// create composite section
Composites.CompositeSection compositeSection = Composites.CompositeSection.EffectiveCompositeSlab(name, steel, concrete, steelProf, t, bEff, th, bt, bb, filled);
// create task to create composite section
Composites.CompositeSection compositeSection = null;
var task = Task.Run(() =>
{
compositeSection = Composites.CompositeSection.EffectiveCompositeSlab(name, steel, concrete, steelProf, t, bEff, th, bt, bb, filled);
});

task.ConfigureAwait(false);
try
{
task.Wait();
}
catch (Exception ex)
{
throw ex.InnerException;
}

// get output
DA.SetData(0, compositeSection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_Run
DA.GetData(5, ref bf);

double tw = 15;
DA.GetData(8, ref tw);
DA.GetData(6, ref tw);

double tf = 25;
DA.GetData(9, ref tf);
DA.GetData(7, ref tf);

// check input data
if (steel.Family != Materials.Family.Steel)
Expand Down
19 changes: 17 additions & 2 deletions FemDesign.Grasshopper/Sections/Composite/FilledIProfile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
Expand Down Expand Up @@ -70,8 +71,22 @@ public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_Run
throw new ArgumentException($"Concrete input must be concrete material but it is {concrete.Family}");
}

// create composite section
Composites.CompositeSection compositeSection = Composites.CompositeSection.FilledIProfile(name, steel, concrete, iProf, cy, cz);
// create task to create composite section
Composites.CompositeSection compositeSection = null;
var task = Task.Run(() =>
{
compositeSection = Composites.CompositeSection.FilledIProfile(name, steel, concrete, iProf, cy, cz);
});

task.ConfigureAwait(false);
try
{
task.Wait();
}
catch (Exception ex)
{
throw ex.InnerException;
}

// get output
DA.SetData(0, compositeSection);
Expand Down
25 changes: 22 additions & 3 deletions FemDesign.Grasshopper/Sections/Composite/SteelTubeWithIProfile.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
using System;
using System.Threading.Tasks;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;

using FemDesign.Grasshopper.Components.UIWidgets;
using FemDesign.Materials;


namespace FemDesign.Grasshopper
Expand Down Expand Up @@ -53,7 +57,7 @@ public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_Run
if (!DA.GetData(1, ref steelTube)) { return; }

Materials.Material iMaterial = new Materials.Material();
if (!DA.GetData(2, ref steelTube)) { return; }
if (!DA.GetData(2, ref iMaterial)) { return; }

Materials.Material concrete = new Materials.Material();
if (!DA.GetData(3, ref concrete)) { return; }
Expand All @@ -73,8 +77,23 @@ public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_Run
if (concrete.Family != Materials.Family.Concrete)
throw new ArgumentException($"Concrete input must be concrete material but it is {concrete.Family}");

// create composite section
Composites.CompositeSection compositeSection = Composites.CompositeSection.FilledSteelTubeWithIProfile(name, steelTube, iMaterial, concrete, iProfile, d, t);
// create task to create composite section
Composites.CompositeSection compositeSection = null;
var task = Task.Run(() =>
{
compositeSection = Composites.CompositeSection.FilledSteelTubeWithIProfile(name, steelTube, iMaterial, concrete, iProfile, d, t);
});

task.ConfigureAwait(false);
try
{
task.Wait();
}
catch (Exception ex)
{
throw ex.InnerException;
}


// get output
DA.SetData(0, compositeSection);
Expand Down

0 comments on commit ea20fb0

Please sign in to comment.