Skip to content

Commit

Permalink
21.5.0 (#544)
Browse files Browse the repository at this point in the history
* test to fix errors

* 🚧 Fix Some Reference Error

* Update FemDesign.Dynamo.csproj

* add missing file

* 🐛 Dynamo can't have default enum argument

Fix #498

* Constructor with Default Parameters

* 💄 Input Renaming

#494

* Update LoadCombinationConstruct.cs

close #494

* Update Panel.cs

#523

* ✨  update xml attributes for BarPart

* stiffness modifier does not reset

#521

* fix

#538

* StiffnessPoint Constructor C# Gh

* ✨ Icon

* 📝 Practical example

#508

* match filepath nickname with runDesign

* 💄

unnecessary information

* Update SupportDeconstuctor.cs

#483

* 🐛  removing-default-material

#491

* model run return a bool

#487

* 🐛 Plane input

#559

* Update Region.cs

* 📝 rename component

* 🐛 correct serialisation in case of default value

#562

* 🐛 load combination set up

#566 fix

* 🐛 read material bug

* Update SectionDefine.cs

* 🐛 custom section database

* 🔥 name input was not necessary

* ⚡ Model serialize paths

- Allow relative paths
- Omitted extension will be changed to struxml

* example 5 update

* ✏️ Fix typo;

* ⚠ Better warning on version mismatch

Fix #555

* Revert "Update SupportDeconstuctor.cs"

This reverts commit 4e464a6.

* Update SupportDeconstuctor.cs

* ✨ Add StageLoadCase to LoadCombination

Fix #561

* 🐛 Parameterless constructor for serialization

* fix enum default

* result type input for users

* ✨ Special cases in load combinations

Load combinations can now be constructed and deconstructed with
- Construction stage
- Seismic case
- PTC case
- Pile/Neg. Shaft friction case

In C# and Grasshopper

Fix #561

* ✨ Line stress load

- Added constructors for C#
- Added constructor component for Grasshopper
- Added deconstructor component for Grasshopper
- Override ToString()

Fix #563

* 🚨 Fixing XML warnings (CS1570)

Warning	CS1570	XML comment has badly formed XML --

* 🚨 Fixing XML warnings (CS1572)

Warning	CS1572	XML comment has a param tag for *, but there is no parameter by that name

* 🚨 Fixing XML warnings (CS1573)

Warning	CS1573	Parameter * has no matching param tag in the XML comment for * (but other parameters do)

* 🚨 Fixing warning CS8602

Warning	CS8602	Dereference of a possibly null reference.

* 🚨 Fixing CS0168, CS0169, CS0219

Warning	CS0219	The variable * is assigned but its value is never used
Warning	CS0169	The field * is never used
Warning	CS0168	The variable 'ex' is declared but never used

* 🚨 Ignore warning CS1591

Ignore the warning: "Missing XML comment for publicly visible type or member *"

* 🐛 Fix mistake

* 📝 Add comment on special load cases

* 🐛 Fix dynamo references

* 🐛 Name/Identifier #529

Work in progress on #529

- Added tests (failing for now)
- Added LockedIdentifier property on Bar

* 🐛 Remove bar.Name setter

Work in progress on #529

* 💄 Add Icons for LineStressLoad

Fix #563

* ✏️ Copy paste typo

* ✨ Abstract class NamedEntityBase

Fix #529

* ✨ Bar to use BarPart Name and Instance

#511

* Update LineStressLoadDefine.cs

* 🔥 EntityBase => NamedEntityBase

Using NamedEntityBase instead of EntityBase where applicable and remove duplicate code for properties Name, Identifier and Instance for many classes

* Update GlobalAssemblyInfo.cs

* 🐛 Incremented instance counter twice

* 🔥 EntityBase => NamedEntityBase for SlabPart

Also updated Region RectangleXY to take a reference point

* 🐛 Fix SlabType

* 🐛 Fix Bar identifier on create

* 💄 StageDeconstruct Icon

* 🔔 Make exceptions more explicit

* 🚨  xml warning

* update stage component

same order for constructor and deconstructor

Co-authored-by: Andreas Oscarsson <[email protected]>
Co-authored-by: xRadne <[email protected]>
  • Loading branch information
3 people authored Nov 3, 2022
1 parent 74740e0 commit d21b699
Show file tree
Hide file tree
Showing 185 changed files with 4,224 additions and 91,565 deletions.
27 changes: 5 additions & 22 deletions FemDesign.Core/AdvancedFem/Cover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,14 @@ namespace FemDesign
/// cover_type
/// </summary>
[System.Serializable]
public partial class Cover: EntityBase, IStructureElement
public partial class Cover: NamedEntityBase, IStructureElement
{
/// <summary>
/// Cover instance number
/// </summary>
private static int _coverInstance = 0;

/// <summary>
/// Identifier
/// </summary>
[XmlAttribute("name")]
public string _name;
[XmlIgnore]
public string Name
{
get
{
return this._name;
}
set
{
Cover._coverInstance++;
this._name = value + "." + Cover._coverInstance.ToString();
}
}

protected override int GetUniqueInstanceCount() => ++_coverInstance;

/// <summary>
/// Load bearing direction (point_type_3d)
/// </summary>
Expand Down Expand Up @@ -69,10 +51,11 @@ private Cover()
/// <param name="region">Region of cover.</param>
/// <param name="supportingStructures">Guidlist of supporting structure.</param>
/// <param name="loadBearingDirection">Vector, if null a TwoWay cover is defined.</param>
/// <param name="identifier">Name.</param>
public Cover(Geometry.Region region, CoverReferenceList supportingStructures, Geometry.Vector3d loadBearingDirection, string identifier)
{
this.EntityCreated();
this.Name = identifier;
this.Identifier = identifier;
this.Region = region;
this.SupportingStructures = supportingStructures;
this.LoadBearingDirection = loadBearingDirection;
Expand Down
17 changes: 6 additions & 11 deletions FemDesign.Core/AuxiliaryResults/LabelledSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ namespace FemDesign.AuxiliaryResults
/// Labelled section. Used for extracting detailed results along a section line or polyline.
/// </summary>
[System.Serializable]
public partial class LabelledSection : EntityBase, IStructureElement
public partial class LabelledSection : NamedEntityBase, IStructureElement
{
[XmlIgnore]
private static int instances = 0;
public static void ResetInstanceCount() => instances = 0;
private static int _labelledSectioninstances = 0;
public static void ResetInstanceCount() => _labelledSectioninstances = 0;
protected override int GetUniqueInstanceCount() => ++_labelledSectioninstances;

[XmlElement("line_segment")]
public LineSegment _lineSegment;
[XmlElement("polyline")]
Expand Down Expand Up @@ -51,12 +53,6 @@ public List<Point3d> Verticies {
throw new ArgumentException($"LabelledSection must have at least 2 verticies.");
}
}

/// <summary>
/// Identifier
/// </summary>
[XmlAttribute("name")]
public string Name { get; set; }

/// <summary>
/// Parameterless contructor for serialization
Expand All @@ -81,11 +77,10 @@ public LabelledSection(string identifier = "LS", params Point3d[] verticies)

private void Initialize(List<Point3d> verticies, string identifier)
{
instances++;
this.EntityCreated();

Verticies = verticies;
Name = $"{identifier}.{instances}";
Identifier = identifier;
}
}
}
178 changes: 70 additions & 108 deletions FemDesign.Core/Bars/Bar.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// https://strusoft.com/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using FemDesign.GenericClasses;

Expand All @@ -17,15 +19,8 @@ namespace FemDesign.Bars
[XmlInclude(typeof(Truss))]
[XmlRoot("database", Namespace = "urn:strusoft")]
[System.Serializable]
public partial class Bar : EntityBase, IStructureElement, IStageElement
public partial class Bar : EntityBase, INamedEntity, IStructureElement, IStageElement
{
[XmlIgnore]
private static int _barInstance = 0; // used for counter of name)
[XmlIgnore]
private static int _columnInstance = 0; // used for counter of name
[XmlIgnore]
private static int _trussInstance = 0; // used for counter of name

/// <summary>
/// Truss only.
/// </summary>enum
Expand Down Expand Up @@ -63,94 +58,21 @@ public double MaxTension
[XmlAttribute("tensions_plasticity")]
public bool TensionPlasticity { get; set; } // bool

[XmlAttribute("name")]
public string _name { get; set; } // identifier

[XmlIgnore]
public string Name
{
get
{
return this._name;
}
set
{
if (this.Type == BarType.Beam)
{
Bar._barInstance++;
this._name = value + "." + Bar._barInstance.ToString();

// update barpart identifier
if (this.BarPart != null)
{
this.BarPart.Name = this._name;
}
}
else if (this.Type == BarType.Column)
{
Bar._columnInstance++;
this._name = value + "." + Bar._columnInstance.ToString();

// update barpart identifier
if (this.BarPart != null)
{
this.BarPart.Name = this._name;
}
}
else if (this.Type == BarType.Truss)
{
Bar._trussInstance++;
this._name = value + "." + Bar._trussInstance.ToString();

// update barpart identifier
if (this.BarPart != null)
{
this.BarPart.Name = this._name;
}
}
else
{
throw new System.ArgumentException($"Incorrect type of bar: {this.Type}");
}
}
}

[XmlIgnore]
public string Instance
{
get
{
var found = this._name.IndexOf(".");
return this._name.Substring(found + 1);
}
}
public string Identifier => this.Name.Split('.')[0];

[XmlAttribute("type")]
public BarType _type; // beamtype

[XmlIgnore]
public BarType Type
{
get
{
return this._type;
}
set
{
this._type = value;
}
// get {return this._type;}
// set {this._type = RestrictedString.BeamType(value);}
}
public BarType Type { get; set; }

[XmlAttribute("stage")]
public int StageId { get; set; } = 1;

[XmlElement("bar_part", Order = 1)]
public BarPart BarPart { get; set; } // bar_part_type

[XmlElement("end", Order = 2)]
[XmlElement("truss_behaviour", Order = 2)]
public StruSoft.Interop.StruXml.Data.Truss_chr_type TrussBehaviour { get; set; }

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

[XmlIgnore]
Expand All @@ -176,10 +98,26 @@ public List<Reinforcement.BarReinforcement> LongitudinalBars
}
}

public string Name => this.BarPart.Name.Substring(0, this.BarPart.Name.Length - 2); // Remove trailing ".1" from barpart name
public int Instance => this.BarPart.Instance;

[XmlIgnore]
public string Identifier
{
get => this.BarPart.Identifier;
set => this.BarPart.Identifier = value;
}
[XmlIgnore]
public bool LockedIdentifier
{
get => this.BarPart.LockedIdentifier;
set => this.BarPart.LockedIdentifier = value;
}

/// <summary>
/// Parameterless constructor for serialization.
/// </summary>
internal Bar()
protected Bar()
{

}
Expand All @@ -194,17 +132,17 @@ internal Bar()
/// <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="identifier">Identifier</param>
public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section section, BarType type = BarType.Beam, Eccentricity eccentricity = null, Connectivity connectivity = null, string identifier = "B")
public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section section, BarType type, Eccentricity eccentricity = null, Connectivity connectivity = null, string identifier = "B")
{
if(type == BarType.Truss) { throw new System.Exception("Truss is not a valid type"); }
if (type == BarType.Truss) { throw new System.Exception("Truss is not a valid type"); }

this.EntityCreated();
this.Type = type;
this.Name = identifier;
//this.Identifier = identifier;

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

/// <summary>
Expand All @@ -221,22 +159,22 @@ public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section sec
/// <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="identifier">Identifier</param>
public Bar(FemDesign.Geometry.Point3d startPoint, FemDesign.Geometry.Point3d endPoint, Materials.Material material, Sections.Section section, BarType type = BarType.Beam, Geometry.Vector3d localY = null, Eccentricity startEccentricity = null, Eccentricity endEccentricity = null, Connectivity startConnectivity = null, Connectivity endConnectivity = null, string identifier = "B")
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")
{
var orientY = localY ?? (endPoint - startPoint).Cross(Geometry.Vector3d.UnitZ);
Geometry.Edge edge = new Geometry.Edge(startPoint, endPoint, orientY);
if (type == BarType.Truss) { throw new System.Exception("Truss is not a valid type"); }

this.EntityCreated();
this.Type = type;
this.Name = identifier;
//this.Identifier = identifier;

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, material, section, startEccentricity, endEccentricity, startConnectivity, endConnectivity, this.Name);
this.BarPart = new BarPart(edge, this.Type, material, section, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier);
}


Expand Down Expand Up @@ -264,10 +202,10 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio

this.EntityCreated();
this.Type = type;
this.Name = identifier;
//this.Identifier = identifier;


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

/// <summary>
Expand All @@ -289,8 +227,8 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio

this.EntityCreated();
this.Type = type;
this.Name = identifier;
this.BarPart = new BarPart(edge, this.Type, material, startSection, endSection, startEccentricity, endEccentricity, startConnectivity, endConnectivity, this.Name);
//this.Identifier = identifier;
this.BarPart = new BarPart(edge, this.Type, material, startSection, endSection, startEccentricity, endEccentricity, startConnectivity, endConnectivity, identifier);
}


Expand All @@ -310,8 +248,8 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio

this.EntityCreated();
this.Type = type;
this.Name = identifier;
this.BarPart = new BarPart(edge, this.Type, material, sections, eccentricities, connectivities, this.Name);
//this.Identifier = identifier;
this.BarPart = new BarPart(edge, this.Type, material, sections, eccentricities, connectivities, identifier);
}

/// <summary>
Expand All @@ -332,8 +270,8 @@ public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sectio

this.EntityCreated();
this.Type = type;
this.Name = identifier;
this.BarPart = new BarPart(edge, this.Type, material, sections, positions, eccentricities, startConnectivity, endConnectivity, this.Name);
//this.Identifier = identifier;
this.BarPart = new BarPart(edge, this.Type, material, sections, positions, eccentricities, startConnectivity, endConnectivity, identifier);
}


Expand All @@ -349,10 +287,34 @@ public Bar(Geometry.Edge edge, Materials.Material material, Sections.Section sec
{
this.EntityCreated();
this.Type = BarType.Truss;
this.Name = identifier;
//this.Identifier = identifier;
this.BarPart = new BarPart(edge, this.Type, material, section, identifier);
}



/// <summary>
/// Construct a truss element.
/// </summary>
/// <param name="edge"></param>
/// <param name="material"></param>
/// <param name="section"></param>
/// <param name="identifier"></param>
/// <exception cref="System.Exception"></exception>
public static Bar Truss(Geometry.Edge edge, Materials.Material material, Sections.Section section, string identifier)
{
var truss = new Bar();

truss.EntityCreated();
truss.Type = BarType.Truss;
//truss.Identifier = identifier;
truss.BarPart = new BarPart(edge, truss.Type, material, section, identifier);
return truss;
}




/// Update entities if this bar should be "reconstructed"
public void UpdateEntities()
{
Expand All @@ -371,10 +333,10 @@ public void UpdateEntities()

public override string ToString()
{
if(this.Type == BarType.Beam || this.Type == BarType.Column)
if (this.Type == BarType.Beam || this.Type == BarType.Column)
return $"{this.Type} Start: {this.BarPart.Edge.Points.First()}, End: {this.BarPart.Edge.Points.Last()}, Length: {this.BarPart.Edge.Length} m, Sections: ({this.BarPart.ComplexSectionObj.Sections.First()._sectionName}, {this.BarPart.ComplexSectionObj.Sections.Last()._sectionName}), Material: {this.BarPart.ComplexMaterialObj}";

else if(this.Type == BarType.Truss)
else if (this.Type == BarType.Truss)
{
return $"{this.Type} Start: {this.BarPart.Edge.Points.First()}, End: {this.BarPart.Edge.Points.Last()}, Length: {this.BarPart.Edge.Length} m, Section: {this.BarPart.TrussUniformSectionObj._sectionName}, Material: {this.BarPart.ComplexMaterialObj}";
}
Expand Down
Loading

0 comments on commit d21b699

Please sign in to comment.