Skip to content

Commit

Permalink
diaphragm calc type set to integer
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinczandrea committed Jan 15, 2024
1 parent d30ca4c commit a5c2262
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 11 deletions.
9 changes: 6 additions & 3 deletions FemDesign.Core/Calculate/Analysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,19 @@ public bool ElemFine
}
}
[XmlAttribute("diaphragm")]
public bool _diaphragm;
public int _diaphragm;
[XmlIgnore]
public bool Diaphragm
public int Diaphragm
{
get
{
return this._diaphragm;
}
set
{
if (value < 0 || value > 2)
throw new ArgumentException($"Diaphragm is set to {value}. Value must be '0'= None , '1'= Rigid membrane or '2'= Fully rigid.");

this._diaphragm = value;
}
}
Expand All @@ -223,7 +226,7 @@ private Analysis()
{
}

public Analysis(Calculate.Stage stage = null, Stability stability = null, Imperfection imperfection = null, Comb comb = null, Freq freq = null, Footfall footfall = null, bool calcCase = false, bool calcCStage = false, bool calcImpf = false, bool calcComb = false, bool calcGMax = false, bool calcStab = false, bool calcFreq = false, bool calcSeis = false, bool calcDesign = false, bool calcFootfall = false, bool elemFine = true, bool diaphragm = false, bool peakSmoothing = false)
public Analysis(Calculate.Stage stage = null, Stability stability = null, Imperfection imperfection = null, Comb comb = null, Freq freq = null, Footfall footfall = null, bool calcCase = false, bool calcCStage = false, bool calcImpf = false, bool calcComb = false, bool calcGMax = false, bool calcStab = false, bool calcFreq = false, bool calcSeis = false, bool calcDesign = false, bool calcFootfall = false, bool elemFine = true, int diaphragm = 0, bool peakSmoothing = false)
{
this.Stage = stage;
this.Comb = comb ?? Comb.Default();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// https://strusoft.com/
using System;
using System.Collections.Generic;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Special;

using FemDesign.Grasshopper.Extension.ComponentExtension;

namespace FemDesign.Grasshopper
{
Expand Down Expand Up @@ -46,7 +50,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("elemfine", "elemfine", "Fine or standard elements", GH_ParamAccess.item, true);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, false);
pManager.AddIntegerParameter("diaphragm", "diaphragm", "Diaphragm calculation. Connect 'ValueList' to get the options.\n\n'0'= None\n'1'= Rigid membrane\n'2'= Fully rigid", GH_ParamAccess.item, 0);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("peakSmoothing", "peakSmoothing", "Peak smoothing of internal forces", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
Expand All @@ -55,6 +59,10 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Analysis", "Analysis", "Analysis.", GH_ParamAccess.item);
}
protected override void BeforeSolveInstance()
{
ValueListUtils.updateValueLists(this, 17, new List<string> { "None", "Rigid membrane", "Fully rigid" }, new List<int> { 0, 1, 2 }, GH_ValueListMode.DropDown);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
FemDesign.Calculate.Stage stage = null;
Expand Down Expand Up @@ -163,7 +171,7 @@ protected override void SolveInstance(IGH_DataAccess DA)
// pass
}

bool diaphragm = false;
int diaphragm = 0;
if (!DA.GetData(17, ref diaphragm))
{
// pass
Expand Down Expand Up @@ -195,7 +203,7 @@ protected override System.Drawing.Bitmap Icon
}
public override Guid ComponentGuid
{
get { return new Guid("{859B03EA-4AF7-4F30-8788-C6A7B3EC0072}"); }
get { return new Guid("{CC77B519-A3C2-44AC-BD6A-228E7000A836}"); }
}

public override GH_Exposure Exposure => GH_Exposure.secondary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("elemfine", "elemfine", "Fine or standard elements", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, false);
pManager.AddIntegerParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, 0);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("peakSmoothing", "peakSmoothing", "Peak smoothing of internal forces", GH_ParamAccess.item, false);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ protected override void SolveInstance(IGH_DataAccess DA)
// pass
}

bool diaphragm = false;
int diaphragm = 0;
if (!DA.GetData(15, ref diaphragm))
{
// pass
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// https://strusoft.com/
using System;
using Grasshopper.Kernel;

namespace FemDesign.Grasshopper
{
public class CalculationParametersAnalysisDefine_OBSOLETE2212 : FEM_Design_API_Component
{
public CalculationParametersAnalysisDefine_OBSOLETE2212() : base("Analysis.Define", "Analysis", "Set parameters for analysis.", CategoryName.Name(), SubCategoryName.Cat7a())
{

}
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("StageSetting", "StageSetting", "Definition for construction stage calculation method. Optional, if undefined default values will be used - for reference please see default values of Stage.Define component.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddGenericParameter("Comb", "Comb", "Load combination calculation options. Optional, if undefined default values will be used - for reference please see default values of Comb.Define component.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddGenericParameter("Stability", "Stability", "Stability calculation options.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddGenericParameter("Imperfection", "Imperfection", "Imperfection calculation options.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddGenericParameter("Freq", "Freq", "Eigienfrequency calculation options. Optional, if undefined default values will be used - for reference please see default values of Freq.Define component.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddGenericParameter("Footfall", "Footfall", "Footfall calculation options. Optional, if undefined default values will be used - for reference please see default values of Footfall.Define component.", GH_ParamAccess.item);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcCase", "calcCase", "Load cases.", GH_ParamAccess.item, true);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcComb", "calcComb", "Load combinations", GH_ParamAccess.item, true);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcCstage", "calcCstage", "Construction stages.", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcImpf", "calcImpf", "Imperfections", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcGmax", "calcGmax", "Maximum of load groups.", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcStab", "calcStab", "Stability analysis.", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcFreq", "calcFreq", "Eigenfrequencies", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcSeis", "calcSeis", "Seismic analysis.", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcDesign", "calcDesign", "Design calculations", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("calcFootfall", "calcFootfall", "Footfall analysis", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("elemfine", "elemfine", "Fine or standard elements", GH_ParamAccess.item, true);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddIntegerParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, 0);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("peakSmoothing", "peakSmoothing", "Peak smoothing of internal forces", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
}
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Analysis", "Analysis", "Analysis.", GH_ParamAccess.item);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
FemDesign.Calculate.Stage stage = null;
if (!DA.GetData(0, ref stage))
{
// pass
}


FemDesign.Calculate.Comb _comb = FemDesign.Calculate.Comb.Default();
if (!DA.GetData(1, ref _comb))
{
// pass
}


FemDesign.Calculate.Stability _stability = null;
if (!DA.GetData(2, ref _stability))
{
// pass
}


FemDesign.Calculate.Imperfection _imperfection = null;
if (!DA.GetData(3, ref _imperfection))
{
//pass
}

FemDesign.Calculate.Freq _freq = null;
if (!DA.GetData(4, ref _freq))
{
// pass
}

FemDesign.Calculate.Footfall _footfall = null;
if (!DA.GetData(5, ref _footfall))
{
// pass
}

bool calcCase = false;
if (!DA.GetData("calcCase", ref calcCase))
{
// pass
}

bool calcComb = false;
if (!DA.GetData("calcComb", ref calcComb))
{
// pass
}

bool calcCstage = false;
if (!DA.GetData(8, ref calcCstage))
{
// pass
}

bool calcImpf = false;
if (!DA.GetData(9, ref calcImpf))
{
// pass
}


bool calcGMax = false;
if (!DA.GetData(10, ref calcGMax))
{
// pass
}

bool calcStab = false;
if (!DA.GetData(11, ref calcStab))
{
// pass
}

bool calcFreq = false;
if (!DA.GetData(12, ref calcFreq))
{
// pass
}

bool calcSeis = false;
if (!DA.GetData(13, ref calcSeis))
{
// pass
}

bool calcDesign = false;
if (!DA.GetData(14, ref calcDesign))
{
// pass
}

bool calcFootfall = false;
if (!DA.GetData(15, ref calcFootfall))
{
// pass
}

bool elemFine = true;
if (!DA.GetData(16, ref elemFine))
{
// pass
}

int diaphragm = 0;
if (!DA.GetData(17, ref diaphragm))
{
// pass
}

bool peakSmoothing = false;
if (!DA.GetData(18, ref peakSmoothing))
{
// pass
}

if (stage == null || _comb == null || _freq == null)
{
// pass
}

//
FemDesign.Calculate.Analysis obj = new FemDesign.Calculate.Analysis(stage, _stability.DeepClone(), _imperfection.DeepClone(), _comb.DeepClone(), _freq.DeepClone(), _footfall.DeepClone(), calcCase, calcCstage, calcImpf, calcComb, calcGMax, calcStab, calcFreq, calcSeis, calcDesign, calcFootfall, elemFine, diaphragm, peakSmoothing);

// return
DA.SetData(0, obj);
}
protected override System.Drawing.Bitmap Icon
{
get
{
return FemDesign.Properties.Resources.AnalysisDefine;
}
}
public override Guid ComponentGuid
{
get { return new Guid("{859B03EA-4AF7-4F30-8788-C6A7B3EC0072}"); }
}

public override GH_Exposure Exposure => GH_Exposure.hidden;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("elemfine", "elemfine", "Fine or standard elements", GH_ParamAccess.item, true);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, false);
pManager.AddIntegerParameter("diaphragm", "diaphragm", "Diaphragm calculation.", GH_ParamAccess.item, 0);
pManager[pManager.ParamCount - 1].Optional = true;
pManager.AddBooleanParameter("peakSmoothing", "peakSmoothing", "Peak smoothing of internal forces", GH_ParamAccess.item, false);
pManager[pManager.ParamCount - 1].Optional = true;
Expand Down Expand Up @@ -163,7 +163,7 @@ protected override void SolveInstance(IGH_DataAccess DA)
// pass
}

bool diaphragm = false;
int diaphragm = 0;
if (!DA.GetData(17, ref diaphragm))
{
// pass
Expand Down
3 changes: 2 additions & 1 deletion FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Calculate\ApplicationRun.cs" />
<Compile Include="Calculate\CalculationParametersAnalysisDefine.cs" />
<Compile Include="Calculate\OBSOLETE\ApplicationRun_OBSOLETE.cs" />
<Compile Include="Deconstruct\Drawing\TextAnnotationDeconstruct.cs" />
<Compile Include="Deconstruct\Drawing\DimensionLinearDeconstruct.cs" />
Expand Down Expand Up @@ -113,7 +114,7 @@
<Compile Include="Bars\Buckling\BucklingLengthLateralTorsionalDefine.cs" />
<Compile Include="Bars\Buckling\BucklingLengthPressuredBottomFlangeDefine.cs" />
<Compile Include="Bars\Buckling\BucklingLengthPressuredTopFlangeDefine.cs" />
<Compile Include="Calculate\CalculationParametersAnalysisDefine.cs" />
<Compile Include="Calculate\OBSOLETE\CalculationParametersAnalysisDefine_OBSOLETE2212.cs" />
<Compile Include="Calculate\CombSettings.cs" />
<Compile Include="Calculate\FreqDefine.cs" />
<Compile Include="Calculate\OBSOLETE\ApplicationRunAnalysis_OBSOLETE.cs" />
Expand Down

0 comments on commit a5c2262

Please sign in to comment.