diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index 8ad2a80..65f7625 100644
--- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -70,30 +70,34 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
}
public double InvertedCenterY => - CenterY;
public double PrestrainKx
- { get => primitive.PrestrainKx;
+ { get => primitive.UsersPrestrain.Kx;
set
{
- primitive.PrestrainKx = value;
+ primitive.UsersPrestrain.Kx = value;
OnPropertyChanged(nameof(PrestrainKx));
}
}
public double PrestrainKy
- { get => primitive.PrestrainKy;
+ { get => primitive.UsersPrestrain.Ky;
set
{
- primitive.PrestrainKy = value;
+ primitive.UsersPrestrain.Ky = value;
OnPropertyChanged(nameof(PrestrainKy));
}
}
public double PrestrainEpsZ
- { get => primitive.PrestrainEpsZ;
+ { get => primitive.UsersPrestrain.EpsZ;
set
{
- primitive.PrestrainEpsZ = value;
+ primitive.UsersPrestrain.EpsZ = value;
OnPropertyChanged(nameof(PrestrainEpsZ));
}
}
+ public double AutoPrestrainKx => primitive.AutoPrestrain.Kx;
+ public double AutoPrestrainKy => primitive.AutoPrestrain.Ky;
+ public double AutoPrestrainEpsZ => primitive.AutoPrestrain.EpsZ;
+
public IHeadMaterial HeadMaterial
{
get => primitive.HeadMaterial;
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 4d8a953..80a9cca 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -178,6 +178,9 @@
App.xaml
Code
+
+ SetPrestrainView.xaml
+
InterpolateTuplesView.xaml
@@ -253,6 +256,7 @@
+
@@ -260,6 +264,7 @@
+
@@ -347,6 +352,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/StructureHelperCommon/Models/Forces/ForceTuple.cs b/StructureHelperCommon/Models/Forces/ForceTuple.cs
index 19f6285..78662b8 100644
--- a/StructureHelperCommon/Models/Forces/ForceTuple.cs
+++ b/StructureHelperCommon/Models/Forces/ForceTuple.cs
@@ -6,15 +6,23 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
+ ///
public class ForceTuple : IForceTuple
{
+ ///
public double Mx { get; set; }
+ ///
public double My { get; set; }
+ ///
public double Nz { get; set; }
+ ///
public double Qx { get; set; }
+ ///
public double Qy { get; set; }
+ ///
public double Mz { get; set; }
+ ///
public object Clone()
{
IForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz};
diff --git a/StructureHelperCommon/Models/Forces/IForceTuple.cs b/StructureHelperCommon/Models/Forces/IForceTuple.cs
index 1befa7f..96c487f 100644
--- a/StructureHelperCommon/Models/Forces/IForceTuple.cs
+++ b/StructureHelperCommon/Models/Forces/IForceTuple.cs
@@ -6,13 +6,34 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
+ ///
+ /// Interface for generic force for beams
+ ///
public interface IForceTuple : ICloneable
{
+ ///
+ /// Bending moment round about x-axis
+ ///
double Mx { get; set; }
+ ///
+ /// Bending moment round about y-axis
+ ///
double My { get; set; }
+ ///
+ /// Longitudinal force along x-axis
+ ///
double Nz { get; set; }
+ ///
+ /// Shear force along x-axis
+ ///
double Qx { get; set; }
+ ///
+ /// Shear force along z-axis
+ ///
double Qy { get; set; }
+ ///
+ /// Twisting moment round about z-axis
+ ///
double Mz { get; set; }
}
}
diff --git a/StructureHelperCommon/Models/Forces/Strains/IStrainTuple.cs b/StructureHelperCommon/Models/Forces/Strains/IStrainTuple.cs
new file mode 100644
index 0000000..8fc0bdf
--- /dev/null
+++ b/StructureHelperCommon/Models/Forces/Strains/IStrainTuple.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Forces
+{
+ ///
+ /// Interface for generic curvature for beams
+ ///
+ public interface IStrainTuple : ICloneable
+ {
+ ///
+ /// Curvature about x-axis
+ ///
+ double Kx { get; set; }
+ ///
+ /// Curvature about y-axis
+ ///
+ double Ky { get; set; }
+ ///
+ /// Strain along z-axis
+ ///
+ double EpsZ { get; set; }
+ ///
+ /// Screw along x-axis
+ ///
+ double Gx { get; set; }
+ ///
+ /// Screw along y-axis
+ ///
+ double Gy { get; set; }
+ ///
+ /// Twisting about z-axis
+ ///
+ double Gz { get; set; }
+ }
+}
diff --git a/StructureHelperCommon/Models/Forces/Strains/StrainTuple.cs b/StructureHelperCommon/Models/Forces/Strains/StrainTuple.cs
new file mode 100644
index 0000000..e18c6d7
--- /dev/null
+++ b/StructureHelperCommon/Models/Forces/Strains/StrainTuple.cs
@@ -0,0 +1,34 @@
+using StructureHelperCommon.Services.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Forces
+{
+ ///
+ public class StrainTuple : IStrainTuple
+ {
+ ///
+ public double Kx { get; set; }
+ ///
+ public double Ky { get; set; }
+ ///
+ public double EpsZ { get; set; }
+ ///
+ public double Gx { get; set; }
+ ///
+ public double Gy { get; set; }
+ ///
+ public double Gz { get; set; }
+
+ ///
+ public object Clone()
+ {
+ var target = new StrainTuple();
+ StrainTupleService.CopyProperties(this, target);
+ return target;
+ }
+ }
+}
diff --git a/StructureHelperCommon/Services/Forces/TupleService.cs b/StructureHelperCommon/Services/Forces/ForceTupleService.cs
similarity index 98%
rename from StructureHelperCommon/Services/Forces/TupleService.cs
rename to StructureHelperCommon/Services/Forces/ForceTupleService.cs
index 3f76628..ccf0951 100644
--- a/StructureHelperCommon/Services/Forces/TupleService.cs
+++ b/StructureHelperCommon/Services/Forces/ForceTupleService.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Forces
{
- public static class TupleService
+ public static class ForceTupleService
{
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
{
diff --git a/StructureHelperCommon/Services/Forces/StrainTupleService.cs b/StructureHelperCommon/Services/Forces/StrainTupleService.cs
new file mode 100644
index 0000000..6a488bb
--- /dev/null
+++ b/StructureHelperCommon/Services/Forces/StrainTupleService.cs
@@ -0,0 +1,35 @@
+using LoaderCalculator.Data.Matrix;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Services.Forces
+{
+ public static class StrainTupleService
+ {
+ public static void CopyProperties (IStrainTuple source, IStrainTuple target, double factor = 1 )
+ {
+ target.Kx = source.Kx * factor;
+ target.Ky = source.Ky * factor;
+ target.EpsZ = source.EpsZ * factor;
+ target.Gx = source.Gx * factor;
+ target.Gy = source.Gy * factor;
+ target.Gz = source.Gz * factor;
+ }
+
+ public static IStrainMatrix ConvertToLoaderStrainMatrix(IStrainTuple strainTuple)
+ {
+ IStrainMatrix strainMatrix = new StrainMatrix() { Kx = strainTuple.EpsZ, Ky = strainTuple.Ky, EpsZ = strainTuple.EpsZ };
+ return strainMatrix;
+ }
+
+ public static IStrainTuple ConvertToStrainTuple(IStrainMatrix strainMatrix)
+ {
+ IStrainTuple strainTuple = new StrainTuple() { Kx = strainMatrix.Kx, Ky = strainMatrix.Ky, EpsZ = strainMatrix.EpsZ };
+ return strainTuple;
+ }
+ }
+}
diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj
index e1bcd1c..6874bd7 100644
--- a/StructureHelperCommon/StructureHelperCommon.csproj
+++ b/StructureHelperCommon/StructureHelperCommon.csproj
@@ -32,6 +32,9 @@
4
+
+ ..\Libraries\LoaderCalculator.dll
+
@@ -68,6 +71,8 @@
+
+
@@ -94,7 +99,8 @@
-
+
+
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
index 83095e9..9063e50 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
@@ -56,7 +56,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] };
}
else point2D = combination.ForcePoint;
- var newTuple = TupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
+ var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
var result = GetPrimitiveStrainMatrix(ndms, newTuple);
result.DesignForceTuple.LimitState = limitState;
result.DesignForceTuple.CalcTerm = calcTerm;
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
index f00ad29..b5584c9 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
@@ -7,6 +7,7 @@ using LoaderCalculator.Data.Materials;
using System.Collections.Generic;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
+using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
@@ -16,9 +17,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
double CenterX { get; set; }
double CenterY { get; set; }
IHeadMaterial HeadMaterial { get; set; }
- double PrestrainKx { get; set; }
- double PrestrainKy { get; set; }
- double PrestrainEpsZ { get; set; }
+ IStrainTuple UsersPrestrain { get; }
+ IStrainTuple AutoPrestrain { get; }
+ //double PrestrainKx { get; set; }
+ //double PrestrainKy { get; set; }
+ //double PrestrainEpsZ { get; set; }
IVisualProperty VisualProperty {get; }
IEnumerable GetNdms(IMaterial material);
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/LinePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/LinePrimitive.cs
index 9df236d..375754e 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/LinePrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/LinePrimitive.cs
@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives;
@@ -33,6 +34,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public IVisualProperty VisualProperty => throw new NotImplementedException();
+ public IStrainTuple UsersPrestrain => throw new NotImplementedException();
+
+ public IStrainTuple AutoPrestrain => throw new NotImplementedException();
+
public LinePrimitive()
{
StartPoint = new Point2D();
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
index 6435b92..953a64b 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
@@ -9,6 +9,7 @@ using System;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
+using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.Models.Primitives
{
@@ -21,18 +22,21 @@ namespace StructureHelperLogics.Models.Primitives
public IHeadMaterial HeadMaterial { get; 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 IStrainTuple UsersPrestrain { get; private set; }
+ public IStrainTuple AutoPrestrain { get; private set; }
public double Area { get; set; }
public IVisualProperty VisualProperty { get; }
+
+
public PointPrimitive()
{
Name = "New Point";
Area = 0.0005d;
VisualProperty = new VisualProperty();
+ UsersPrestrain = new StrainTuple();
+ AutoPrestrain = new StrainTuple();
}
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
index 53b663b..a7d4cca 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives;
@@ -22,9 +23,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public double CenterX { get; set; }
public double CenterY { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
- public double PrestrainKx { get; set; }
- public double PrestrainKy { get; set; }
- public double PrestrainEpsZ { get; set; }
+ public IStrainTuple UsersPrestrain { get; private set; }
+ public IStrainTuple AutoPrestrain { get; private set; }
public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; }
public double Width { get; set; }
@@ -38,8 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
Name = "New Rectangle";
NdmMaxSize = 0.01d;
NdmMinDivision = 10;
- VisualProperty = new VisualProperty();
- VisualProperty.Opacity = 0.8;
+ VisualProperty = new VisualProperty { Opacity = 0.8d};
+ UsersPrestrain = new StrainTuple();
+ AutoPrestrain = new StrainTuple();
}
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
index c53e40e..1abae2e 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
@@ -34,9 +34,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
{
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Area = primitive.Area;
- PrestrainKx = primitive.PrestrainKx;
- PrestrainKy = primitive.PrestrainKy;
- PrestrainEpsZ = primitive.PrestrainEpsZ;
+ PrestrainKx = primitive.UsersPrestrain.Kx + primitive.AutoPrestrain.Kx;
+ PrestrainKy = primitive.UsersPrestrain.Ky + primitive.AutoPrestrain.Ky;
+ PrestrainEpsZ = primitive.UsersPrestrain.EpsZ + primitive.AutoPrestrain.EpsZ;
}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
index de91233..b7bf8a3 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
@@ -39,9 +39,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;
- PrestrainKx = primitive.PrestrainKx;
- PrestrainKy = primitive.PrestrainKy;
- PrestrainEpsZ = primitive.PrestrainEpsZ;
+ PrestrainKx = primitive.UsersPrestrain.Kx + primitive.AutoPrestrain.Kx;
+ PrestrainKy = primitive.UsersPrestrain.Ky + primitive.AutoPrestrain.Ky;
+ PrestrainEpsZ = primitive.UsersPrestrain.EpsZ + primitive.AutoPrestrain.EpsZ;
}
}
}
diff --git a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
index 7688fc6..ee11f7d 100644
--- a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
+++ b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
SetInGravityCenter = false
};
combination.DesignForces.Clear();
- combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount));
+ combination.DesignForces.AddRange(ForceTupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount));
combination.ForcePoint.X = 0;
combination.ForcePoint.Y = 0;
calculator.ForceCombinationLists.Add(combination);
diff --git a/StructureHelperLogics/Services/NdmPrimitives/NdmPrimitivesService.cs b/StructureHelperLogics/Services/NdmPrimitives/NdmPrimitivesService.cs
index 9e994fe..de61870 100644
--- a/StructureHelperLogics/Services/NdmPrimitives/NdmPrimitivesService.cs
+++ b/StructureHelperLogics/Services/NdmPrimitives/NdmPrimitivesService.cs
@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
@@ -31,9 +32,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
target.CenterX = source.CenterX;
target.CenterY = source.CenterY;
- target.PrestrainKx = source.PrestrainKx;
- target.PrestrainKy = source.PrestrainKy;
- target.PrestrainEpsZ = source.PrestrainEpsZ;
+ StrainTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
}
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
diff --git a/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml b/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml
index 546c45c..9c1997d 100644
--- a/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml
+++ b/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml
@@ -39,9 +39,10 @@
-
-
-
+
+
+
+
diff --git a/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml b/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml
new file mode 100644
index 0000000..59b8d0b
--- /dev/null
+++ b/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml.cs b/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml.cs
new file mode 100644
index 0000000..e84eb60
--- /dev/null
+++ b/Windows/CalculationWindows/CalculatorsViews/SetPrestrainView.xaml.cs
@@ -0,0 +1,41 @@
+using StructureHelper.Windows.ViewModels.Calculations.Calculators;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
+{
+ ///
+ /// Логика взаимодействия для Prestrain.xaml
+ ///
+ public partial class SetPrestrainView : Window
+ {
+ SetPrestrainViewModel viewModel;
+ public IStrainTuple StrainTuple { get; set; }
+
+ public SetPrestrainView(SetPrestrainViewModel vm)
+ {
+ InitializeComponent();
+ viewModel = vm;
+ DataContext = viewModel;
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ StrainTuple = viewModel.GetStrainTuple();
+ DialogResult = true;
+ Close();
+ }
+ }
+}
diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs
index 0bbc3de..047ad93 100644
--- a/Windows/MainWindow/MainViewModel.cs
+++ b/Windows/MainWindow/MainViewModel.cs
@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.MainWindow
public PrimitiveBase SelectedPrimitive { get; set; }
public IForceCombinationList SelectedForceCombinationList { get; set; }
- private readonly ICalculatorsViewModelLogic calculatorsLogic;
- public ICalculatorsViewModelLogic CalculatorsLogic { get => calculatorsLogic;}
+ private readonly AnalysisVewModel calculatorsLogic;
+ public AnalysisVewModel CalculatorsLogic { get => calculatorsLogic;}
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
@@ -202,7 +202,7 @@ namespace StructureHelper.Windows.MainWindow
Model = model;
section = model.Section;
combinationsLogic = new ActionsViewModel(repository);
- calculatorsLogic = new CalculatorsViewModelLogic(repository);
+ calculatorsLogic = new AnalysisVewModel(repository);
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
XX2 = CanvasWidth;
XY1 = CanvasHeight / 2d;
diff --git a/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml b/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
index ac1d3ef..6c08e23 100644
--- a/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
+++ b/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
@@ -115,17 +115,24 @@
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs b/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
index f7c4174..bbba5ac 100644
--- a/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
+++ b/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
@@ -1,11 +1,11 @@
-using FieldVisualizer.Infrastructure.Commands;
-using FieldVisualizer.ViewModels;
-using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
+using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
+using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
using StructureHelper.Windows.Forces;
using StructureHelper.Windows.PrimitivePropertiesWindow;
@@ -14,6 +14,7 @@ using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Forces;
+using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
@@ -21,6 +22,7 @@ using StructureHelperLogics.Services.NdmCalculations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
@@ -43,6 +45,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private RelayCommand showIsoFieldCommand;
private RelayCommand exportToCSVCommand;
private RelayCommand interpolateCommand;
+ private RelayCommand setPrestrainCommand;
public IForcesResults ForcesResults
{
@@ -81,7 +84,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
));
}
}
-
private void ExportToCSV()
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
@@ -109,6 +111,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
{
var logic = new ExportToCSVLogic(saveFileDialog.FileName);
logic.Export(forcesResults);
+ try
+ {
+ Process filopener = new Process();
+ filopener.StartInfo.FileName = saveFileDialog.FileName;
+ filopener.Start();
+ }
+ catch (Exception) { }
}
catch (Exception ex)
{
@@ -129,7 +138,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}, o => SelectedResult != null));
}
}
-
private void Interpolate()
{
IDesignForceTuple startDesignTuple, finishDesignTuple;
@@ -156,6 +164,34 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}
}
+ public RelayCommand SetPrestrainCommand
+ {
+ get
+ {
+ return setPrestrainCommand ??
+ (setPrestrainCommand = new RelayCommand(o=>
+ {
+ SetPrestrain();
+ }, o => SelectedResult != null
+ ));
+ }
+ }
+
+ private void SetPrestrain()
+ {
+ var source = StrainTupleService.ConvertToStrainTuple(SelectedResult.LoaderResults.StrainMatrix);
+ var vm = new SetPrestrainViewModel(source);
+ var wnd = new SetPrestrainView(vm);
+ wnd.ShowDialog();
+ if (wnd.DialogResult == true)
+ {
+ foreach (var item in ndmPrimitives)
+ {
+ StrainTupleService.CopyProperties(wnd.StrainTuple, item.AutoPrestrain);
+ }
+ }
+ }
+
public ForcesResultsViewModel(IForceCalculator forceCalculator)
{
this.forceCalculator = forceCalculator;
diff --git a/Windows/ViewModels/Calculations/Calculators/SetPrestrainViewModel.cs b/Windows/ViewModels/Calculations/Calculators/SetPrestrainViewModel.cs
new file mode 100644
index 0000000..8797839
--- /dev/null
+++ b/Windows/ViewModels/Calculations/Calculators/SetPrestrainViewModel.cs
@@ -0,0 +1,42 @@
+using FieldVisualizer.ViewModels;
+using StructureHelperCommon.Models.Forces;
+using StructureHelperCommon.Services.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
+{
+ public class SetPrestrainViewModel : ViewModelBase
+ {
+ IStrainTuple SourceTuple;
+ private double coeffcient;
+
+ public double Coefficient
+ {
+ get
+ {
+ return coeffcient;
+ }
+ set
+ {
+ SetProperty(ref coeffcient, value);
+ }
+ }
+
+ public SetPrestrainViewModel(IStrainTuple sourceTuple)
+ {
+ SourceTuple = sourceTuple;
+ coeffcient = 1d;
+ }
+
+ public IStrainTuple GetStrainTuple()
+ {
+ var result = new StrainTuple();
+ StrainTupleService.CopyProperties(SourceTuple, result, coeffcient);
+ return result;
+ }
+ }
+}
diff --git a/Windows/ViewModels/NdmCrossSections/AnalysisVewModel.cs b/Windows/ViewModels/NdmCrossSections/AnalysisVewModel.cs
new file mode 100644
index 0000000..ba1c6f7
--- /dev/null
+++ b/Windows/ViewModels/NdmCrossSections/AnalysisVewModel.cs
@@ -0,0 +1,77 @@
+using StructureHelper.Infrastructure;
+using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
+using StructureHelper.Windows.ViewModels.Calculations.Calculators;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Forces;
+using StructureHelperLogics.Models.CrossSections;
+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;
+using System.Windows.Forms;
+
+namespace StructureHelper.Windows.ViewModels.NdmCrossSections
+{
+ public class AnalysisVewModel : CRUDViewModelBase
+ {
+ private ICrossSectionRepository repository;
+ private RelayCommand runCommand;
+
+ public override void AddMethod(object parameter)
+ {
+ NewItem = new ForceCalculator() { Name = "New force calculator" };
+ base.AddMethod(parameter);
+ }
+ public override void EditMethod(object parameter)
+ {
+ if (SelectedItem is ForceCalculator)
+ {
+ var calculator = SelectedItem as ForceCalculator;
+ var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
+
+ var wnd = new ForceCalculatorView(vm);
+ wnd.ShowDialog();
+ }
+ base.EditMethod(parameter);
+ }
+ public override void DeleteMethod()
+ {
+ var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialogResult == DialogResult.Yes)
+ {
+ base.DeleteMethod();
+ }
+ }
+ public RelayCommand Run
+ {
+ get
+ {
+ return runCommand ??
+ (
+ runCommand = new RelayCommand(o =>
+ {
+ SelectedItem.Run();
+ var result = SelectedItem.Result;
+ if (result.IsValid == false)
+ {
+ MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ else
+ {
+ var calculator = SelectedItem as IForceCalculator;
+ var vm = new ForcesResultsViewModel(calculator);
+ var wnd = new ForceResultsView(vm);
+ wnd.ShowDialog();
+ }
+ }, o => SelectedItem != null));
+ }
+ }
+ public AnalysisVewModel(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
+ {
+ repository = sectionRepository;
+ }
+ }
+}
diff --git a/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs b/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
index fb055ad..9bd423f 100644
--- a/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
+++ b/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
@@ -90,6 +90,10 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
set => primitive.PrestrainEpsZ = value;
}
+ public double AutoPrestrainKx => primitive.AutoPrestrainKx;
+ public double AutoPrestrainKy => primitive.AutoPrestrainKy;
+ public double AutoPrestrainEpsZ => primitive.AutoPrestrainEpsZ;
+
public int MinElementDivision
{
get => (primitive as IHasDivision).NdmMinDivision;