Skip to content

Commit

Permalink
Squashed commit of the following: #998 #1033 EdgeConnection input as …
Browse files Browse the repository at this point in the history
…list for panels, slabs and fictitious shells

commit 8756ba6
Author: lorinczandrea <[email protected]>
Date:   Thu Jun 27 05:51:52 2024 +0200

    :sparkles: edge connection input as list

    #998 #1033

    Summary: EdgeConnection input can be set up as list for slabs, panels and fictitious shells. Tested.

commit 6ebefa7
Author: lorinczandrea <[email protected]>
Date:   Tue Jun 25 21:54:40 2024 +0200

    :construction: set EdgeConnections on Slabs & FictitiousShells

    #998 #1033
    waiting for test
  • Loading branch information
lorinczandrea committed Jun 27, 2024
1 parent 70a984b commit 95b7aa8
Show file tree
Hide file tree
Showing 23 changed files with 1,426 additions and 318 deletions.
23 changes: 22 additions & 1 deletion FemDesign.Core/Geometry/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public void SetEdgeConnection(Shells.EdgeConnection edgeConnection, int index)

Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name);
edge.EdgeConnection = ec;
edge.EdgeConnection.Normal = this.LocalZ;
}
return;
}
Expand Down Expand Up @@ -260,7 +261,6 @@ public void SetEdgeConnections(Shells.EdgeConnection edgeConnection)
string name = "CE." + cInstance.ToString();
Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name);
edge.EdgeConnection = ec;
// edge connection Normal are opposite to the normal of the contour
edge.EdgeConnection.Normal = this.LocalZ;
}
}
Expand All @@ -276,6 +276,27 @@ public void SetEdgeConnections(Shells.EdgeConnection edgeConnection)
}
}

public void SetEdgeConnections(List<Shells.EdgeConnection> edgeConnections)
{
if (edgeConnections?.Count == 0)
{
// pass; keep edges as before
}
else if (edgeConnections.Count == 1)
{
this.SetEdgeConnections(edgeConnections[0]);
}
else if (edgeConnections.Count == this.GetEdgeConnections().Count)
{
for (int i = 0; i < edgeConnections.Count; i++)
this.SetEdgeConnection(edgeConnections[i], i);
}
else
{
throw new ArgumentException($"The number of edge connections must be 1 or equal to the number of surface edges!");
}
}

/// <summary>
/// Get all EdgeConnection from all Edges in Region.
/// </summary>
Expand Down
23 changes: 22 additions & 1 deletion FemDesign.Core/ModellingTools/FictitiousShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,28 @@ public static FictitiousShell UpdateEdgeConnection(FictitiousShell fictShell, Sh

//
return clone;
}
}

/// <summary>
/// Set EdgeConnections by indices.
/// </summary>
/// <param name="fictShell">FictitiousShell.</param>
/// <param name="edgeConnection">EdgeConnection.</param>
/// <param name="index">Index of edge to set.</param>
/// <returns></returns>
public static FictitiousShell UpdateEdgeConnection(FictitiousShell fictShell, Shells.EdgeConnection edgeConnection, int index)
{
// deep clone. downstreams objs will contain changes made in this method, upstream objs will not.
// downstream and uppstream objs will share guid.
FictitiousShell fictShellClone = fictShell.DeepClone();

if (index < 0 & index >= fictShellClone.Region.GetEdgeConnections().Count)
throw new System.ArgumentException("Index is out of bounds.");

fictShellClone.Region.SetEdgeConnection(edgeConnection, index);

return fictShellClone;
}

}
}
115 changes: 98 additions & 17 deletions FemDesign.Core/Shells/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using FemDesign.GenericClasses;
using System.ComponentModel;
using System.Linq;
using FemDesign.Releases;

namespace FemDesign.Shells
{
Expand Down Expand Up @@ -205,7 +206,7 @@ public Geometry.Region Region
public GuidListType InternalPredefinedRigidity { get; set; }

[XmlElement("external_rigidity", Order = 16)]
public Releases.RigidityDataType3 ExternalRigidity { get; set; } // // sets region border. region edgeconnection sets edgeconnection for specific edge. default should be hinged?
public Releases.RigidityDataType3 ExternalRigidity { get; set; } // sets region border. region edgeconnection sets edgeconnection for specific edge. default should be hinged?

[XmlElement("external_predefined_rigidity", Order = 17)]
public GuidListType ExternalPredefinedRigidity { get; set; }
Expand Down Expand Up @@ -352,7 +353,7 @@ public double IgnoredDistance
public bool IgnoredInStability { get; set; } = false;

/// <summary>
/// Set external edge connections (i.e. set edge connections around region).
/// Set external edge connections (i.e. set edge connections on the border).
/// When this is performed for panels the external rigidity is changed accordingly.
/// </summary>
/// <param name="ec">EdgeConnection</param>
Expand All @@ -376,6 +377,27 @@ public void SetExternalEdgeConnections(EdgeConnection ec)
this.ExternalPredefinedRigidity = ec.PredefRigidity;
}

/// <summary>
/// Set external edge connections (i.e. set edge connections on the border).
/// When this is performed for panels the external rigidity is changed accordingly.
/// </summary>
/// <param name="edgeConnections">EdgeConnection</param>
public void SetExternalEdgeConnections(List<EdgeConnection> edgeConnections)
{
// set the edge connections of the external edges of the internal panels
if (this.InternalPanels.IntPanels.Count == 1)
{
this.InternalPanels.IntPanels[0].Region.SetEdgeConnections(edgeConnections);
}
else
{
throw new System.ArgumentException("Can't set external edge connections for panels with more than 1 internal panel (i.e. can only set external edge conncetions for panels with a continuous analytical model)");
}

// set external rigidity property
this.ExternalRigidity = RigidityDataType3.RigidLine();

}

public List<EdgeConnection> GetEdgeConnections()
{
Expand Down Expand Up @@ -456,16 +478,11 @@ public void SetExternalEdgeConnectionsForContinuousAnalyticalModel(EdgeConnectio

foreach (int index in indices)
{
if (index >= 0 & index < this.InternalPanels.IntPanels[0].Region.GetEdgeConnections().Count)
{
// pass
}
else
if (index < 0 || index >= this.InternalPanels.IntPanels[0].Region.GetEdgeConnections().Count)
{
throw new System.ArgumentException("Index is out of bounds.");
}

//
this.SetExternalEdgeConnectionAtIndexForContinousAnalyticalModel(shellEdgeConnection, index);
}
}
Expand Down Expand Up @@ -505,10 +522,10 @@ private Panel()
/// <param name="ecc">ShellEccentricity.</param>
/// <param name="externalMovingLocal">EdgeConnection LCS changes along edge?</param>
/// <param name="internalPanels"></param>
/// <param name="externalEdgeConnection"></param>
/// <param name="externalEdgeConnections"></param>
/// <param name="material"></param>
/// <param name="section"></param>
internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, EdgeConnection externalEdgeConnection, PanelType type, Materials.Material material, Sections.Section section, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal)
internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, List<EdgeConnection> externalEdgeConnections, PanelType type, Materials.Material material, Sections.Section section, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal)
{
this.EntityCreated();

Expand All @@ -517,10 +534,10 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan
this.Plane = region.Plane;
this.AnchorPoint = anchorPoint;
this.InternalPanels = internalPanels;
this.ExternalRigidity = externalEdgeConnection.Rigidity;
this.ExternalRigidity = RigidityDataType3.RigidLine();

// set edge connections
this.SetExternalEdgeConnections(externalEdgeConnection);
this.SetExternalEdgeConnections(externalEdgeConnections);

// attributes
this.Type = type;
Expand All @@ -543,7 +560,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan
/// <param name="region">Region of shell containing panels.</param>
/// <param name="anchorPoint"></param>
/// <param name="internalPanels"></param>
/// <param name="externalEdgeConnection">Default value for shell border EdgeConnections. Can be overwritten by EdgeConnection for each specific edge in Region.</param>
/// <param name="externalEdgeConnections">Default value for shell border EdgeConnections. Can be overwritten by EdgeConnection for each specific edge in Region.</param>
/// <param name="timberApplicationData"></param>
/// <param name="type">Type of panel.</param>
/// <param name="identifier">Name of shell.</param>
Expand All @@ -553,7 +570,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan
/// <param name="ecc">ShellEccentricity.</param>
/// <param name="externalMovingLocal">EdgeConnection LCS changes along edge?</param>
/// <param name="panelWidth"></param>
internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, Materials.TimberPanelType timberApplicationData, EdgeConnection externalEdgeConnection, PanelType type, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal, double panelWidth)
internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, Materials.TimberPanelType timberApplicationData, List<EdgeConnection> externalEdgeConnections, PanelType type, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal, double panelWidth)
{
this.EntityCreated();

Expand All @@ -565,7 +582,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan
this.TimberPanelData = timberApplicationData;

// set external rigidity
this.SetExternalEdgeConnections(externalEdgeConnection);
this.SetExternalEdgeConnections(externalEdgeConnections);

// set internal rigidity - not relevant for a panel with continuous analytical model

Expand All @@ -574,6 +591,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan
this.Identifier = identifier;
this.PanelName = panelName;
this.Gap = gap;
this.Orthotropy = orthotropy;
this.Alignment = ecc.Alignment;
this.AlignOffset = ecc.Eccentricity;
this.EccentricityCalculation = ecc.EccentricityCalculation;
Expand Down Expand Up @@ -603,7 +621,34 @@ public static Panel DefaultContreteContinuous(Geometry.Region region, EdgeConnec
double gap = 0.003;
bool externalMovingLocal = externalEdgeConnection.MovingLocal;

return new Panel(region, anchorPoint, internalPanels, externalEdgeConnection, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal);
return new Panel(region, anchorPoint, internalPanels, new List<EdgeConnection> { externalEdgeConnection }, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal);
}

/// <summary>
/// Create a default concrete shell with panels using a continuous analytical model.
/// </summary>
/// <param name="region">Panel region.</param>
/// <param name="externalEdgeConnections"></param>
/// <param name="material"></param>
/// <param name="section"></param>
/// <param name="identifier">Name of shell.</param>
/// <param name="orthotropy"></param>
/// <param name="ecc"></param>
/// <returns></returns>
public static Panel DefaultContreteContinuous(Geometry.Region region, List<EdgeConnection> externalEdgeConnections, Materials.Material material, Sections.Section section, string identifier, double orthotropy, ShellEccentricity ecc)
{
if (externalEdgeConnections?.Count == 0 || externalEdgeConnections == null)
externalEdgeConnections = new List<EdgeConnection> { EdgeConnection.Default};

Geometry.Point3d anchorPoint = region.Contours[0].Edges[0].Points[0];
InternalPanel internalPanel = new InternalPanel(region);
InternalPanels internalPanels = new InternalPanels(internalPanel);
PanelType type = PanelType.Concrete;
string panelName = "A";
double gap = 0.003;
bool externalMovingLocal = true;

return new Panel(region, anchorPoint, internalPanels, externalEdgeConnections, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal);
}

/// <summary>
Expand Down Expand Up @@ -634,11 +679,47 @@ public static Panel DefaultTimberContinuous(Geometry.Region region, Materials.Ti
double orthotropy = 1;
bool externalMovingLocal = externalEdgeConnection.MovingLocal;

var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, externalEdgeConnection, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth);
var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, new List<EdgeConnection> { externalEdgeConnection }, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth);

panel.LocalX = direction; // Set timber panel span direction

return panel;
}

/// <summary>
/// Create a default timber shell with panels using a continuous analytical model.
/// </summary>
/// <param name="region">Panel region.</param>
/// <param name="timberPlateMaterial">Timber material. See <see cref="FemDesign.Materials.TimberPanelType"/>.</param>
/// <param name="direction">Timber panel span direction.</param>
/// <param name="externalEdgeConnections"></param>
/// <param name="identifier">Name of shell.</param>
/// <param name="eccentricity"></param>
/// <param name="panelWidth"></param>
/// <returns></returns>
public static Panel DefaultTimberContinuous(Geometry.Region region, Materials.TimberPanelType timberPlateMaterial, Geometry.Vector3d direction, List<EdgeConnection> externalEdgeConnections, string identifier = "TP", ShellEccentricity eccentricity = null, double panelWidth = 1.5)
{

if (externalEdgeConnections?.Count == 0 || externalEdgeConnections == null)
externalEdgeConnections = new List<EdgeConnection> { EdgeConnection.Default};

if (eccentricity == null)
eccentricity = ShellEccentricity.Default;

Geometry.Point3d anchorPoint = region.Contours[0].Edges[0].Points[0];
InternalPanel internalPanel = new InternalPanel(region);
InternalPanels internalPanels = new InternalPanels(internalPanel);
PanelType type = PanelType.Timber;
string panelName = "A";
double gap = 0.01;
double orthotropy = 1;
bool externalMovingLocal = true;

var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, externalEdgeConnections, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth);

panel.LocalX = direction; // Set timber panel span direction

return panel;
}
}
}
9 changes: 9 additions & 0 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
<Compile Include="Loads\Vehicle\VehicleFromStruxml.cs" />
<Compile Include="Materials\MaterialDatabase.cs" />
<Compile Include="Materials\MaterialSetTimberMaterialProperties.cs" />
<Compile Include="ModellingTools\OBSOLETE\FictitiousShellConstruct_OBSOLETE2304.cs" />
<Compile Include="ModellingTools\OBSOLETE\FictitiousShellSetEdgeConnection_OBSOLETE2304.cs" />
<Compile Include="ModellingTools\PointConnection.cs" />
<Compile Include="ModellingTools\SurfaceConnection.cs" />
<Compile Include="Model\ModelAddElements.cs" />
Expand Down Expand Up @@ -268,6 +270,13 @@
<Compile Include="Sections\SectionDefine.cs" />
<Compile Include="Sections\SectionGetSectionByName.cs" />
<Compile Include="Shells\EdgeConnectionConstruct.cs" />
<Compile Include="Shells\OBSOLETE\PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\ProfiledPlateConstruct_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\SlabPlateVariableThickness_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\SlabPlate_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\SlabWallVariableThickness_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\SlabWall_OBSOLETE2304.cs" />
<Compile Include="Shells\OBSOLETE\TimberPlateConstruct_OBSOLETE2304.cs" />
<Compile Include="Shells\SlabPeakSmoothingRegion.cs" />
<Compile Include="Shells\Slab.SetStiffnessModifier.cs" />
<Compile Include="Shells\SlabPlate.cs" />
Expand Down
Loading

0 comments on commit 95b7aa8

Please sign in to comment.