Skip to content

Commit

Permalink
GSAGH-384 GridLoadHelper.ListSeparator
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Reinhardt committed Oct 5, 2023
1 parent bb4e3cc commit 26ff330
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions GsaGH/Parameters/3_Loads/GridLoadHelper.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Globalization;
using System;
using GsaAPI;
using OasysUnits;
using Rhino.Collections;
using Rhino.Geometry;
using LengthUnit = OasysUnits.Units.LengthUnit;

namespace GsaGH.Parameters {
internal static class GridLoadHelper {
private static readonly char ListSeparator = Convert.ToChar(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
internal static char ListSeparator = GetListSeparator();

internal static string CreateDefinition(Point3dList controlPoints, Plane plane) {
string desc = string.Empty;
Expand Down Expand Up @@ -67,5 +66,13 @@ private static (LengthUnit lengthUnit, string def) ClearDefGetUnit(string defini
definition = definition.Replace("(m)", string.Empty);
return (lengthUnit, definition);
}

internal static char GetListSeparator() {
// this is a hack, because GSA doesn´t use CultureInfo.CurrentCulture.TextInfo.ListSeparator
var gridLineLoad = new GridLineLoad {
PolyLineDefinition = "(0, 0) (1, 0) (m)"
};
return gridLineLoad.PolyLineDefinition[2];
}
}
}
2 changes: 1 addition & 1 deletion GsaGHTests/3_Components/3_Loads/CreateGridLineLoadTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void CreateGridLineLoadTest() {
var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaGridLineLoad)output.Value;
Assert.Equal(7, load.LoadCase.Id);
Assert.Equal("(10,5) (20,6)(m)", load.ApiLoad.PolyLineDefinition);
Assert.Equal("(10" + GridLoadHelper.ListSeparator + "5) (20" + GridLoadHelper.ListSeparator + "6)(m)", load.ApiLoad.PolyLineDefinition);
Assert.Equal(0, load.ApiLoad.PolyLineReference);
Assert.Equal("myGridLineLoad", load.ApiLoad.Name);
Assert.Equal(-5000, load.ApiLoad.ValueAtStart);
Expand Down

0 comments on commit 26ff330

Please sign in to comment.