Skip to content

Commit

Permalink
🚧 CS implementation and GH components
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinczandrea committed Sep 19, 2024
1 parent e102197 commit b5f1ac8
Show file tree
Hide file tree
Showing 33 changed files with 4,170 additions and 102 deletions.
91 changes: 68 additions & 23 deletions FemDesign.Core/Bars/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ protected Bar()
/// <param name="edge"></param>
/// <param name="type"></param>
/// <param name="material"></param>
/// <param name="section">Section, same at start/end</param>
/// <param name="eccentricity">Analytical eccentricity, same at start. Eccentricity set to 0,0 if null/end</param>
/// <param name="connectivity">Connectivity, same at start/end. Connectivity set to Rigid if null</param>
/// <param name="section">Section, same at start/end.</param>
/// <param name="eccentricity">Analytical eccentricity, same at start and end. If null, eccentricity set to 0.</param>
/// <param name="connectivity">Connectivity, same at start/end. Connectivity set to Rigid if null.</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section section, BarType type, Eccentricity eccentricity = null, Connectivity connectivity = null, string identifier = "B")
{
Expand All @@ -197,12 +197,12 @@ public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section sec
/// <param name="endPoint"></param>
/// <param name="type"></param>
/// <param name="material"></param>
/// <param name="section">Section, same at start/end</param>
/// <param name="section">Section, same at start/end.</param>
/// <param name="localY">Vector to orient the cross section. If null, localY will be set as a cross product between Z-Axis and the local X Axis./end</param>
/// <param name="startEccentricity">Analytical eccentricity. Eccentricity set to 0,0 if null/end</param>
/// <param name="endEccentricity">Analytical eccentricity. Eccentricity set to 0,0 if null/end</param>
/// <param name="startConnectivity">Connectivity. Connectivity set to Rigid if null/end</param>
/// <param name="endConnectivity">Connectivity. Connectivity set to Rigid if null</param>
/// <param name="startEccentricity">Analytical eccentricity at start. If null, eccentricity set to 0.</param>
/// <param name="endEccentricity">Analytical eccentricity at end. If null, eccentricity set to 0.</param>
/// <param name="startConnectivity">Connectivity. Connectivity set to Rigid if null.</param>
/// <param name="endConnectivity">Connectivity. Connectivity set to Rigid if null.</param>
/// <param name="identifier">Identifier</param>
public Bar(FemDesign.Geometry.Point3d startPoint, FemDesign.Geometry.Point3d endPoint, Materials.Material material, Sections.Section section, BarType type, Geometry.Vector3d localY = null, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B")
{
Expand All @@ -222,19 +222,17 @@ public Bar(FemDesign.Geometry.Point3d startPoint, FemDesign.Geometry.Point3d end
this.BarPart = new BarPart(edge, this.Type, material, section, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier);
}



/// <summary>
/// Construct beam or column with uniform section and different start/end conditions
/// </summary>
/// <param name="edge"></param>
/// <param name="type"></param>
/// <param name="material"></param>
/// <param name="section">Section, same at start/end</param>
/// <param name="startEccentricity">Analytical start eccentricity</param>
/// <param name="endEccentricity">Analytical end eccentricity</param>
/// <param name="startConnectivity">Start connectivity</param>
/// <param name="endConnectivity">End connectivity</param>
/// <param name="section">Section, same at start/end.</param>
/// <param name="startEccentricity">Analytical eccentricity at start. If null, eccentricity set to 0.</param>
/// <param name="endEccentricity">Analytical eccentricity at end. If null, eccentricity set to 0.</param>
/// <param name="startConnectivity">Start connectivity.</param>
/// <param name="endConnectivity">End connectivity.</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section section, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B")
{
Expand All @@ -259,12 +257,12 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio
/// <param name="edge"></param>
/// <param name="type"></param>
/// <param name="material"></param>
/// <param name="startSection">Start section</param>
/// <param name="endSection">End section</param>
/// <param name="startEccentricity">Analytical start eccentricity</param>
/// <param name="endEccentricity">Analytical end eccentricity</param>
/// <param name="startConnectivity">Start connectivity</param>
/// <param name="endConnectivity">End connectivity</param>
/// <param name="startSection">Start section.</param>
/// <param name="endSection">End section.</param>
/// <param name="startEccentricity">Analytical eccentricity at start. If null, eccentricity set to 0.</param>
/// <param name="endEccentricity">Analytical eccentricity at end. If null, eccentricity set to 0.</param>
/// <param name="startConnectivity">Start connectivity.</param>
/// <param name="endConnectivity">End connectivity.</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section startSection, Sections.Section endSection, Eccentricity startEccentricity, Eccentricity endEccentricity, Connectivity startConnectivity, Connectivity endConnectivity, string identifier)
{
Expand Down Expand Up @@ -306,8 +304,8 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio
/// <param name="sections">List of sections, 2 or more items.</param>
/// <param name="positions">List of parametric (0-1) section positions, 2 or more items.</param>
/// <param name="eccentricities">List of analytical eccentricities, 2 or more items.</param>
/// <param name="startConnectivity">Start connectivity</param>
/// <param name="endConnectivity">End connectivity</param>
/// <param name="startConnectivity">Start connectivity.</param>
/// <param name="endConnectivity">End connectivity.</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section[] sections, double[] positions, Eccentricity[] eccentricities, Connectivity startConnectivity, Connectivity endConnectivity, string identifier)
{
Expand Down Expand Up @@ -346,6 +344,53 @@ public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section sec
}


/// <summary>
/// Construct a composite beam or composite column with uniform section and uniform start/end conditions.
/// </summary>
/// <param name="edge"></param>
/// <param name="type"></param>
/// <param name="compositeSection"></param>
/// <param name="eccentricity">Analytical eccentricity, same at start/end. Eccentricity set to 0,0 if null.</param>
/// <param name="connectivity">Connectivity, same at start/end. Connectivity set to Rigid if null.</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, BarType type, Composites.CompositeSection compositeSection, Eccentricity eccentricity = null, Connectivity connectivity = null, string identifier = "B")
{
if (type == BarType.Truss) { throw new System.Exception("Truss is not a valid type"); }

this.EntityCreated();
this.Type = type;

if (eccentricity == null) { eccentricity = Eccentricity.Default; }
if (connectivity == null) { connectivity = Connectivity.Default; }
this.BarPart = new BarPart(edge, this.Type, compositeSection, eccentricity, connectivity, identifier);
}

/// <summary>
/// Construct composite beam or composite column with uniform section and different start/end conditions.
/// </summary>
/// <param name="edge"></param>
/// <param name="type"></param>
/// <param name="compositeSection"></param>
/// <param name="startEccentricity">Analytical start eccentricity</param>
/// <param name="endEccentricity">Analytical end eccentricity</param>
/// <param name="startConnectivity">Start connectivity</param>
/// <param name="endConnectivity">End connectivity</param>
/// <param name="identifier">Identifier</param>
public Bar(Geometry.Edge edge, BarType type, Composites.CompositeSection compositeSection, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B")
{
if (type == BarType.Truss) { throw new System.Exception("Truss is not a valid type"); }

this.EntityCreated();
this.Type = type;

if (startEccentricity == null) { startEccentricity = Eccentricity.Default; }
if (endEccentricity == null) { endEccentricity = Eccentricity.Default; }
if (startConnectivity == null) { startConnectivity = Connectivity.Default; }
if (endConnectivity == null) { endConnectivity = Connectivity.Default; }

this.BarPart = new BarPart(edge, this.Type, compositeSection, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier);
}


/// <summary>
/// Construct a truss element.
Expand Down
141 changes: 129 additions & 12 deletions FemDesign.Core/Bars/BarPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected override int GetUniqueInstanceCount()
throw new System.ArgumentException($"Incorrect type of bar: {this.Type}");
}
}

/// <summary>
/// Edge field
/// </summary>
Expand Down Expand Up @@ -213,29 +214,79 @@ public SectionType SectionType
}

[XmlAttribute("complex_composite")]
public string ComplexCompositeRef { get; set; } // guidtype
public System.Guid _complexCompositeRef;

public bool ShouldSerialize_complexCompositeRef()
{
return this.HasComplexCompositeRef;
}

[XmlIgnore]
public System.Guid ComplexCompositeRef
{
get
{
return this._complexCompositeRef;
}
set
{
this._complexCompositeRef = value;
}
}

[XmlIgnore]
public bool HasComplexCompositeRef { get => this.ComplexCompositeRef != System.Guid.Empty; }

[XmlIgnore]
public bool HasComplexCompositeRef { get => this.ComplexCompositeRef != null; }
public Composites.ComplexComposite _complexCompositeObj;

[XmlIgnore]
public StruSoft.Interop.StruXml.Data.Complex_composite_type ComplexCompositeObj { get; set; }
public Composites.ComplexComposite ComplexCompositeObj
{
get
{
return this._complexCompositeObj;
}
set
{
this._complexCompositeObj = value;
this.ComplexCompositeRef = value.Guid;

// Composite bars BarPart doesn't have ComplexMaterial and ComplexSection attributes
if (this.HasComplexSectionRef)
{
this.ComplexSectionObj = null;
this.ComplexSectionRef = null;
}
if (this.HasComplexMaterialRef)
{
this.ComplexMaterialObj = null;
this.ComplexMaterialRef = System.Guid.Empty;
}
}
}

[XmlAttribute("complex_material")]
public string _complexMaterialRef;
public System.Guid _complexMaterialRef;

public bool ShouldSerialize_complexMaterialRef()
{
return this.HasComplexMaterialRef;
}

[XmlIgnore]
public System.Guid ComplexMaterialRef
{
get
{
return System.Guid.Parse(this._complexMaterialRef);
return this._complexMaterialRef;
}
set
{
this._complexMaterialRef = value.ToString();
this._complexMaterialRef = value;
}
}

[XmlIgnore]
public bool HasComplexMaterialRef { get => this.ComplexMaterialRef != System.Guid.Empty; }

Expand All @@ -262,10 +313,15 @@ public Materials.Material ComplexMaterialObj
}
}

[XmlIgnore]
private string _complexSectionRef;

[XmlAttribute("complex_section")]
public string _complexSectionRef;

public bool ShouldSerialize_complexSectionRef()
{
return this.HasComplexSectionRef;
}

[XmlIgnore]
public string ComplexSectionRef
{
get
Expand Down Expand Up @@ -313,7 +369,21 @@ public string ComplexSectionRef
public bool HasDeltaBeamComplexSectionRef { get => !System.Guid.TryParse(this.ComplexSectionRef, out System.Guid result); }

[XmlIgnore]
public Sections.ComplexSection ComplexSectionObj;
public Sections.ComplexSection _complexSectionObj;

[XmlIgnore]
public Sections.ComplexSection ComplexSectionObj
{
get
{
return this._complexSectionObj;
}
set
{
this._complexSectionObj = value;
this._complexSectionRef = this._complexSectionObj.Guid.ToString();
}
}

[XmlIgnore]
public Sections.Section TrussUniformSectionObj;
Expand Down Expand Up @@ -369,9 +439,10 @@ public Connectivity[] Connectivity
}
}

[XmlIgnore]
public ModelEccentricity _eccentricityTypeField;
[XmlElement("eccentricity", Order = 4)]
public ModelEccentricity _eccentricityTypeField;

[XmlIgnore]
public ModelEccentricity _eccentricityTypeProperty
{
get
Expand Down Expand Up @@ -407,6 +478,7 @@ public ModelEccentricity _eccentricityTypeProperty
this._eccentricityTypeField = value;
}
}

[XmlIgnore]
public Eccentricity[] AnalyticalEccentricity
{
Expand Down Expand Up @@ -629,6 +701,51 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se
this.CheckMaterialAndSectionType();
}

/// <summary>
/// Construct a composite barpart with uniform section and uniform start/end conditions.
/// </summary>
public BarPart(Geometry.Edge edge, BarType type, Composites.CompositeSection compositeSection, Eccentricity eccentricity, Connectivity connectivity, string identifier)
{
if (type == BarType.Truss)
{
throw new System.ArgumentException($"Type: {type.ToString()}, is not of type {BarType.Beam.ToString()} or {BarType.Column.ToString()}");
}
else
{
this.EntityCreated();
this.Type = type;
this.Edge = edge;
this.ComplexCompositeObj = new Composites.ComplexComposite(compositeSection);
this.EccentricityCalc = true;
this._eccentricityTypeProperty = new ModelEccentricity(eccentricity, true);
this.Connectivity = new Connectivity[1] { connectivity };
this.Identifier = identifier;
}
}

/// <summary>
/// Construct a composite barpart with uniform section and different start/end conditions.
/// </summary>
public BarPart(Geometry.Edge edge, BarType type, Composites.CompositeSection compositeSection, Eccentricity startEccentricity, Eccentricity endEccentricity, Connectivity startConnectivity, Connectivity endConnectivity, string identifier)
{
if (type == BarType.Truss)
{
throw new System.ArgumentException($"Type: {type.ToString()}, is not of type {BarType.Beam.ToString()} or {BarType.Column.ToString()}");
}
else
{
this.EntityCreated();
this.Type = type;
this.Edge = edge;
this.ComplexCompositeObj = new Composites.ComplexComposite(compositeSection);
this.EccentricityCalc = true;
this._eccentricityTypeProperty = new ModelEccentricity(startEccentricity, endEccentricity, true);
this.Connectivity = new Connectivity[2] { startConnectivity, endConnectivity };
this.Identifier = identifier;
}
}


/// <summary>
/// Orient this object's coordinate system to GCS
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion FemDesign.Core/Bars/Beam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ public Beam(Geometry.Edge edge, Materials.Material material, Sections.Section st
public Beam(Geometry.Edge edge, Materials.Material material, Sections.Section[] sections, Eccentricity[] eccentricities, Connectivity[] connectivities, string identifier) : base(edge, BarType.Beam, material, sections, eccentricities, connectivities, identifier)
{
}
}

public Beam(Geometry.Edge edge, Composites.CompositeSection compositeSection, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B") : base(edge, BarType.Beam, compositeSection, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier)
{
}
}
}
4 changes: 4 additions & 0 deletions FemDesign.Core/Bars/Column.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ public Column(Geometry.Edge edge, Materials.Material material, Sections.Section
public Column(Geometry.Edge edge, Materials.Material material, Sections.Section[] sections, Eccentricity[] eccentricities, Connectivity[] connectivities, string identifier) : base(edge, BarType.Column, material, sections, eccentricities, connectivities, identifier)
{
}

public Column(Geometry.Edge edge, Composites.CompositeSection compositeSection, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B") : base(edge, BarType.Column, compositeSection, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier)
{
}
}
}
Loading

0 comments on commit b5f1ac8

Please sign in to comment.