Interpolation of results was added
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,38 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces
|
||||||
|
{
|
||||||
|
public enum ForceType
|
||||||
|
{
|
||||||
|
Force_zero,
|
||||||
|
Force_Mx50My50Nz100,
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DesignForceFactory
|
||||||
|
{
|
||||||
|
public static IDesignForceTuple GetDesignForce(ForceType forceType, LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
if (forceType == ForceType.Force_zero)
|
||||||
|
{
|
||||||
|
return new DesignForceTuple(limitState, calcTerm);
|
||||||
|
}
|
||||||
|
else if (forceType == ForceType.Force_Mx50My50Nz100)
|
||||||
|
{
|
||||||
|
var tuple = new DesignForceTuple(limitState, calcTerm);
|
||||||
|
var forceTuple = tuple.ForceTuple;
|
||||||
|
forceTuple.Mx = -50e3d;
|
||||||
|
forceTuple.My = -50e3d;
|
||||||
|
forceTuple.Nz = -100e3d;
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces
|
||||||
|
{
|
||||||
|
public enum DesignForceType
|
||||||
|
{
|
||||||
|
Suit_1,
|
||||||
|
Suit_2
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ForceCombinationListFactory
|
||||||
|
{
|
||||||
|
public static List<IDesignForceTuple> GetDesignForces(DesignForceType forceType)
|
||||||
|
{
|
||||||
|
if (forceType == DesignForceType.Suit_1)
|
||||||
|
{
|
||||||
|
var designForces = new List<IDesignForceTuple>();
|
||||||
|
designForces.Add(DesignForceFactory.GetDesignForce(ForceType.Force_Mx50My50Nz100, LimitStates.ULS, CalcTerms.ShortTerm));
|
||||||
|
designForces.Add(DesignForceFactory.GetDesignForce(ForceType.Force_Mx50My50Nz100, LimitStates.ULS, CalcTerms.LongTerm));
|
||||||
|
designForces.Add(DesignForceFactory.GetDesignForce(ForceType.Force_Mx50My50Nz100, LimitStates.SLS, CalcTerms.ShortTerm));
|
||||||
|
designForces.Add(DesignForceFactory.GetDesignForce(ForceType.Force_Mx50My50Nz100, LimitStates.SLS, CalcTerms.LongTerm));
|
||||||
|
return designForces;
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
StructureHelperCommon/Services/Forces/TupleService.cs
Normal file
54
StructureHelperCommon/Services/Forces/TupleService.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Services.Forces
|
||||||
|
{
|
||||||
|
public static class TupleService
|
||||||
|
{
|
||||||
|
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
|
||||||
|
{
|
||||||
|
var newTuple = forceTuple.Clone() as IForceTuple;
|
||||||
|
newTuple.Mx += newTuple.Nz * point2D.Y;
|
||||||
|
newTuple.My -= newTuple.Nz * point2D.X;
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IForceTuple InterpolateTuples(IForceTuple startTuple, IForceTuple endTuple, double coefficient)
|
||||||
|
{
|
||||||
|
double dMx, dMy, dNz;
|
||||||
|
dMx = endTuple.Mx - startTuple.Mx;
|
||||||
|
dMy = endTuple.My - startTuple.My;
|
||||||
|
dNz = endTuple.Nz - startTuple.Nz;
|
||||||
|
return new ForceTuple()
|
||||||
|
{
|
||||||
|
Mx = startTuple.Mx + dMx * coefficient,
|
||||||
|
My = startTuple.My + dMy * coefficient,
|
||||||
|
Nz = startTuple.Nz + dNz * coefficient
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IForceTuple InterpolateTuples(IForceTuple endTuple, double coefficient)
|
||||||
|
{
|
||||||
|
IForceTuple startTuple = new ForceTuple();
|
||||||
|
return InterpolateTuples(startTuple, endTuple, coefficient);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<IDesignForceTuple> InterpolateDesignTuple(IDesignForceTuple endTuple, int stepCount)
|
||||||
|
{
|
||||||
|
var tuples =new List<IDesignForceTuple>();
|
||||||
|
double step = 1d / stepCount;
|
||||||
|
for (int i = 0; i <= stepCount; i++)
|
||||||
|
{
|
||||||
|
var currentTuple = InterpolateTuples(endTuple.ForceTuple, i * step);
|
||||||
|
var currentDesignTuple = new DesignForceTuple() { LimitState = endTuple.LimitState, CalcTerm = endTuple.CalcTerm, ForceTuple = currentTuple };
|
||||||
|
tuples.Add(currentDesignTuple);
|
||||||
|
}
|
||||||
|
return tuples;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,8 @@
|
|||||||
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
||||||
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
|
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
|
||||||
<Compile Include="Models\Forces\DesignForceTuple.cs" />
|
<Compile Include="Models\Forces\DesignForceTuple.cs" />
|
||||||
|
<Compile Include="Models\Forces\Factories\DesignForceFactory.cs" />
|
||||||
|
<Compile Include="Models\Forces\Factories\ForceCombinationListFactory.cs" />
|
||||||
<Compile Include="Models\Forces\ForceCombinationList.cs" />
|
<Compile Include="Models\Forces\ForceCombinationList.cs" />
|
||||||
<Compile Include="Models\Forces\ForceTuple.cs" />
|
<Compile Include="Models\Forces\ForceTuple.cs" />
|
||||||
<Compile Include="Models\Forces\IDesignForceTuple.cs" />
|
<Compile Include="Models\Forces\IDesignForceTuple.cs" />
|
||||||
@@ -85,6 +87,7 @@
|
|||||||
<Compile Include="Models\Shapes\RectangleShape.cs" />
|
<Compile Include="Models\Shapes\RectangleShape.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
||||||
|
<Compile Include="Services\Forces\TupleService.cs" />
|
||||||
<Compile Include="Services\ShapeServices\ShapeService.cs" />
|
<Compile Include="Services\ShapeServices\ShapeService.cs" />
|
||||||
<Compile Include="Services\Units\IUnit.cs" />
|
<Compile Include="Services\Units\IUnit.cs" />
|
||||||
<Compile Include="Services\Units\Unit.cs" />
|
<Compile Include="Services\Units\Unit.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||||
|
{
|
||||||
|
internal class CalculatorLogic : ICalculatorLogic
|
||||||
|
{
|
||||||
|
public IEnumerable<INdmCalculator> GetNdmCalculators()
|
||||||
|
{
|
||||||
|
var calculators = new List<INdmCalculator>();
|
||||||
|
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
|
||||||
|
return calculators;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||||
|
{
|
||||||
|
internal class ForceLogic : IForceLogic
|
||||||
|
{
|
||||||
|
public IEnumerable<IForceCombinationList> GetCombinationList()
|
||||||
|
{
|
||||||
|
var combinations = new List<IForceCombinationList>();
|
||||||
|
var combination = new ForceCombinationList() { Name = "New Force Action"};
|
||||||
|
combination.DesignForces.Clear();
|
||||||
|
combination.DesignForces.AddRange(ForceCombinationListFactory.GetDesignForces(DesignForceType.Suit_1));
|
||||||
|
combinations.Add(combination);
|
||||||
|
return combinations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||||
{
|
{
|
||||||
internal interface ISectionGeometryLogic
|
public interface ISectionGeometryLogic
|
||||||
{
|
{
|
||||||
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
|
{
|
||||||
|
public interface IRCGeometryLogic : ISectionGeometryLogic
|
||||||
|
{
|
||||||
|
IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
|
{
|
||||||
|
internal class MaterialLogic : IMaterialLogic
|
||||||
|
{
|
||||||
|
public IEnumerable<IHeadMaterial> GetHeadMaterials()
|
||||||
|
{
|
||||||
|
var result = new List<IHeadMaterial>();
|
||||||
|
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||||
|
concrete.Name = "Concrete";
|
||||||
|
result.Add(concrete);
|
||||||
|
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||||
|
reinforcement.Name = "Reinforcement";
|
||||||
|
result.Add(reinforcement);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
|
{
|
||||||
|
public class RectGeometryLogic : IRCGeometryLogic
|
||||||
|
{
|
||||||
|
RectangleBeamTemplate template;
|
||||||
|
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
||||||
|
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
||||||
|
|
||||||
|
RectangleShape rect => template.Shape as RectangleShape;
|
||||||
|
double width => rect.Width;
|
||||||
|
double height => rect.Height;
|
||||||
|
double area1 => Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
||||||
|
double area2 => Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
||||||
|
double gap => template.CoverGap;
|
||||||
|
|
||||||
|
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
|
||||||
|
public RectGeometryLogic(RectangleBeamTemplate template)
|
||||||
|
{
|
||||||
|
this.template = template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdmPrimitive> GetNdmPrimitives()
|
||||||
|
{
|
||||||
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
|
primitives.AddRange(GetConcretePrimitives());
|
||||||
|
primitives.AddRange(GetCornerReinfrocementPrimitives());
|
||||||
|
if (template.WidthCount > 2 || template.HeightCount > 2)
|
||||||
|
{
|
||||||
|
primitives.AddRange(GetMiddleReinfrocementPrimitives());
|
||||||
|
}
|
||||||
|
return primitives;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||||
|
{
|
||||||
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
|
var rectangle = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
|
||||||
|
primitives.Add(rectangle);
|
||||||
|
return primitives;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<INdmPrimitive> GetCornerReinfrocementPrimitives()
|
||||||
|
{
|
||||||
|
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
||||||
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
|
var point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point" };
|
||||||
|
primitives.Add(point);
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point" };
|
||||||
|
primitives.Add(point);
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point" };
|
||||||
|
primitives.Add(point);
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point" };
|
||||||
|
primitives.Add(point);
|
||||||
|
return primitives;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<INdmPrimitive> GetMiddleReinfrocementPrimitives()
|
||||||
|
{
|
||||||
|
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
||||||
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
|
IPointPrimitive point;
|
||||||
|
if (template.WidthCount > 2)
|
||||||
|
{
|
||||||
|
int count = template.WidthCount - 1;
|
||||||
|
double dist = (xs[1] - xs[0]) / count;
|
||||||
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}" };
|
||||||
|
primitives.Add(point);
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}" };
|
||||||
|
primitives.Add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (template.HeightCount > 2)
|
||||||
|
{
|
||||||
|
int count = template.HeightCount - 1;
|
||||||
|
double dist = (ys[1] - ys[0]) / count;
|
||||||
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}" };
|
||||||
|
primitives.Add(point);
|
||||||
|
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}" };
|
||||||
|
primitives.Add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return primitives;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
@@ -9,36 +10,45 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
{
|
{
|
||||||
public class RCSectionTemplate : ICrossSectionTemplate
|
public class SectionTemplate : ICrossSectionTemplate
|
||||||
{
|
{
|
||||||
IForceLogic forceLogic;
|
IForceLogic forceLogic;
|
||||||
IMaterialLogic materialLogic;
|
IMaterialLogic materialLogic;
|
||||||
ISectionGeometryLogic geometryLogic;
|
IRCGeometryLogic geometryLogic;
|
||||||
ICalculatorLogic calculatorLogic;
|
ICalculatorLogic calculatorLogic;
|
||||||
IEnumerable<INdmPrimitive> primitives;
|
IEnumerable<INdmPrimitive> primitives;
|
||||||
IEnumerable<IForceCombinationList> combinations;
|
IEnumerable<IForceCombinationList> combinations;
|
||||||
IEnumerable<INdmCalculator> calculators;
|
IEnumerable<INdmCalculator> calculators;
|
||||||
|
|
||||||
|
public SectionTemplate(IRCGeometryLogic geometryLogic)
|
||||||
|
{
|
||||||
|
this.geometryLogic = geometryLogic;
|
||||||
|
materialLogic = new MaterialLogic();
|
||||||
|
forceLogic = new ForceLogic();
|
||||||
|
calculatorLogic = new CalculatorLogic();
|
||||||
|
}
|
||||||
|
|
||||||
public ICrossSection GetCrossSection()
|
public ICrossSection GetCrossSection()
|
||||||
{
|
{
|
||||||
ICrossSection section = new CrossSection();
|
ICrossSection section = new CrossSection();
|
||||||
var repository = section.SectionRepository;
|
var repository = section.SectionRepository;
|
||||||
var materials = materialLogic.GetHeadMaterials();
|
var materials = materialLogic.GetHeadMaterials();
|
||||||
|
geometryLogic.HeadMaterials = materials;
|
||||||
primitives = geometryLogic.GetNdmPrimitives();
|
primitives = geometryLogic.GetNdmPrimitives();
|
||||||
repository.HeadMaterials.AddRange(materials);
|
repository.HeadMaterials.AddRange(materials);
|
||||||
repository.Primitives.AddRange(primitives);
|
repository.Primitives.AddRange(primitives);
|
||||||
combinations = forceLogic.GetCombinationList();
|
combinations = forceLogic.GetCombinationList();
|
||||||
repository.ForceCombinationLists.AddRange(combinations);
|
repository.ForceCombinationLists.AddRange(combinations);
|
||||||
calculators = calculatorLogic.GetNdmCalculators();
|
calculators = calculatorLogic.GetNdmCalculators();
|
||||||
ProcessCalculatorsSetForce();
|
AddAllForcesToCalculators();
|
||||||
ProcessCalculatorsSetPrimitives();
|
AddAllPrimitivesToCalculator();
|
||||||
repository.CalculatorsList.AddRange(calculators);
|
repository.CalculatorsList.AddRange(calculators);
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessCalculatorsSetForce()
|
private void AddAllForcesToCalculators()
|
||||||
{
|
{
|
||||||
foreach (var calculator in calculators)
|
foreach (var calculator in calculators)
|
||||||
{
|
{
|
||||||
@@ -49,7 +59,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ProcessCalculatorsSetPrimitives()
|
private void AddAllPrimitivesToCalculator()
|
||||||
{
|
{
|
||||||
foreach (var calculator in calculators)
|
foreach (var calculator in calculators)
|
||||||
{
|
{
|
||||||
@@ -1,20 +1,16 @@
|
|||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.SourceData;
|
using LoaderCalculator.Data.SourceData;
|
||||||
using LoaderCalculator;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Text;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using StructureHelperLogics.Services.Forces;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
@@ -126,12 +122,25 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var result = new ForcesResult() { IsValid = false };
|
var result = new ForcesResult() { IsValid = false };
|
||||||
if (ex.Message == "") { result.Desctription = "Stiffness matrix is equal to zero"; }
|
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero") { result.Desctription = "Stiffness matrix is equal to zero \nProbably section was collapsed"; }
|
||||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
IForceCalculator calculator = new ForceCalculator();
|
||||||
|
calculator.LimitStatesList.Clear();
|
||||||
|
calculator.LimitStatesList.AddRange(LimitStatesList);
|
||||||
|
calculator.CalcTermsList.Clear();
|
||||||
|
calculator.CalcTermsList.AddRange(CalcTermsList);
|
||||||
|
calculator.IterationAccuracy = IterationAccuracy;
|
||||||
|
calculator.MaxIterationCount = MaxIterationCount;
|
||||||
|
calculator.Primitives.AddRange(Primitives);
|
||||||
|
calculator.ForceCombinationLists.AddRange(ForceCombinationLists);
|
||||||
|
return calculator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations, ICloneable
|
||||||
{
|
{
|
||||||
List<CalcTerms> CalcTermsList { get; }
|
List<CalcTerms> CalcTermsList { get; }
|
||||||
double IterationAccuracy { get; set; }
|
double IterationAccuracy { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||||
|
{
|
||||||
|
internal interface IExportResultLogic
|
||||||
|
{
|
||||||
|
void Export(INdmResult ndmResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using StructureHelperCommon.Models.Forces;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Services.Forces
|
|
||||||
{
|
|
||||||
internal static class TupleService
|
|
||||||
{
|
|
||||||
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
|
|
||||||
{
|
|
||||||
var newTuple = forceTuple.Clone() as IForceTuple;
|
|
||||||
newTuple.Mx += newTuple.Nz * point2D.Y;
|
|
||||||
newTuple.My -= newTuple.Nz * point2D.X;
|
|
||||||
return newTuple;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Services.NdmCalculations
|
||||||
|
{
|
||||||
|
public static class InterpolateService
|
||||||
|
{
|
||||||
|
public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple sourceTuple, int stepCount)
|
||||||
|
{
|
||||||
|
IForceCalculator calculator = new ForceCalculator();
|
||||||
|
calculator.LimitStatesList.Clear();
|
||||||
|
calculator.LimitStatesList.Add(sourceTuple.LimitState);
|
||||||
|
calculator.CalcTermsList.Clear();
|
||||||
|
calculator.CalcTermsList.Add(sourceTuple.CalcTerm);
|
||||||
|
calculator.IterationAccuracy = source.IterationAccuracy;
|
||||||
|
calculator.MaxIterationCount = source.MaxIterationCount;
|
||||||
|
calculator.Primitives.AddRange(source.Primitives);
|
||||||
|
calculator.ForceCombinationLists.Clear();
|
||||||
|
var combination = new ForceCombinationList()
|
||||||
|
{
|
||||||
|
Name = "New combination",
|
||||||
|
SetInGravityCenter = false
|
||||||
|
};
|
||||||
|
combination.DesignForces.Clear();
|
||||||
|
combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(sourceTuple, stepCount));
|
||||||
|
combination.ForcePoint.X = 0;
|
||||||
|
combination.ForcePoint.Y = 0;
|
||||||
|
calculator.ForceCombinationLists.Add(combination);
|
||||||
|
return calculator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Infrastructures\" />
|
<Folder Include="Infrastructures\" />
|
||||||
|
<Folder Include="Services\CrossSections\" />
|
||||||
|
<Folder Include="Services\Forces\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
|
||||||
d:DataContext="{d:DesignInstance vm:ForcesResultsViewModel}"
|
d:DataContext="{d:DesignInstance vm:ForcesResultsViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="ForceResultsView" Height="350" Width="650" MinHeight="300" MinWidth="400">
|
Title="ForceResultsView" Height="350" Width="650" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
@@ -40,7 +40,8 @@
|
|||||||
</DataGrid>
|
</DataGrid>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/>
|
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/>
|
||||||
<Button Margin="3" Content="Export" Command="{Binding ShowIsoFieldCommand}"/>
|
<Button Margin="3" Content="Interpolate" Command="{Binding InterpolateCommand}"/>
|
||||||
|
<Button Margin="3" Content="Export" Command="{Binding ExportToCSVCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
|
||||||
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
||||||
<MenuItem Header="Templates">
|
<MenuItem Header="Templates">
|
||||||
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
||||||
@@ -52,9 +51,10 @@
|
|||||||
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Analysis">
|
<!--<MenuItem Header="Analysis">
|
||||||
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
|
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem Header="Help">
|
||||||
|
</MenuItem>-->
|
||||||
</Menu>
|
</Menu>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using StructureHelper.Models.Primitives.Factories;
|
|||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
using StructureHelper.Windows.Forces;
|
|
||||||
using StructureHelper.Windows.MainWindow.Materials;
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||||
@@ -24,6 +23,7 @@ using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
|||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
@@ -342,7 +342,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(-50e3d, 50e3d, 0d);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddColumnCase = new RelayCommand(o =>
|
AddColumnCase = new RelayCommand(o =>
|
||||||
@@ -354,7 +353,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(50e3d, 50e3d, -100e3d);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddSlabCase = new RelayCommand(o =>
|
AddSlabCase = new RelayCommand(o =>
|
||||||
@@ -366,7 +364,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(-20e3d, 0d, 0d);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Calculate = new RelayCommand(o =>
|
Calculate = new RelayCommand(o =>
|
||||||
@@ -507,28 +504,25 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var view = new CalculationPropertyView(viewModel);
|
var view = new CalculationPropertyView(viewModel);
|
||||||
view.ShowDialog();
|
view.ShowDialog();
|
||||||
}
|
}
|
||||||
private void AddCaseLoads(double mx, double my, double nz)
|
|
||||||
{
|
|
||||||
ForceCombination combination = new ForceCombination();
|
|
||||||
combination.ForceMatrix.Mx = mx;
|
|
||||||
combination.ForceMatrix.My = my;
|
|
||||||
combination.ForceMatrix.Nz = nz;
|
|
||||||
calculationProperty.ForceCombinations.Add(combination);
|
|
||||||
}
|
|
||||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(RectangleBeamTemplate template)
|
private IEnumerable<PrimitiveBase> GetCasePrimitives(RectangleBeamTemplate template)
|
||||||
{
|
{
|
||||||
var wnd = new RectangleBeamView(template);
|
var wnd = new RectangleBeamView(template);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (wnd.DialogResult == true)
|
||||||
{
|
{
|
||||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||||
concrete.Name = "Concrete";
|
var newRepository = newSection.SectionRepository;
|
||||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||||
reinforcement.Name = "Reinforcement";
|
repository.Primitives.AddRange(newRepository.Primitives);
|
||||||
Model.Section.SectionRepository.HeadMaterials.Add(concrete);
|
repository.ForceCombinationLists.AddRange(newRepository.ForceCombinationLists);
|
||||||
Model.Section.SectionRepository.HeadMaterials.Add(reinforcement);
|
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
||||||
OnPropertyChanged(nameof(HeadMaterials));
|
OnPropertyChanged(nameof(HeadMaterials));
|
||||||
var primitives = PrimitiveFactory.GetRectangleRCElement(template, concrete, reinforcement);
|
CombinationsLogic.AddItems(newRepository.ForceCombinationLists);
|
||||||
|
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||||
|
//OnPropertyChanged(nameof(CombinationsLogic.Items));
|
||||||
|
//OnPropertyChanged(nameof(CalculatorsLogic.Items));
|
||||||
|
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||||
foreach (var item in primitives)
|
foreach (var item in primitives)
|
||||||
{
|
{
|
||||||
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||||
|
|||||||
@@ -15,19 +15,27 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
||||||
{
|
{
|
||||||
public class CalculationResultViewModel
|
public class CalculationResultViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
public ICalculationResult SelectedResult { get; set; }
|
public ICalculationResult SelectedResult { get; set; }
|
||||||
public ICommand ShowIsoFieldCommand { get;}
|
|
||||||
private ObservableCollection<ICalculationResult> calculationResults;
|
private ObservableCollection<ICalculationResult> calculationResults;
|
||||||
private IEnumerable<INdm> ndms;
|
private IEnumerable<INdm> ndms;
|
||||||
private IReport isoFieldReport;
|
private IReport isoFieldReport;
|
||||||
|
private RelayCommand showIsoFieldCommand;
|
||||||
|
|
||||||
|
public RelayCommand ShowIsoFieldCommand
|
||||||
|
{ get
|
||||||
|
{
|
||||||
|
return showIsoFieldCommand ??
|
||||||
|
(
|
||||||
|
showIsoFieldCommand = new RelayCommand(o =>
|
||||||
|
ShowIsoField(),
|
||||||
|
o => !(SelectedResult is null) && SelectedResult.IsValid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CalculationResultViewModel(IEnumerable<ICalculationResult> results, IEnumerable<INdm> ndmCollection)
|
public CalculationResultViewModel(IEnumerable<ICalculationResult> results, IEnumerable<INdm> ndmCollection)
|
||||||
{
|
{
|
||||||
ShowIsoFieldCommand = new RelayCommand(o=>ShowIsoField(), o=> !(SelectedResult is null) && SelectedResult.IsValid);
|
|
||||||
//
|
|
||||||
calculationResults = new ObservableCollection<ICalculationResult>();
|
calculationResults = new ObservableCollection<ICalculationResult>();
|
||||||
ndms = ndmCollection;
|
ndms = ndmCollection;
|
||||||
foreach (var result in results)
|
foreach (var result in results)
|
||||||
|
|||||||
@@ -6,14 +6,17 @@ using StructureHelper.Infrastructure.UI.DataContexts;
|
|||||||
using StructureHelper.Services.Reports;
|
using StructureHelper.Services.Reports;
|
||||||
using StructureHelper.Services.Reports.CalculationReports;
|
using StructureHelper.Services.Reports.CalculationReports;
|
||||||
using StructureHelper.Services.ResultViewers;
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||||
@@ -27,26 +30,69 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
private IReport isoFieldReport;
|
private IReport isoFieldReport;
|
||||||
|
|
||||||
public ForcesResult SelectedResult { get; set; }
|
public ForcesResult SelectedResult { get; set; }
|
||||||
private ICommand showIsoFieldCommand;
|
private RelayCommand showIsoFieldCommand;
|
||||||
|
private RelayCommand exportToCSVCommand;
|
||||||
|
private RelayCommand interpolateCommand;
|
||||||
|
|
||||||
public IForcesResults ForcesResults
|
public IForcesResults ForcesResults
|
||||||
{
|
{
|
||||||
get => forcesResults;
|
get => forcesResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand ShowIsoFieldCommand
|
public RelayCommand ShowIsoFieldCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return showIsoFieldCommand ??
|
return showIsoFieldCommand ??
|
||||||
(
|
(showIsoFieldCommand = new RelayCommand(o =>
|
||||||
showIsoFieldCommand = new RelayCommand(o =>
|
|
||||||
{
|
{
|
||||||
GetNdms();
|
GetNdms();
|
||||||
ShowIsoField();
|
ShowIsoField();
|
||||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand ExportToCSVCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return exportToCSVCommand ??
|
||||||
|
(exportToCSVCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand InterpolateCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return interpolateCommand ??
|
||||||
|
(interpolateCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
Interpolate();
|
||||||
|
}, o => SelectedResult != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Interpolate()
|
||||||
|
{
|
||||||
|
int stepCount = 100;
|
||||||
|
var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, SelectedResult.DesignForceTuple, stepCount);
|
||||||
|
calculator.Run();
|
||||||
|
var result = calculator.Result;
|
||||||
|
if (result is null || result.IsValid == false)
|
||||||
|
{
|
||||||
|
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var vm = new ForcesResultsViewModel(calculator);
|
||||||
|
var wnd = new ForceResultsView(vm);
|
||||||
|
wnd.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForcesResultsViewModel(IForceCalculator forceCalculator)
|
public ForcesResultsViewModel(IForceCalculator forceCalculator)
|
||||||
|
|||||||
@@ -16,5 +16,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
RelayCommand Add { get; }
|
RelayCommand Add { get; }
|
||||||
RelayCommand Delete { get; }
|
RelayCommand Delete { get; }
|
||||||
RelayCommand Edit { get; }
|
RelayCommand Edit { get; }
|
||||||
|
RelayCommand Copy { get; }
|
||||||
|
void AddItems(IEnumerable<TItem> items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
@@ -18,18 +19,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private readonly ICrossSectionRepository repository;
|
private readonly ICrossSectionRepository repository;
|
||||||
|
|
||||||
public INdmCalculator SelectedItem { get; set; }
|
public INdmCalculator SelectedItem { get; set; }
|
||||||
public ObservableCollection<INdmCalculator> Items
|
public ObservableCollection<INdmCalculator> Items { get; private set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var collection = new ObservableCollection<INdmCalculator>();
|
|
||||||
foreach (var item in repository.CalculatorsList)
|
|
||||||
{
|
|
||||||
collection.Add(item);
|
|
||||||
}
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private RelayCommand addCalculatorCommand;
|
private RelayCommand addCalculatorCommand;
|
||||||
public RelayCommand Add
|
public RelayCommand Add
|
||||||
@@ -48,6 +38,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private void AddCalculator()
|
private void AddCalculator()
|
||||||
{
|
{
|
||||||
var item = new ForceCalculator() { Name = "New force calculator" };
|
var item = new ForceCalculator() { Name = "New force calculator" };
|
||||||
|
Items.Add(item);
|
||||||
repository.CalculatorsList.Add(item);
|
repository.CalculatorsList.Add(item);
|
||||||
}
|
}
|
||||||
private RelayCommand editCalculatorCommand;
|
private RelayCommand editCalculatorCommand;
|
||||||
@@ -115,6 +106,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RelayCommand Copy => throw new NotImplementedException();
|
||||||
|
|
||||||
private void DeleteCalculator()
|
private void DeleteCalculator()
|
||||||
{
|
{
|
||||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
@@ -124,9 +117,20 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddItems(IEnumerable<INdmCalculator> items)
|
||||||
|
{
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CalculatorsViewModelLogic(ICrossSectionRepository repository)
|
public CalculatorsViewModelLogic(ICrossSectionRepository repository)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
Items = new ObservableCollection<INdmCalculator>();
|
||||||
|
AddItems(this.repository.CalculatorsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
public IForceCombinationList SelectedItem { get; set; }
|
public IForceCombinationList SelectedItem { get; set; }
|
||||||
|
|
||||||
public ObservableCollection<IForceCombinationList> Items
|
public ObservableCollection<IForceCombinationList> Items { get; private set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var collection = new ObservableCollection<IForceCombinationList>();
|
|
||||||
foreach (var item in repository.ForceCombinationLists)
|
|
||||||
{
|
|
||||||
collection.Add(item);
|
|
||||||
}
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private RelayCommand addForceCombinationCommand;
|
private RelayCommand addForceCombinationCommand;
|
||||||
public RelayCommand Add
|
public RelayCommand Add
|
||||||
@@ -50,6 +39,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private void AddCombination()
|
private void AddCombination()
|
||||||
{
|
{
|
||||||
var item = new ForceCombinationList() { Name = "New Force Combination" };
|
var item = new ForceCombinationList() { Name = "New Force Combination" };
|
||||||
|
Items.Add(item);
|
||||||
repository.ForceCombinationLists.Add(item);
|
repository.ForceCombinationLists.Add(item);
|
||||||
}
|
}
|
||||||
private RelayCommand deleteForceCombinationCommand;
|
private RelayCommand deleteForceCombinationCommand;
|
||||||
@@ -88,15 +78,28 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}, o => SelectedItem != null));
|
}, o => SelectedItem != null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RelayCommand Copy => throw new NotImplementedException();
|
||||||
|
|
||||||
private void EditForceCombination()
|
private void EditForceCombination()
|
||||||
{
|
{
|
||||||
var wnd = new ForceCombinationView(SelectedItem);
|
var wnd = new ForceCombinationView(SelectedItem);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddItems(IEnumerable<IForceCombinationList> items)
|
||||||
|
{
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ForceCombinationViewModelLogic(ICrossSectionRepository repository)
|
public ForceCombinationViewModelLogic(ICrossSectionRepository repository)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
Items = new ObservableCollection<IForceCombinationList>();
|
||||||
|
AddItems(this.repository.ForceCombinationLists);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user