Skip to content

Commit

Permalink
Fix handling of fabricated box profiles
Browse files Browse the repository at this point in the history
For cases where the flange thicknesses are equal, box 2 can be used instead of box 3, which makes it possible to support tapered sections.
Also, adding a check when pulling BOX2 type sections if a Frabricated box can be returned rather than a GeneralisedFabBox
  • Loading branch information
IsakNaslundBh committed Nov 10, 2022
1 parent 92b5c93 commit 5991e49
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ private static IProfile NonStandardProfile(IRobotBarSectionShapeType shapeType,
if (outstand < 0 && Math.Abs(outstand) < Tolerance.MicroDistance)
outstand = 0;

sectionProfile = BH.Engine.Spatial.Create.GeneralisedFabricatedBoxProfile(h + (2 * tf), b1 + (2 * tw), tw, tf, tf, outstand, outstand);
//If outstands are 0 (less than microdistance fraction of the width) return a standard fabricated box section.
if (b1 > Tolerance.Distance && outstand / b1 < Tolerance.MicroDistance)
sectionProfile = BH.Engine.Spatial.Create.FabricatedBoxProfile(h + (2 * tf), b1 + 2 * tw, tw, tf, tf, 0);
else
sectionProfile = BH.Engine.Spatial.Create.GeneralisedFabricatedBoxProfile(h + (2 * tf), b1 + (2 * tw), tw, tf, tf, outstand, outstand);
break;

case IRobotBarSectionShapeType.I_BSST_USER_BOX_3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using BH.oM.Structure.SectionProperties;
using BH.oM.Spatial.ShapeProfiles;
using System.Linq;
using BH.oM.Geometry;

namespace BH.Adapter.Robot
{
Expand Down Expand Up @@ -86,15 +87,16 @@ private static bool ToRobotGeometricalSection(this TaperedProfile section, IRobo
{
if (SetRobotTypeAndShapeType(startProfile as dynamic, sectionData))
{
SetNonStandardSectionData(startProfile as dynamic, sectionData, 0);
SetNonStandardSectionData(endProfile as dynamic, sectionData, 1);
sectionData.CalcNonstdGeometry();
return true;
bool success = SetNonStandardSectionData(startProfile as dynamic, sectionData, 0);
success &= SetNonStandardSectionData(endProfile as dynamic, sectionData, 1);
if(success)
sectionData.CalcNonstdGeometry();
return success;
}
}
}

Engine.Base.Compute.RecordWarning("The robot adapter currently only support tapered sections with two profiles of the same type. Section set as explicit with 0-properties.");
Engine.Base.Compute.RecordWarning($"The robot adapter currently only support tapered sections with two profiles of the same type. Section with name {sectionData.Name} set as explicit section with 0-properties.");
return false;
}

Expand All @@ -111,8 +113,17 @@ private static bool SetRobotTypeAndShapeType(this BoxProfile section, IRobotBarS

private static bool SetRobotTypeAndShapeType(this FabricatedBoxProfile section, IRobotBarSectionData sectionData)
{
sectionData.Type = IRobotBarSectionType.I_BST_NS_BOX_3;
sectionData.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_BOX_3;
if (section.BotFlangeThickness > Tolerance.MicroDistance && (section.BotFlangeThickness - section.TopFlangeThickness) / (section.BotFlangeThickness + section.TopFlangeThickness) / 2 < 1e-6) //If same flange thickness on both top and bot flange
{
sectionData.Type = IRobotBarSectionType.I_BST_NS_BOX_2;
sectionData.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_BOX_2;
}
else
{
sectionData.Type = IRobotBarSectionType.I_BST_NS_BOX_3;
sectionData.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_BOX_3;
}

return true;
}

Expand Down Expand Up @@ -200,7 +211,7 @@ private static bool SetRobotTypeAndShapeType(this GeneralisedFabricatedBoxProfil

private static bool SetRobotTypeAndShapeType(this IProfile section, IRobotBarSectionData sectionData)
{
Engine.Base.Compute.RecordWarning("Profile of type " + section.GetType().Name + " is not yet fully supported for Steel sections. Section with name " + sectionData.Name + " set as explicit section");
Engine.Base.Compute.RecordWarning("Profile of type " + section.GetType().Name + " is not yet fully supported for Steel sections. Section with name " + sectionData.Name + " set as explicit section.");
return false;
}

Expand All @@ -222,13 +233,32 @@ private static bool SetNonStandardSectionData(this FabricatedBoxProfile section,
{
IRobotBarSectionNonstdData nonStdData = sectionData.CreateNonstd(position);

nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B, section.Width);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B1, section.Width - (2 * section.WebThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B2, section.Width);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_H, section.Height - (section.TopFlangeThickness + section.BotFlangeThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TW, section.WebThickness);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TF, section.TopFlangeThickness);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TF2, section.BotFlangeThickness);
if (sectionData.ShapeType == IRobotBarSectionShapeType.I_BSST_USER_BOX_3) //Check assigned shapetype. Box3 for varying flange thickness, box 2 will be set if flange thickness the same
{
if (position != 0) //Tapered sections only support box 2
{
BH.Engine.Base.Compute.RecordWarning($"Robot only supports boxes with equal flanges for tapered sections. Section with name {sectionData.Name} set as explicit section with 0 properties.");
return false;
}

nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B, section.Width);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B1, section.Width - (2 * section.WebThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_B2, section.Width);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_H, section.Height - (section.TopFlangeThickness + section.BotFlangeThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TW, section.WebThickness);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TF, section.TopFlangeThickness);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_3_TF2, section.BotFlangeThickness);

}
else
{
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_2_B, section.Width);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_2_B1, section.Width - (2 * section.WebThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_2_H, section.Height - (section.TopFlangeThickness + section.BotFlangeThickness));
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_2_TW, section.WebThickness);
nonStdData.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_BOX_2_TF, section.TopFlangeThickness);
}

return true;
}

Expand Down

0 comments on commit 5991e49

Please sign in to comment.