Skip to content

Commit

Permalink
Merge branch 'main' into task/GSAGH-397-posthog-cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
kpne authored Oct 13, 2023
2 parents 4f0e9f2 + dedb963 commit 2db6768
Show file tree
Hide file tree
Showing 66 changed files with 874 additions and 214 deletions.
Binary file modified ExampleFiles/Components/Annotate.gh
Binary file not shown.
Binary file added ExampleFiles/Components/AssembleModel.gh
Binary file not shown.
Binary file added ExampleFiles/Components/CreateLoads.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display1d.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display2d.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display3d.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/SpringReactionForces.gh
Binary file not shown.
Binary file added ExampleFiles/Components/TrGen_10Display.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Elements.gh
Binary file not shown.
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Members.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Properties.gh
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion GsaGH/Components/3_Loads/CreateGravityLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ protected override void SolveInstance(IGH_DataAccess da) {
gravityLoad.ApiLoad.Factor = factor;

da.SetData(0, new GsaLoadGoo(gravityLoad));
}
}
}
}
4 changes: 2 additions & 2 deletions GsaGH/Components/3_Loads/CreateGridAreaLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
== GridSurface.Element_Type.ONE_DIMENSIONAL ? "1D" : "2D");
break;
}
case Plane pln:
plane = pln;
case GH_Plane pln:
plane = pln.Value;
gridPlaneSurface = new GsaGridPlaneSurface(plane);
planeSet = true;
UpdateMessage(gridPlaneSurface.GridSurface.ElementType
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/3_Loads/CreateGridLineLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
== GridSurface.Element_Type.ONE_DIMENSIONAL ? "1D" : "2D");
break;
}
case Plane pln:
plane = pln;
case GH_Plane pln:
plane = pln.Value;
gridPlaneSurface = new GsaGridPlaneSurface(plane);
planeSet = true;
UpdateMessage(gridPlaneSurface.GridSurface.ElementType
Expand Down
26 changes: 16 additions & 10 deletions GsaGH/Components/3_Loads/CreateGridPointLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,28 @@ protected override void SolveInternal(IGH_DataAccess da) {
GH_Convert.ToPoint3d(ghPt, ref point3d, GH_Conversion.Both);
}

gridPointLoad.ApiLoad.X = point3d.X;
gridPointLoad.ApiLoad.Y = point3d.Y;

GsaGridPlaneSurface gridPlaneSurface;
Plane plane = Plane.WorldXY;
var ghTyp = new GH_ObjectWrapper();
if (da.GetData(2, ref ghTyp)) {
switch (ghTyp.Value) {
case GsaGridPlaneSurfaceGoo gridplanesurfacegoo: {
case GsaGridPlaneSurfaceGoo gridplanesurfacegoo:
gridPlaneSurface = gridplanesurfacegoo.Value.Duplicate();
gridPointLoad.GridPlaneSurface = gridPlaneSurface;
_expansionType = ExpansionType.UseGpsSettings;
UpdateMessage(gridPlaneSurface.GridSurface.ElementType
== GsaAPI.GridSurface.Element_Type.ONE_DIMENSIONAL ? "1D" : "2D");
break;
}
case Plane pln:
plane = pln;

case GH_Plane pln:
plane = pln.Value;
gridPlaneSurface = new GsaGridPlaneSurface(plane);
gridPointLoad.GridPlaneSurface = gridPlaneSurface;
UpdateMessage(gridPlaneSurface.GridSurface.ElementType
== GsaAPI.GridSurface.Element_Type.ONE_DIMENSIONAL ? "1D" : "2D");
break;

default: {
default:
if (GH_Convert.ToInt32(ghTyp.Value, out int id, GH_Conversion.Both)) {
gridPointLoad.ApiLoad.GridSurface = id;
gridPointLoad.GridPlaneSurface = null;
Expand All @@ -186,11 +183,10 @@ protected override void SolveInternal(IGH_DataAccess da) {
}

break;
}
}
} else {
plane = Plane.WorldXY;
plane.Origin = point3d;
plane.Origin = new Point3d(0, 0, point3d.Z);
gridPlaneSurface = new GsaGridPlaneSurface(plane, true);
gridPointLoad.GridPlaneSurface = gridPlaneSurface;

Expand Down Expand Up @@ -220,6 +216,16 @@ protected override void SolveInternal(IGH_DataAccess da) {
}
}

var plnNormal = new Vector3d(plane.Normal);
plnNormal.Unitize();
if (plnNormal.Z != 1) {
this.AddRuntimeRemark("The grid plane basis is not defined in world coordinates. \n" +
"The input point´s X and Y coordinates are use as the grid plane´s local coordiantes.");
}

gridPointLoad.ApiLoad.X = point3d.X;
gridPointLoad.ApiLoad.Y = point3d.Y;

string dir = "Z";
GsaAPI.Direction direc = GsaAPI.Direction.Z;

Expand Down
33 changes: 20 additions & 13 deletions GsaGH/Components/3_Loads/CreateGridSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public override void VariableParameterMaintenance() {
case FoldMode.OneDimensionalOneWay:
Params.Input[5].NickName = "Dir";
Params.Input[5].Name = "Span Direction";
Params.Input[5].Description = "Span Direction between -180 and 180 degrees";
Params.Input[5].Description = "Span Direction between -Pi and Pi";
Params.Input[5].Access = GH_ParamAccess.item;
Params.Input[5].Optional = true;
break;
Expand Down Expand Up @@ -362,21 +362,28 @@ protected override void SolveInternal(IGH_DataAccess da) {
var ghexp = new GH_Integer();
if (da.GetData(5, ref ghexp)) {
GH_Convert.ToInt32_Primary(ghexp, ref exp);
}

gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_CORNER;
switch (exp) {
case 1:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_SMOOTH;
break;
switch (exp) {
case 0:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_CORNER;
break;

case 2:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_ASPECT;
break;
case 1:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_SMOOTH;
break;

case 3:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.LEGACY;
break;
case 2:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.PLANE_ASPECT;
break;

case 3:
gs.ExpansionType = GsaAPI.GridSurfaceExpansionType.LEGACY;
break;

default:
this.AddRuntimeWarning("Failed to parse expansion type");
break;
}
}

bool simple = true;
Expand Down
35 changes: 31 additions & 4 deletions GsaGH/Components/3_Loads/LoadProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using OasysGH.Units.Helpers;
using OasysUnits;
using OasysUnits.Units;
using Rhino.Display;
using Rhino.Geometry;

namespace GsaGH.Components {
Expand Down Expand Up @@ -136,10 +137,10 @@ ForcePerLengthUnit forcePerLengthUnit
IGsaLoad gsaLoad = loadGoo.Value;
switch (gsaLoad) {
case GsaGravityLoad gravityLoad:
da.SetData(0, new GsaLoadCaseGoo(gravityLoad.LoadCase
da.SetData(0, new GsaLoadCaseGoo(gravityLoad.LoadCase
?? new GsaLoadCase(gravityLoad.ApiLoad.Case)));
da.SetData(1, gravityLoad.ApiLoad.Name);
var gravityList = new GsaList(gravityLoad.Name,
var gravityList = new GsaList(gravityLoad.Name,
gravityLoad.ApiLoad.EntityList, gravityLoad.ApiLoad.EntityType);
da.SetData(2, new GsaListGoo(gravityList));
da.SetData(6, gravityLoad.ApiLoad.Factor.X);
Expand Down Expand Up @@ -183,6 +184,18 @@ var outBeamForce2
da.SetData(7, new GH_UnitNumber(outBeamForce2));
return;

case GsaBeamThermalLoad beamThermalLoad:
da.SetData(0, new GsaLoadCaseGoo(beamThermalLoad.LoadCase
?? new GsaLoadCase(beamThermalLoad.ApiLoad.Case)));
da.SetData(1, beamThermalLoad.ApiLoad.Name);
var beamThermalList = new GsaList(
beamThermalLoad.Name, beamThermalLoad.ApiLoad.EntityList, beamThermalLoad.ApiLoad.EntityType);
da.SetData(2, new GsaListGoo(beamThermalList));
var apiBeamUniformTemperature = new Temperature(beamThermalLoad.ApiLoad.UniformTemperature,
TemperatureUnit.DegreeCelsius);
da.SetData(6, new GH_UnitNumber(apiBeamUniformTemperature));
return;

case GsaFaceLoad faceLoad:
da.SetData(0, new GsaLoadCaseGoo(faceLoad.LoadCase
?? new GsaLoadCase(faceLoad.ApiLoad.Case)));
Expand Down Expand Up @@ -211,6 +224,18 @@ var outBeamForce2
da.SetData(9, new GH_UnitNumber(outFaceForce4));
return;

case GsaFaceThermalLoad faceThermalLoad:
da.SetData(0, new GsaLoadCaseGoo(faceThermalLoad.LoadCase
?? new GsaLoadCase(faceThermalLoad.ApiLoad.Case)));
da.SetData(1, faceThermalLoad.ApiLoad.Name);
var faceThermalList = new GsaList(
faceThermalLoad.Name, faceThermalLoad.ApiLoad.EntityList, faceThermalLoad.ApiLoad.EntityType);
da.SetData(2, new GsaListGoo(faceThermalList));
var apiFaceUniformTemperature = new Temperature(faceThermalLoad.ApiLoad.UniformTemperature,
TemperatureUnit.DegreeCelsius);
da.SetData(6, new GH_UnitNumber(apiFaceUniformTemperature));
return;

case GsaGridPointLoad gridPointLoad:
da.SetData(0, new GsaLoadCaseGoo(gridPointLoad.LoadCase
?? new GsaLoadCase(gridPointLoad.ApiLoad.Case)));
Expand Down Expand Up @@ -249,13 +274,15 @@ var outLineForce2
?? new GsaLoadCase(gridAreaLoad.ApiLoad.Case)));
da.SetData(1, gridAreaLoad.ApiLoad.Name);
var polyline = new Polyline(gridAreaLoad.Points);
if (!polyline.IsClosed) {
if (!polyline.IsClosed && gridAreaLoad.Points.Count > 0) {
var pts = gridAreaLoad.Points.ToList();
pts.Add(pts[0]);
polyline = new Polyline(pts);
}
if (polyline.Count > 0) {
da.SetData(2, polyline);
}

da.SetData(2, polyline);
da.SetData(3, gridAreaLoad.ApiLoad.AxisProperty);
da.SetData(4, gridAreaLoad.ApiLoad.Direction);
var apiAreaForce = new Pressure(gridAreaLoad.ApiLoad.Value,
Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/FootfallResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override void SolveInstance(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Footfall Result only available for Analysis Cases");
return;
}
Expand Down
8 changes: 4 additions & 4 deletions GsaGH/Components/5_Results/GetResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void SolveInstance(IGH_DataAccess da) {
if (type.ToUpper().StartsWith("A")) {
resultType = CaseType.AnalysisCase;
} else if (type.ToUpper().StartsWith("C")) {
resultType = CaseType.Combination;
resultType = CaseType.CombinationCase;
} else {
this.AddRuntimeError("Error converting input " + Params.Input[1].NickName
+ " to 'Analysis' or 'Combination'");
Expand Down Expand Up @@ -145,7 +145,7 @@ protected override void SolveInstance(IGH_DataAccess da) {

break;

case CaseType.Combination:
case CaseType.CombinationCase:
if (_combinationCaseResults == null) {
_combinationCaseResults = model.Model.CombinationCaseResults();
if (_combinationCaseResults == null || _combinationCaseResults.Count == 0) {
Expand Down Expand Up @@ -177,8 +177,8 @@ IReadOnlyDictionary<int, ReadOnlyCollection<NodeResult>> tempNodeCombResult
}

if (!_result.ContainsKey(
new Tuple<CaseType, int>(CaseType.Combination, caseId))) {
_result.Add(new Tuple<CaseType, int>(CaseType.Combination, caseId),
new Tuple<CaseType, int>(CaseType.CombinationCase, caseId))) {
_result.Add(new Tuple<CaseType, int>(CaseType.CombinationCase, caseId),
new GsaResult(model, _combinationCaseResults[caseId], caseId, permutationIDs));
}

Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/GlobalPerformanceResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Global Result only available for Analysis Cases");
return;
}
Expand Down
20 changes: 10 additions & 10 deletions GsaGH/Components/5_Results/SelectResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public override void SetSelected(int i, int j) {
}
case 0: {
if (_selectedItems[i] == _type[1]) {
if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
return;
}

_resultType = CaseType.Combination;
_resultType = CaseType.CombinationCase;
UpdateDropdowns();
}

Expand All @@ -74,7 +74,7 @@ public override void SetSelected(int i, int j) {
string.Join(string.Empty, _selectedItems[i].ToCharArray().Where(char.IsDigit)));
if (newId != _caseId) {
_caseId = newId;
if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
UpdatePermutations();
}
}
Expand Down Expand Up @@ -187,8 +187,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
}
} else if (type.ToUpper().StartsWith("C")) {
_selectedItems[0] = _dropDownItems[0][1];
if (_resultType != CaseType.Combination) {
_resultType = CaseType.Combination;
if (_resultType != CaseType.CombinationCase) {
_resultType = CaseType.CombinationCase;
if (_dropDownItems.Count < 3) {
_dropDownItems.Add(new List<string>() {
"All",
Expand All @@ -213,7 +213,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
var ghACase = new GH_Integer();
if (da.GetData(2, ref ghACase)) {
if (GH_Convert.ToInt32(ghACase, out int analCase, GH_Conversion.Both)) {
if (_resultType == CaseType.Combination && _caseId != analCase) {
if (_resultType == CaseType.CombinationCase && _caseId != analCase) {
UpdatePermutations();
}

Expand Down Expand Up @@ -267,7 +267,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

break;

case CaseType.Combination:
case CaseType.CombinationCase:
if (_combinationCaseResults == null) {
_combinationCaseResults = _gsaModel.Model.CombinationCaseResults();
if (_combinationCaseResults == null || _combinationCaseResults.Count == 0) {
Expand Down Expand Up @@ -319,7 +319,7 @@ protected override void UpdateUIFromSelectedItems() {
if (_selectedItems[0] == _type[0]) {
_resultType = CaseType.AnalysisCase;
} else if (_selectedItems[0] == _type[1]) {
_resultType = CaseType.Combination;
_resultType = CaseType.CombinationCase;
}

if (_selectedItems[1].ToLower() == "all") {
Expand Down Expand Up @@ -363,7 +363,7 @@ private void UpdateDropdowns() {
_dropDownItems[1] = cases;
_selectedItems[1] = type[0] + _caseId.ToString();

if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
if (_dropDownItems.Count < 3) {
_dropDownItems.Add(new List<string>() {
"All",
Expand All @@ -390,7 +390,7 @@ private void UpdateDropdowns() {
}

private void UpdatePermutations() {
if (_resultType != CaseType.Combination) {
if (_resultType != CaseType.CombinationCase) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/TotalLoadsAndReactions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Global Result only available for Analysis Cases");
return;
}
Expand Down
Loading

0 comments on commit 2db6768

Please sign in to comment.