Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristjan Nielsen committed Oct 13, 2023
2 parents 861ab1a + 2db6768 commit 432af59
Show file tree
Hide file tree
Showing 73 changed files with 931 additions and 292 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.
21 changes: 17 additions & 4 deletions GsaGH/Components/0_Model/SaveGsaModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class SaveGsaModel : GH_OasysDropDownComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.SaveGsaModel;
private string _fileNameLastSaved;
private bool _saveInputOverride = false;

public SaveGsaModel() : base("Save GSA Model", "Save",
"Saves your GSA model from this parametric nightmare", CategoryName.Name(),
Expand Down Expand Up @@ -95,8 +96,9 @@ protected override void SolveInternal(IGH_DataAccess da) {
da.GetData(2, ref fileName);

bool save = false;
if (da.GetData(1, ref save) && save) {
if (da.GetData(1, ref save) && (save || _saveInputOverride)) {
Save(ref gsaModel, fileName);
_saveInputOverride = false;
}

da.SetData(0, new GsaModelGoo(gsaModel));
Expand All @@ -121,7 +123,12 @@ internal void Save(ref GsaModel model, string fileNameAndPath) {
}

internal void SaveButtonClick() {
UpdateUI();
if (string.IsNullOrEmpty(_fileNameLastSaved)) {
SaveAsButtonClick();
return;
}

_saveInputOverride = true;
}

internal void SaveAsButtonClick() {
Expand Down Expand Up @@ -153,9 +160,15 @@ internal void SaveAsButtonClick() {
}

internal void OpenGsaExe() {
if (!string.IsNullOrEmpty(_fileNameLastSaved)) {
Process.Start(_fileNameLastSaved);
if (string.IsNullOrEmpty(_fileNameLastSaved)) {
Params.Input[0].CollectData();
var tempModel = (GsaModelGoo)Params.Input[0].VolatileData.AllData(true).First();
string tempPath = Path.GetTempPath() + tempModel.Value.Guid.ToString() + ".gwb";
GsaModel gsaModel = tempModel.Value;
Save(ref gsaModel, tempPath);
}

Process.Start(_fileNameLastSaved);
}
}
}
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/Element2dStresses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override void InitialiseDropdowns() {
_selectedItems = new List<string>();

_dropDownItems.Add(UnitsHelper.GetFilteredAbbreviations(EngineeringUnits.Stress));
_selectedItems.Add(_stresshUnit.ToString());
_selectedItems.Add(Pressure.GetAbbreviation(_stresshUnit));

_isInitialised = true;
}
Expand Down
Loading

0 comments on commit 432af59

Please sign in to comment.