Skip to content

Commit

Permalink
Merge pull request #270 from arup-group/GSAGH-181-SectionDimensions-n…
Browse files Browse the repository at this point in the history
…ot-working-for-welded-beams

GSAGH-181 section dimensions not working for welded beams
  • Loading branch information
tlmnrnhrdt authored Jan 11, 2023
2 parents c0afd6f + ddd9f35 commit 251ef9c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
1 change: 0 additions & 1 deletion GsaGH/Components/1_Properties/CreateProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
using GsaGH.Helpers;
using GsaGH.Helpers.GH;
using GsaGH.Helpers.GsaAPI;
using OasysGH;
Expand Down
13 changes: 8 additions & 5 deletions GsaGH/Components/1_Properties/GetSectionDimensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

namespace GsaGH.Components
{
/// <summary>
/// Component to get geometric dimensions of a section
/// </summary>
public class GetSectionDimensions : GH_OasysComponent, IGH_VariableParameterComponent
/// <summary>
/// Component to get geometric dimensions of a section
/// </summary>
public class GetSectionDimensions : GH_OasysComponent, IGH_VariableParameterComponent
{
#region Name and Ribbon Layout
public override Guid ComponentGuid => new Guid("98765d83-2b23-47c1-ad1d-201b5a2eed8b");
Expand Down Expand Up @@ -438,7 +438,10 @@ protected override void SolveInstance(IGH_DataAccess DA)
DA.SetData(i++, new GH_UnitNumber(new Length(sqlValues[3], unit).ToUnit(this.LengthUnit))); //Flange Thk Top
DA.SetData(i++, new GH_UnitNumber(new Length(sqlValues[3], unit).ToUnit(this.LengthUnit))); //Flange Thk Bottom
DA.SetData(i++, new GH_UnitNumber(new Length(sqlValues[2], unit).ToUnit(this.LengthUnit))); //Web Thk Bottom
DA.SetData(i++, new GH_UnitNumber(new Length(sqlValues[4], unit).ToUnit(this.LengthUnit))); //Root radius
if (sqlValues.Count > 4)
DA.SetData(i++, new GH_UnitNumber(new Length(sqlValues[4], unit).ToUnit(this.LengthUnit))); //Root radius
else
DA.SetData(i++, new GH_UnitNumber(Length.Zero.ToUnit(this.LengthUnit))); // welded section don´t have a root radius
DA.SetData(i++, null); //Spacing
DA.SetData(i, "CAT");
}
Expand Down
8 changes: 1 addition & 7 deletions GsaGH/Components/4_Analysis/Analyse.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using Grasshopper.GUI;
using System.Windows.Forms;
using Grasshopper.GUI;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using GsaAPI;
using GsaGH.Helpers;
using GsaGH.Helpers.GH;
using GsaGH.Parameters;
using OasysGH;
Expand All @@ -18,8 +14,6 @@
using OasysGH.Units.Helpers;
using OasysUnits;
using OasysUnits.Units;
using Rhino.Runtime;
using System.Drawing;

namespace GsaGH.Components
{
Expand Down
27 changes: 23 additions & 4 deletions GsaGH/Helpers/GsaAPI/SqlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,8 @@ public static List<double> GetCatalogueProfileValues(string profileString, strin
$"SECT_FLG_THICK || ' -- ' || " +
$"SECT_ROOT_RAD " +
$"as SECT_NAME from Sect INNER JOIN Types ON Sect.SECT_TYPE_NUM = Types.TYPE_NUM where SECT_NAME = \"{profileString}\" ORDER BY SECT_DATE_ADDED";

List<string> data = new List<string>();

cmd.CommandType = CommandType.Text;
List<string> data = new List<string>();
SQLiteDataReader r = cmd.ExecuteReader();
while (r.Read())
{
Expand All @@ -230,9 +228,30 @@ public static List<double> GetCatalogueProfileValues(string profileString, strin
// example (IPE100): 0.1 -- 0.055 -- 0.0041 -- 0.0057 -- 0.007
data.Add(sqlData);
}
db.Close();

string[] vals = data[0].Split(new string[] { " -- " }, StringSplitOptions.None);
// in case of welded sections this didn´t return a result
if (vals.Length <= 1)
{
cmd = db.CreateCommand();
cmd.CommandText = $"Select " +
$"SECT_DEPTH_DIAM || ' -- ' || " +
$"SECT_WIDTH || ' -- ' || " +
$"SECT_WEB_THICK || ' -- ' || " +
$"SECT_FLG_THICK " +
$"as SECT_NAME from Sect INNER JOIN Types ON Sect.SECT_TYPE_NUM = Types.TYPE_NUM where SECT_NAME = \"{profileString}\" ORDER BY SECT_DATE_ADDED";
cmd.CommandType = CommandType.Text;
data = new List<string>();
r = cmd.ExecuteReader();
while (r.Read())
{
string sqlData = Convert.ToString(r["SECT_NAME"]);
data.Add(sqlData);
}
}
db.Close();

vals = data[0].Split(new string[] { " -- " }, StringSplitOptions.None);

NumberFormatInfo noComma = CultureInfo.InvariantCulture.NumberFormat;

Expand Down

0 comments on commit 251ef9c

Please sign in to comment.