LinePrimitive and RectanglePrimitive was added
This commit is contained in:
@@ -12,12 +12,14 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public class ElasticMaterial : IElasticMaterial
|
||||
{
|
||||
public double Modulus { get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
IMaterial material = new Material();
|
||||
material.InitModulus = Modulus;
|
||||
IEnumerable<double> parameters = new List<double>() { Modulus};
|
||||
IEnumerable<double> parameters = new List<double>() { Modulus, CompressiveStrength, TensileStrength};
|
||||
material.DiagramParameters = parameters;
|
||||
material.Diagram = GetStress;
|
||||
return material;
|
||||
@@ -25,12 +27,17 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
private double GetStress (IEnumerable<double> parameters, double strain)
|
||||
{
|
||||
return parameters.First() * strain;
|
||||
double modulus = parameters.First();
|
||||
double stress = modulus * strain;
|
||||
double compressiveStrength = (-1d) * parameters.ElementAt(1);
|
||||
double tensileStrength = parameters.ElementAt(2);
|
||||
if (stress > tensileStrength || stress < compressiveStrength) { return 0d; }
|
||||
else { return stress; }
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new ElasticMaterial() { Modulus = Modulus };
|
||||
return new ElasticMaterial() { Modulus = Modulus, CompressiveStrength = CompressiveStrength, TensileStrength = TensileStrength };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public interface IElasticMaterial : IHelperMaterial
|
||||
{
|
||||
double Modulus { get; set; }
|
||||
double CompressiveStrength { get; set; }
|
||||
double TensileStrength { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
20
StructureHelperLogics/Models/Primitives/IPrimitive.cs
Normal file
20
StructureHelperLogics/Models/Primitives/IPrimitive.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public interface IPrimitive : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
ICenter Center { get; }
|
||||
IShape Shape { get; }
|
||||
|
||||
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
||||
}
|
||||
}
|
||||
37
StructureHelperLogics/Models/Primitives/LinePrimitive.cs
Normal file
37
StructureHelperLogics/Models/Primitives/LinePrimitive.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class LinePrimitive : IPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; }
|
||||
|
||||
public LinePrimitive()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<INdmPrimitive> GetNdmPrimitives()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.Models.Templates.RCs
|
||||
|
||||
public RectangleBeamTemplate()
|
||||
{
|
||||
Shape = new Rectangle() { Width = 0.4d, Height = 0.6d };
|
||||
Shape = new RectangleShape() { Width = 0.4d, Height = 0.6d };
|
||||
CoverGap = 0.05d;
|
||||
TopDiameter = 0.016d;
|
||||
BottomDiameter = 0.025d;
|
||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.Models.Templates.RCs
|
||||
|
||||
public RectangleBeamTemplate(double width, double height)
|
||||
{
|
||||
Shape = new Rectangle() { Width = width, Height = height };
|
||||
Shape = new RectangleShape() { Width = width, Height = height };
|
||||
CoverGap = 0.05d;
|
||||
TopDiameter = 0.016d;
|
||||
BottomDiameter = 0.025d;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal interface IHasDivisionSize
|
||||
{
|
||||
double NdmMaxSize { get; set; }
|
||||
int NdmMinDivision { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,23 @@
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelper.Models.Materials;
|
||||
using System.Collections;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public interface INdmPrimitive
|
||||
{
|
||||
string Name { get; set; }
|
||||
ICenter Center { get; set; }
|
||||
IShape Shape { get; set; }
|
||||
IHeadMaterial HeadMaterial { get; }
|
||||
double NdmMaxSize { get; set; }
|
||||
int NdmMinDivision { get; set; }
|
||||
IHeadMaterial HeadMaterial { get; set; }
|
||||
double PrestrainKx { get; set; }
|
||||
double PrestrainKy { get; set; }
|
||||
double PrestrainEpsZ { get; set; }
|
||||
|
||||
IEnumerable<INdm> GetNdms(IMaterial material);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class LinePrimitive : INdmPrimitive, ILineShape, IHasDivisionSize, ISaveable, ICloneable
|
||||
{
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
|
||||
public ICenter StartPoint { get; set; }
|
||||
public ICenter EndPoint { get; set; }
|
||||
public double Thickness { get; set; }
|
||||
|
||||
public LinePrimitive()
|
||||
{
|
||||
StartPoint = new Center();
|
||||
EndPoint = new Center();
|
||||
|
||||
Name = "New Line";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
LinePrimitive primitive = new LinePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyLineProperties(this, primitive);
|
||||
return primitive;
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,47 @@
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelper.Models.Materials;
|
||||
using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class NdmPrimitive : INdmPrimitive
|
||||
public class NdmPrimitive : INdmPrimitive, ISaveable, ICloneable
|
||||
{
|
||||
private IHeadMaterial headMaterial;
|
||||
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get => headMaterial; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; private set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
|
||||
|
||||
public NdmPrimitive(IHeadMaterial material)
|
||||
{
|
||||
headMaterial = material;
|
||||
HeadMaterial = material;
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : INdmPrimitive, IRectangleShape, IHasDivisionSize, ISaveable, ICloneable
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Angle { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
RectanglePrimitive primitive = new RectanglePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyRectangleProperties(this, primitive);
|
||||
return primitive;
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
IRectangle Rectangle { get; }
|
||||
IRectangleShape Rectangle { get; }
|
||||
/// <summary>
|
||||
/// Maximum size (width or height) of ndm part after triangulation
|
||||
/// </summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
@@ -12,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// <inheritdoc />
|
||||
public ICenter Center { get; }
|
||||
/// <inheritdoc />
|
||||
public IRectangle Rectangle { get; }
|
||||
public IRectangleShape Rectangle { get; }
|
||||
/// <inheritdoc />
|
||||
public double NdmMaxSize { get; }
|
||||
/// <inheritdoc />
|
||||
@@ -24,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// <inheritdoc />
|
||||
public double PrestrainEpsZ { get;}
|
||||
|
||||
public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
|
||||
public RectangleTriangulationLogicOptions(ICenter center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
|
||||
{
|
||||
Center = center;
|
||||
Rectangle = rectangle;
|
||||
@@ -34,11 +35,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
||||
{
|
||||
if (! (primitive.Shape is IRectangle)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
if (! (primitive.Shape is IRectangleShape)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
Center = primitive.Center;
|
||||
Rectangle = primitive.Shape as IRectangle;
|
||||
NdmMaxSize = primitive.NdmMaxSize;
|
||||
NdmMinDivision = primitive.NdmMinDivision;
|
||||
Rectangle = primitive.Shape as IRectangleShape;
|
||||
if (primitive is IHasDivisionSize)
|
||||
{
|
||||
NdmMaxSize = (primitive as IHasDivisionSize).NdmMaxSize;
|
||||
NdmMinDivision = (primitive as IHasDivisionSize).NdmMinDivision;
|
||||
}
|
||||
PrestrainKx = primitive.PrestrainKx;
|
||||
PrestrainKy = primitive.PrestrainKy;
|
||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
ITriangulationLogicOptions options;
|
||||
ICenter center = primitive.Center;
|
||||
IShape shape = primitive.Shape;
|
||||
if (shape is IRectangle)
|
||||
if (shape is IRectangleShape)
|
||||
{
|
||||
options = new RectangleTriangulationLogicOptions(primitive);
|
||||
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
internal static class NdmPrimitivesService
|
||||
{
|
||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||
{
|
||||
target.Name = source.Name + " - copy" ;
|
||||
target.HeadMaterial = source.HeadMaterial;
|
||||
target.PrestrainKx = source.PrestrainKx;
|
||||
target.PrestrainKy = source.PrestrainKy;
|
||||
target.PrestrainEpsZ = source.PrestrainEpsZ;
|
||||
}
|
||||
|
||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||
{
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user