Skip to content

Commit

Permalink
Merge pull request #627 from strusoft/21.7.0_Branch
Browse files Browse the repository at this point in the history
Milestone 21.7.0
  • Loading branch information
Marco-Pellegrino authored Dec 29, 2022
2 parents a338ed7 + 298d9ce commit 1c4106a
Show file tree
Hide file tree
Showing 46 changed files with 2,535 additions and 133 deletions.
71 changes: 71 additions & 0 deletions FemDesign.Core/Bars/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,78 @@ public static Bar Truss(Geometry.Edge edge, Materials.Material material, Section
return truss;
}

public void UpdateSection(Sections.Section section)
{
if(this.Type == BarType.Truss)
{
this.UpdateTrussSection(section);
}
else if(!this.BarPart.HasComplexCompositeRef || !this.BarPart.HasDeltaBeamComplexSectionRef)
{
var sections = new Sections.Section[2] { section, section };
this.UpdateSection(sections);
}
else
{
throw new NotImplementedException("Bar with Composite Section can not be updated yet! Send a request.");
}
}

/// <summary>
/// Update Sections for a Bar Element. Composite Section and Delta Beam are not implemented yet. Send us a request.
/// </summary>
/// <param name="sections"></param>
/// <exception cref="System.ArgumentException"></exception>
/// <exception cref="NotImplementedException"></exception>
public void UpdateSection(Sections.Section[] sections)
{
if(!this.BarPart.HasComplexCompositeRef || !this.BarPart.HasDeltaBeamComplexSectionRef)
{
if (this.Type != BarType.Truss)
{
if (sections.Length < 2)
{
throw new System.ArgumentException($"Number of sections: {sections.Length}, must be 2 or more");
}

for (int i = 0; i < sections.Length; i++)
{
this.BarPart.ComplexSectionObj.Parts[i].SectionObj = sections[i];
this.BarPart.ComplexSectionObj.Parts[i].SectionRef = sections[i].Guid;
}
}
else if (this.Type == BarType.Truss)
{
throw new System.ArgumentException($"Number of sections: {sections.Length}, must be 1.");
}
}
else
{
throw new NotImplementedException("Bar with Composite or Delta Section can not be updated yet! Send a request.");
}
}
private void UpdateTrussSection(Sections.Section section)
{
this.BarPart.TrussUniformSectionObj = section;
}

/// <summary>
/// Update Sections for a Bar Element. Material for Composite Section and Delta Beam are not implemented yet. Send us a request.
/// </summary>
/// <param name="material"></param>
/// <exception cref="NotImplementedException"></exception>
public void UpdateMaterial(Materials.Material material)
{
if (!this.BarPart.HasComplexCompositeRef || !this.BarPart.HasDeltaBeamComplexSectionRef)
{
this.BarPart.ComplexMaterialObj = material;
this.BarPart.ComplexMaterialRef = material.Guid;
}
else
{
throw new NotImplementedException("Bar with Composite Section or Delta Beam can not be updated yet! Send a request.");
}
}


/// Update entities if this bar should be "reconstructed"
Expand Down
55 changes: 32 additions & 23 deletions FemDesign.Core/Bars/Connectivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class Connectivity
{

[XmlIgnore]
private bool _mx;
private bool _tx;

// binary-rigid
/// <summary>Translation local-x axis.</summary>
Expand All @@ -23,44 +23,44 @@ public bool Tx
{
get
{
return this._mx;
return this._tx;
}
set
{
this._mx = value;
this._tx = value;
}
}
[XmlIgnore]
private bool _my;
private bool _ty;

/// <summary>Translation local-y axis. </summary>
[XmlAttribute("m_y")]
public bool Ty
{
get
{
return this._my;
return this._ty;
}
set
{
this._my = value;
this._ty = value;
}
}

[XmlIgnore]
private bool _mz;
private bool _tz;

/// <summary>Translation local-z axis.</summary>
[XmlAttribute("m_z")]
public bool Tz
{
get
{
return this._mz;
return this._tz;
}
set
{
this._mz = value;
this._tz = value;
}
}

Expand Down Expand Up @@ -117,45 +117,45 @@ public bool Rz

// semi-rigid
[XmlAttribute("m_x_release")]
public double _mxRelease; // non_neg_max_1e10. Default = 0. Valid only if m_x is false.
public double _txRelease; // non_neg_max_1e10. Default = 0. Valid only if m_x is false.
[XmlIgnore]
public double TxRelease
{
get
{
return this._mxRelease;
return this._txRelease;
}
set
{
this._mxRelease = RestrictedDouble.NonNegMax_1e10(value);
this._txRelease = RestrictedDouble.NonNegMax_1e10(value);
}
}
[XmlAttribute("m_y_release")]
public double _myRelease; // non_neg_max_1e10. Default = 0. Valid only if m_y is false.
public double _tyRelease; // non_neg_max_1e10. Default = 0. Valid only if m_y is false.
[XmlIgnore]
public double TyRelease
{
get
{
return this._myRelease;
return this._tyRelease;
}
set
{
this._myRelease = RestrictedDouble.NonNegMax_1e10(value);
this._tyRelease = RestrictedDouble.NonNegMax_1e10(value);
}
}
[XmlAttribute("m_z_release")]
public double _mzRelease; // non_neg_max_1e10. Default = 0. Valid only if m_z is false.
public double _tzRelease; // non_neg_max_1e10. Default = 0. Valid only if m_z is false.
[XmlIgnore]
public double TzRelease
{
get
{
return this._mzRelease;
return this._tzRelease;
}
set
{
this._mzRelease = RestrictedDouble.NonNegMax_1e10(value);
this._tzRelease = RestrictedDouble.NonNegMax_1e10(value);
}
}
[XmlAttribute("r_x_release")]
Expand Down Expand Up @@ -226,9 +226,8 @@ public bool IsHinged
/// <summary>
/// Parameterless constructor for serialization.
/// </summary>
private Connectivity()
public Connectivity()
{

}

/// <summary>
Expand Down Expand Up @@ -316,12 +315,22 @@ public static Connectivity Rigid

public override string ToString()
{
if(IsRigid)
if (IsRigid)
return $"{this.GetType().Name} Rigid";
else if(IsHinged)
else if (IsHinged)
return $"{this.GetType().Name} Hinged";
else
return $"{this.GetType().Name} Tx: {this.TxRelease} kN/m, Ty: {this.TyRelease} kN/m, Tz: {this.TzRelease} kN/m, Rx: {this.RxRelease} kNm/rad, Ry: {this.RyRelease} kNm/rad, Rz: {this.RzRelease} kNm/rad";
{
var tx = this.Tx == true ? "Rigid" : $"{this.TxRelease} kN/m";
var ty = this.Ty == true ? "Rigid" : $"{this.TyRelease} kN/m";
var tz = this.Tz == true ? "Rigid" : $"{this.TzRelease} kN/m";

var rx = this.Rx == true ? "Rigid" : $"{this.RxRelease} kNm/rad";
var ry = this.Ry == true ? "Rigid" : $"{this.RyRelease} kNm/rad";
var rz = this.Rz == true ? "Rigid" : $"{this.RzRelease} kNm/rad";

return $"{this.GetType().Name} Tx: {tx}, Ty: {ty}, Tz: {tz}, Rx: {rx}, Ry: {ry}, Rz: {rz}";
}
}
}
}
1 change: 1 addition & 0 deletions FemDesign.Core/FemDesign.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<Compile Include="FemDesignConnection.cs" />
<Compile Include="Calculate\FdScript.cs" />
<Compile Include="GenericClasses\INamedEntity.cs" />
<Compile Include="GenericClasses\IShell.cs" />
<Compile Include="GenericClasses\IStageElement.cs" />
<Compile Include="GenericClasses\NamedEntityBase.cs" />
<Compile Include="GenericClasses\TextFormatting.cs" />
Expand Down
13 changes: 13 additions & 0 deletions FemDesign.Core/GenericClasses/IShell.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FemDesign.GenericClasses
{
public interface IShell
{
void UpdateMaterial(Materials.Material material);
}
}
6 changes: 3 additions & 3 deletions FemDesign.Core/Materials/MaterialDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Material MaterialByName(string materialName)
if (material.Name == materialName)
{
// update object information
material.Guid = System.Guid.NewGuid();
//material.Guid = System.Guid.NewGuid();
material.EntityModified();

// return
Expand All @@ -119,7 +119,7 @@ public Material MaterialByName(string materialName)
if (material.Name == materialName)
{
// update object information
material.Guid = System.Guid.NewGuid();
//material.Guid = System.Guid.NewGuid();
material.EntityModified();

// return
Expand Down Expand Up @@ -148,7 +148,7 @@ public CltPanelLibraryType GetCltPanelLibraryTypeByName(string panelLibraryTypeN
if (panelLibraryType.Name == panelLibraryTypeName)
{
// update object information
panelLibraryType.Guid = System.Guid.NewGuid();
//panelLibraryType.Guid = System.Guid.NewGuid();
panelLibraryType.EntityModified();

// return
Expand Down
18 changes: 12 additions & 6 deletions FemDesign.Core/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3357,20 +3357,26 @@ internal void GetPanels()
foreach (Shells.Panel panel in this.Entities.Panels)
{
// get material
foreach (Materials.Material material in this.Materials.Material)
if(this.Materials != null) // model with only timber plate does not have an xml element 'materials'
{
if (material.Guid == panel.ComplexMaterial)
foreach (Materials.Material material in this.Materials.Material)
{
panel.Material = material;
if (material.Guid == panel.ComplexMaterialRef)
{
panel.Material = material;
}
}
}

// get section
foreach (Sections.Section section in this.Sections.Section)
if(this.Sections != null) // model with only timber plate does not have an xml element 'sections'
{
if (section.Guid == panel.ComplexSection)
foreach (Sections.Section section in this.Sections.Section)
{
panel.Section = section;
if (section.Guid == panel.ComplexSection)
{
panel.Section = section;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions FemDesign.Core/Properties/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
// Revision
//

[assembly: AssemblyVersion("21.6.0.0")]
[assembly: AssemblyFileVersion("21.6.0.0")]
[assembly: AssemblyVersion("21.7.0.0")]
[assembly: AssemblyFileVersion("21.7.0.0")]
20 changes: 17 additions & 3 deletions FemDesign.Core/Shells/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace FemDesign.Shells
/// panel_type
/// </summary>
[System.Serializable]
public partial class Panel: NamedEntityBase, IStructureElement, IStageElement
public partial class Panel: NamedEntityBase, IStructureElement, IStageElement, IShell
{
/// <summary>
/// Panel instance counter
Expand Down Expand Up @@ -212,7 +212,7 @@ public Geometry.Region Region
public PanelType Type { get; set; }

[XmlAttribute("complex_material")]
public System.Guid ComplexMaterial { get; set; }
public System.Guid ComplexMaterialRef { get; set; }
[XmlIgnore]
public Materials.Material _material;
[XmlIgnore]
Expand All @@ -223,7 +223,7 @@ public Materials.Material Material
if (value.Concrete != null)
{
// material must be concrete
this.ComplexMaterial = value.Guid;
this.ComplexMaterialRef = value.Guid;
this._material = value;
}
else
Expand Down Expand Up @@ -418,6 +418,20 @@ public void SetExternalEdgeConnectionsForContinuousAnalyticalModel(EdgeConnectio
}
}


public void UpdateMaterial(Materials.Material material)
{
if (this.Type == PanelType.Concrete)
{
if (material.Family == "Concrete")
this.ComplexMaterialRef = material.Guid;
else
throw new System.ArgumentException("Material must be of type Concrete.");
}
else if (this.Type == PanelType.Timber)
throw new System.NotImplementedException("Panel with Timber Material can not be updated yet! Send a request.");
}

/// <summary>
/// Parameterless constructor for serialization
/// </summary>
Expand Down
Loading

0 comments on commit 1c4106a

Please sign in to comment.