Skip to content

Commit

Permalink
Merge branch 'nic/dev' of https://github.com/arup-group/speckle-sharp
Browse files Browse the repository at this point in the history
…into jm/dev/gsa-connector
  • Loading branch information
jenessaman committed Feb 11, 2022
2 parents 0991057 + 571d817 commit 9f6a695
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
8 changes: 4 additions & 4 deletions ConnectorGSA/ConnectorGSATests/SchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public void GsaLoadCase()
"LOAD_TITLE.2\t18\tLoad case 18\tLC_ACCIDENTAL\t1\t~\tNONE\tINC_UNDEF\t",
"LOAD_TITLE.2\t19\tLoad case 19\tLC_EQE_RSA\t1\t~\tX\tINC_UNDEF\t",
"LOAD_TITLE.2\t20\tLoad case 20\tLC_EQE_ACC\t1\t~\tX\tINC_UNDEF\t",
"LOAD_TITLE.2\t21\tLoad case 21\tLC_EQE_STAT\t1\t~\tX\tINC_UNDEF\t",
"LOAD_TITLE.2\t21\tLoad case 21\tLC_EQE_STAT\t1\t~\tX\tINC_UNDEF\t"
};
var loadCases = new List<GsaLoadCase>();
int i = 1;
Expand Down Expand Up @@ -524,9 +524,9 @@ public void GsaLoadCase()
Assert.Equal(StructuralLoadCaseType.Rain, loadCases[14].CaseType);
Assert.Equal(StructuralLoadCaseType.Thermal, loadCases[15].CaseType);
Assert.Equal(StructuralLoadCaseType.Generic, loadCases[16].CaseType);
Assert.Equal(StructuralLoadCaseType.Generic, loadCases[17].CaseType);
Assert.Equal(StructuralLoadCaseType.Earthquake, loadCases[18].CaseType);
Assert.Equal(StructuralLoadCaseType.Earthquake, loadCases[19].CaseType);
Assert.Equal(StructuralLoadCaseType.Accidental, loadCases[17].CaseType);
Assert.Equal(StructuralLoadCaseType.EarthquakeRSA, loadCases[18].CaseType);
Assert.Equal(StructuralLoadCaseType.EarthquakeAccTors, loadCases[19].CaseType);
Assert.Equal(StructuralLoadCaseType.Earthquake, loadCases[20].CaseType);

for (i = 0; i < loadCases.Count(); i++)
Expand Down
17 changes: 10 additions & 7 deletions ConnectorGSA/GSAProxy/GwaParsers/Loading/GsaLoadCaseParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,18 @@ private StructuralLoadCaseType StringToLoadCaseType(string type)
case "LC_VAR_ROOF":
return StructuralLoadCaseType.Live;
case "WIND":
case "LC_VAR_WIND":
case "LC_VAR_WIND":
return StructuralLoadCaseType.Wind;
case "SNOW":
case "LC_VAR_SNOW":
case "LC_VAR_SNOW":
return StructuralLoadCaseType.Snow;
case "LC_VAR_RAIN":
return StructuralLoadCaseType.Rain;
case "LC_VAR_RAIN": return StructuralLoadCaseType.Rain;
case "SEISMIC":
case "LC_EQE_ACC":
case "LC_EQE_STAT":
case "LC_EQE_RSA":
case "LC_EQE_STAT":
return StructuralLoadCaseType.Earthquake;
case "LC_EQE_ACC": return StructuralLoadCaseType.EarthquakeAccTors;
case "LC_EQE_RSA": return StructuralLoadCaseType.EarthquakeRSA;
case "LC_ACCIDENTAL": return StructuralLoadCaseType.Accidental;
case "LC_PERM_SOIL": return StructuralLoadCaseType.Soil;
case "LC_VAR_TEMP": return StructuralLoadCaseType.Thermal;
default:
Expand All @@ -173,8 +173,11 @@ private string LoadCaseTypeToString(StructuralLoadCaseType caseType)
case StructuralLoadCaseType.Snow: return ("LC_VAR_SNOW");
case StructuralLoadCaseType.Rain: return ("LC_VAR_RAIN");
case StructuralLoadCaseType.Earthquake: return ("LC_EQE_STAT");
case StructuralLoadCaseType.EarthquakeAccTors: return ("LC_EQE_ACC");
case StructuralLoadCaseType.EarthquakeRSA: return ("LC_EQE_RSA");
case StructuralLoadCaseType.Soil: return ("LC_PERM_SOIL");
case StructuralLoadCaseType.Thermal: return ("LC_VAR_TEMP");
case StructuralLoadCaseType.Accidental: return ("LC_ACCIDENTAL");
default: return ("LC_UNDEF");
}
}
Expand Down
5 changes: 4 additions & 1 deletion ConnectorGSA/Speckle.GSA.API/GwaSchema/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,10 @@ public enum StructuralLoadCaseType
Snow,
Wind,
Earthquake,
Thermal
EarthquakeAccTors,
EarthquakeRSA,
Thermal,
Accidental
}

public enum StructuralSolutionType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,11 @@ private List<GsaRecord> GSAGridSurfaceToNative(Base speckleObject)

private double Hypotenuse(double a, double o) => Math.Sqrt((a * a) + (o * o));

private bool IsGlobalAxis(Axis x) => ((x.axisType == AxisType.Cartesian)
&& x.definition.origin.Equals(Origin, GeometricDecimalPlaces)
&& x.definition.xdir.Equals(UnitX, GeometricDecimalPlaces)
&& x.definition.ydir.Equals(UnitY, GeometricDecimalPlaces)
&& x.definition.normal.Equals(UnitZ, GeometricDecimalPlaces));
private bool IsGlobalAxis(Axis x) => ((x.axisType == AxisType.Cartesian) && ((x.definition == null)
|| (x.definition.origin.Equals(Origin, GeometricDecimalPlaces)
&& x.definition.xdir.Equals(UnitX, GeometricDecimalPlaces)
&& x.definition.ydir.Equals(UnitY, GeometricDecimalPlaces)
&& x.definition.normal.Equals(UnitZ, GeometricDecimalPlaces))));

private bool IsXElevationAxis(Axis x) => ((x.axisType == AxisType.Cartesian)
&& x.definition.origin.Equals(Origin, GeometricDecimalPlaces)
Expand Down Expand Up @@ -1423,7 +1423,7 @@ private List<GsaRecord> LoadNodeToNative(Base speckleObject)
var factor = speckleLoad.GetScaleFactor(conversionFactors);
gsaLoad.Value = factor * speckleLoad.value;
}
if (speckleLoad.loadAxis.definition.IsGlobal())
if ((speckleLoad.loadAxis == null) || (speckleLoad.loadAxis.definition.IsGlobal()))
{
gsaLoad.GlobalAxis = true;
}
Expand Down Expand Up @@ -2712,7 +2712,7 @@ private bool GetAxis(Axis speckleAxis, out NodeAxisRefType gsaAxisRefType, out i
{
gsaAxisRefType = NodeAxisRefType.NotSet;
gsaAxisIndex = null;
if (speckleAxis == null)
if (speckleAxis == null || speckleAxis.definition == null)
{
gsaAxisRefType = NodeAxisRefType.Global;
return true;
Expand Down
9 changes: 6 additions & 3 deletions Objects/Converters/ConverterGSA/ConverterGSA/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public static bool Is3dMember(this GsaMemb gsaMemb)

public static bool IsGlobal(this Plane p)
{
return (p.origin.x == 0 && p.origin.y == 0 && p.origin.z == 0 &&
return ((p == null) || ((p.origin.x == 0 && p.origin.y == 0 && p.origin.z == 0 &&
p.xdir.x == 1 && p.xdir.y == 0 && p.xdir.z == 0 &&
p.ydir.x == 0 && p.ydir.y == 1 && p.ydir.z == 0 &&
p.normal.x == 0 && p.normal.y == 0 && p.normal.z == 1);
p.normal.x == 0 && p.normal.y == 0 && p.normal.z == 1)));
}

public static bool IsXElevation(this Plane p)
Expand Down Expand Up @@ -320,7 +320,7 @@ public static GridExpansion ToNative(this LoadExpansion gsaExpansion)
default: return GridExpansion.NotSet;
}
}

public static LoadType ToSpeckle(this StructuralLoadCaseType gsaLoadType)
{
switch (gsaLoadType)
Expand Down Expand Up @@ -896,12 +896,15 @@ public static StructuralLoadCaseType ToNative(this LoadType speckleType)
{
case LoadType.Dead: return StructuralLoadCaseType.Dead;
case LoadType.SeismicStatic: return StructuralLoadCaseType.Earthquake;
case LoadType.SeismicAccTorsion: return StructuralLoadCaseType.EarthquakeAccTors;
case LoadType.SeismicRSA: return StructuralLoadCaseType.EarthquakeRSA;
case LoadType.Live: return StructuralLoadCaseType.Live;
case LoadType.Rain: return StructuralLoadCaseType.Rain;
case LoadType.Snow: return StructuralLoadCaseType.Snow;
case LoadType.Soil: return StructuralLoadCaseType.Soil;
case LoadType.Thermal: return StructuralLoadCaseType.Thermal;
case LoadType.Wind: return StructuralLoadCaseType.Wind;
case LoadType.Accidental: return StructuralLoadCaseType.Accidental;
case LoadType.None: return StructuralLoadCaseType.NotSet;
default: return StructuralLoadCaseType.Generic;
}
Expand Down

0 comments on commit 9f6a695

Please sign in to comment.