Skip to content

Commit

Permalink
Merge branch '869_ConcealedBars' into 22.9.0_Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Pellegrino committed Oct 31, 2023
2 parents ec52d59 + bd58d08 commit a03e5b8
Show file tree
Hide file tree
Showing 14 changed files with 360 additions and 35 deletions.
30 changes: 30 additions & 0 deletions FemDesign.Core/Bars/Buckling/BucklingData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,35 @@ public static Bar SetOnTimberBar(Bar bar, BucklingLength flexuralStiff, Buckling

return bar;
}

/// <summary>
/// Set BucklingData on a concealed bar-element.
/// </summary>
/// <remarks>Action</remarks>
/// <param name="concealedBar">HiddenBar. Concealed bar-element.</param>
/// <param name="flexuralStiff">BucklingLength definition in Flexural Stiff direction.</param>
/// <param name="flexuralWeak">BucklingLength definition in Flexural Weak direction.</param>
/// <returns></returns>
public static Reinforcement.ConcealedBar SetOnHiddenBar(Reinforcement.ConcealedBar concealedBar, BucklingLength flexuralStiff, BucklingLength flexuralWeak)
{
concealedBar = concealedBar.DeepClone();

if (flexuralStiff.Type != BucklingType.FlexuralStiff)
{
throw new System.ArgumentException("flexuralStiff is not of type FlexuralStiff!");
}
if (flexuralWeak.Type != BucklingType.FlexuralWeak)
{
throw new System.ArgumentException("flexuralWeak is not of type FlexuralWeak!");
}

// add input
BucklingData bucklingData = new BucklingData();
bucklingData.BucklingLength.Add(flexuralStiff);
bucklingData.BucklingLength.Add(flexuralWeak);
concealedBar.BucklingData = bucklingData;

return concealedBar;
}
}
}
2 changes: 1 addition & 1 deletion FemDesign.Core/FemDesign.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
<Compile Include="Reinforcement\Centric.cs" />
<Compile Include="Reinforcement\WireProfileTypeEnum.cs" />
<Compile Include="Reinforcement\ReinforcementDirectionEnum.cs" />
<Compile Include="Reinforcement\HiddenBar.cs" />
<Compile Include="Reinforcement\ConcealedBar.cs" />
<Compile Include="Reinforcement\LongitudinalBar.cs" />
<Compile Include="Reinforcement\NoShear.cs" />
<Compile Include="Reinforcement\Ptc.cs" />
Expand Down
14 changes: 14 additions & 0 deletions FemDesign.Core/Geometry/RectangleType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,19 @@ public partial class RectangleType

[XmlAttribute("y_size")]
public double DimY { get; set; }

private RectangleType()
{

}

public RectangleType(Point3d baseCorner, Vector3d xDir, Vector3d yDir, double xDim, double yDim)
{
this.BaseCorner = baseCorner;
this.LocalX = xDir;
this.LocalY = yDir;
this.DimX = xDim;
this.DimY = yDim;
}
}
}
2 changes: 1 addition & 1 deletion FemDesign.Core/Model/Entities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial class Entities
public List<StruSoft.Interop.StruXml.Data.Beam_reduction_zone_type> BeamReductionZones { get; set; }

[XmlElement("hidden_bar", Order = 9)]
public List<Reinforcement.HiddenBar> HiddenBars { get; set; } = new List<Reinforcement.HiddenBar>();
public List<Reinforcement.ConcealedBar> HiddenBars { get; set; } = new List<Reinforcement.ConcealedBar>();

[XmlElement("bar_reinforcement", Order = 10)]
public List<Reinforcement.BarReinforcement> BarReinforcements { get; set; } = new List<Reinforcement.BarReinforcement>();
Expand Down
40 changes: 40 additions & 0 deletions FemDesign.Core/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,45 @@ private bool PtcInModel(Reinforcement.Ptc obj)
return false;
}


/// <summary>
/// Add Post-tensioned cable to Model.
/// </summary>
private void AddConcealedBar(Reinforcement.ConcealedBar obj, bool overwrite)
{
// in model?
bool inModel = this.ConcealedBarInModel(obj);

// in model, don't overwrite
if (inModel && overwrite == false)
{
throw new System.ArgumentException($"{obj.GetType().FullName} with guid: {obj.Guid} has already been added to model. Are you adding the same element twice?");
}

// in model, overwrite
else if (inModel && overwrite == true)
{
this.Entities.HiddenBars.RemoveAll(x => x.Guid == obj.Guid);
}

// add concealed bar
this.Entities.HiddenBars.Add(obj);
}

private bool ConcealedBarInModel(Reinforcement.ConcealedBar obj)
{
foreach (Reinforcement.ConcealedBar elem in this.Entities.HiddenBars)
{
if (elem.Guid == obj.Guid)
{
return true;
}
}
return false;
}



/// <summary>
/// Add Fictitious Bar to Model.
/// </summary>
Expand Down Expand Up @@ -3472,6 +3511,7 @@ public Model AddSupports<T>(params T[] supports) where T : ISupportElement
private void AddEntity(Shells.Slab obj, bool overwrite) => AddSlab(obj, overwrite);
private void AddEntity(Shells.Panel obj, bool overwrite) => AddPanel(obj, overwrite);
private void AddEntity(Reinforcement.Ptc obj, bool overwrite) => AddPtc(obj, overwrite);
private void AddEntity(Reinforcement.ConcealedBar obj, bool overwrite) => AddConcealedBar(obj, overwrite);


private void AddEntity(ModellingTools.Cover obj, bool overwrite) => AddCover(obj, overwrite);
Expand Down
76 changes: 71 additions & 5 deletions FemDesign.Core/Reinforcement/BarReinforcement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public BarReinforcement()
}

/// <summary>
/// Construct stirrup bar reinforcement
/// Construct stirrup bar reinforcement for a normal bar
/// </summary>
public BarReinforcement(Guid baseBar, Wire wire, Stirrups stirrups)
{
Expand All @@ -112,7 +112,7 @@ public BarReinforcement(Guid baseBar, Wire wire, Stirrups stirrups)
}

/// <summary>
/// Construct stirrup bar reinforcement
/// Construct stirrup bar reinforcement for a normal bar
/// </summary>
public BarReinforcement(Bars.Bar bar, Wire wire, Stirrups stirrups)
{
Expand All @@ -121,9 +121,20 @@ public BarReinforcement(Bars.Bar bar, Wire wire, Stirrups stirrups)
this.Wire = wire;
this.Stirrups = stirrups;
}

/// <summary>
/// Construct longitudinal bar reinforcement
/// Construct stirrup bar reinforcement for a concealed bar
/// </summary>
public BarReinforcement(ConcealedBar concealedBar, Wire wire, Stirrups stirrups)
{
this.EntityCreated();
this.BaseBar = new GuidListType(concealedBar.Guid);
this.Wire = wire;
this.Stirrups = stirrups;
}

/// <summary>
/// Construct longitudinal bar reinforcement for a normal bar
/// </summary>
public BarReinforcement(Guid baseBar, Wire wire, LongitudinalBar longBar)
{
Expand All @@ -134,7 +145,7 @@ public BarReinforcement(Guid baseBar, Wire wire, LongitudinalBar longBar)
}

/// <summary>
/// Construct longitudinal bar reinforcement
/// Construct longitudinal bar reinforcement for a normal bar
/// </summary>
public BarReinforcement(Bars.Bar bar, Wire wire, LongitudinalBar longBar)
{
Expand All @@ -144,6 +155,17 @@ public BarReinforcement(Bars.Bar bar, Wire wire, LongitudinalBar longBar)
this.LongitudinalBar = longBar;
}

/// <summary>
/// Construct longitudinal bar reinforcement for a concealed bar
/// </summary>
public BarReinforcement(ConcealedBar concealedBar, Wire wire, LongitudinalBar longBar)
{
this.EntityCreated();
this.BaseBar = new GuidListType(concealedBar.Guid);
this.Wire = wire;
this.LongitudinalBar = longBar;
}

/// <summary>
/// Add reinforcement to bar.
/// Internal method use by GH components and Dynamo nodes.
Expand Down Expand Up @@ -207,6 +229,50 @@ public static Bars.Bar AddReinforcementToBar(Bars.Bar bar, List<BarReinforcement
return bar;
}

/// <summary>
/// Add reinforcement to a concealed bar.
/// </summary>
/// <param name="concealedBar"></param>
/// <param name="rebar"></param>
/// <param name="overwrite">Overwrite rebar on bar if a rebar sharing guid already exists on the bar?</param>
public static ConcealedBar AddReinforcementToHiddenBar(ConcealedBar concealedBar, List<BarReinforcement> rebar, bool overwrite)
{
foreach (BarReinforcement item in rebar)
{
// empty base bar - update with current barPart guid
if (item.BaseBar.Guid == Guid.Empty)
{
item.BaseBar.Guid = concealedBar.Guid;
}

// base bar does not equal current barPart guid - reinforcement probably added to another bar already.
else if (item.BaseBar.Guid != concealedBar.Guid)
{
throw new System.ArgumentException($"{item.GetType().FullName} with guid: {item.Guid} has a base bar guid: {item.BaseBar.Guid} that does not correnspond with the current concealed bar");
}

// add reinforcement to current bar
bool exists = concealedBar.Reinforcement.Any(x => x.Guid == item.Guid);
if (exists)
{
if (overwrite)
{
concealedBar.Reinforcement.RemoveAll(x => x.Guid == item.Guid);
concealedBar.Reinforcement.Add(item);
}
else
{
throw new System.ArgumentException($"{item.GetType().FullName} with guid: {item.Guid} has already been added to the concealed bar. Are you adding the same element twice?");
}
}
else
{
concealedBar.Reinforcement.Add(item);
}
}
return concealedBar;
}

public override string ToString()
{
return $"{this.GetType().FullName} - {this.Wire}";
Expand Down
95 changes: 95 additions & 0 deletions FemDesign.Core/Reinforcement/ConcealedBar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// https://strusoft.com/
using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using FemDesign.GenericClasses;
using FemDesign.Geometry;


namespace FemDesign.Reinforcement
{
[System.Serializable]
public partial class ConcealedBar: NamedEntityBase, IStructureElement
{
private static int _concealedBarInstances = 0;
protected override int GetUniqueInstanceCount() => ++_concealedBarInstances;

[XmlElement("rectangle", Order = 1)]
public RectangleType Rectangle { get; set; }

[XmlElement("start", Order = 2)]
public Point3d Start { get; set; }

[XmlElement("buckling_data", Order = 3)]
public Bars.Buckling.BucklingData BucklingData { get; set; }

[XmlElement("end", Order = 4)]
public string End = "";

[XmlAttribute("base_shell")]
public Guid BaseShell { get; set; }

[XmlAttribute("axis_in_longer_side")]
[DefaultValue(true)]
public bool AxisInLongerSide { get; set; } = true;


[XmlIgnore]
public List<BarReinforcement> Reinforcement = new List<BarReinforcement>();

[XmlIgnore]
public List<BarReinforcement> Stirrups
{
get
{
return this.Reinforcement.Where(x => x.Stirrups != null).ToList();
}
}
[XmlIgnore]
public List<BarReinforcement> LongitudinalBars
{
get
{
return this.Reinforcement.Where(x => x.LongitudinalBar != null).ToList();
}
}

private ConcealedBar()
{

}

/// <summary>
/// Concealed bar constructor.
/// </summary>
/// <param name="slab">Base shell element.</param>
/// <param name="rectangle">Rectangle area where the concealed bar is specified. Must be inside the SlabPart region boundary.</param>
/// <param name="axisInLongerSide">If true, the axis of the concealed bar is parallel to the longer side of the rectangle, otherwise it is parallel to the shorter side.</param>
/// <param name="identifier">Structural element identifier.</param>
/// <exception cref="System.ArgumentException"></exception>
public ConcealedBar(Shells.Slab slab, RectangleType rectangle, bool axisInLongerSide = true, string identifier = "CB")
{
if (slab.SlabPart.ComplexMaterial.Concrete == null)
{
throw new System.ArgumentException("Slab material must be concrete!");
}

this.EntityCreated();
this.BaseShell = slab.SlabPart.Guid;
this.AxisInLongerSide = axisInLongerSide;
//if(axisInLongerSide)
//{
// this.Start = rectangle.BaseCorner + new Vector3d(0, rectangle.DimY / 2, 0);
//}
//else
//{
// this.Start = rectangle.BaseCorner + new Vector3d(rectangle.DimX / 2, 0, 0);
//}
this.Rectangle = rectangle;
this.Identifier = identifier;
}

}
}
27 changes: 0 additions & 27 deletions FemDesign.Core/Reinforcement/HiddenBar.cs

This file was deleted.

2 changes: 2 additions & 0 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
</Compile>
<Compile Include="Reinforcement\BarReinforcementLongitudinal.cs" />
<Compile Include="Reinforcement\BarReinforcementStirrups.cs" />
<Compile Include="Reinforcement\ConcealedBar.cs" />
<Compile Include="Reinforcement\InteractionSurface\InteractionSurface_OnBar.cs" />
<Compile Include="Reinforcement\InteractionSurface\InteractionSurface_Pipe.cs" />
<Compile Include="Reinforcement\InteractionSurface\Layer.cs" />
Expand Down Expand Up @@ -944,6 +945,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="images\logo.png" />
<None Include="Resources\icons\ConcealedBar.png" />
<None Include="Resources\icons\ModellingToolsDeconstruct.png" />
<None Include="Resources\icons\SurfaceConnection.png" />
<None Include="Resources\icons\SurfaceConnectionDeconstruct.png" />
Expand Down
Loading

0 comments on commit a03e5b8

Please sign in to comment.