AnalysisViewModal and StrainTuple was added

This commit is contained in:
Evgeny Redikultsev
2023-01-14 17:49:28 +05:00
parent 0eab974552
commit 062be10d96
27 changed files with 458 additions and 47 deletions

View File

@@ -70,30 +70,34 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
} }
public double InvertedCenterY => - CenterY; public double InvertedCenterY => - CenterY;
public double PrestrainKx public double PrestrainKx
{ get => primitive.PrestrainKx; { get => primitive.UsersPrestrain.Kx;
set set
{ {
primitive.PrestrainKx = value; primitive.UsersPrestrain.Kx = value;
OnPropertyChanged(nameof(PrestrainKx)); OnPropertyChanged(nameof(PrestrainKx));
} }
} }
public double PrestrainKy public double PrestrainKy
{ get => primitive.PrestrainKy; { get => primitive.UsersPrestrain.Ky;
set set
{ {
primitive.PrestrainKy = value; primitive.UsersPrestrain.Ky = value;
OnPropertyChanged(nameof(PrestrainKy)); OnPropertyChanged(nameof(PrestrainKy));
} }
} }
public double PrestrainEpsZ public double PrestrainEpsZ
{ get => primitive.PrestrainEpsZ; { get => primitive.UsersPrestrain.EpsZ;
set set
{ {
primitive.PrestrainEpsZ = value; primitive.UsersPrestrain.EpsZ = value;
OnPropertyChanged(nameof(PrestrainEpsZ)); OnPropertyChanged(nameof(PrestrainEpsZ));
} }
} }
public double AutoPrestrainKx => primitive.AutoPrestrain.Kx;
public double AutoPrestrainKy => primitive.AutoPrestrain.Ky;
public double AutoPrestrainEpsZ => primitive.AutoPrestrain.EpsZ;
public IHeadMaterial HeadMaterial public IHeadMaterial HeadMaterial
{ {
get => primitive.HeadMaterial; get => primitive.HeadMaterial;

View File

@@ -178,6 +178,9 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Windows\CalculationWindows\CalculatorsViews\SetPrestrainView.xaml.cs">
<DependentUpon>SetPrestrainView.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\Forces\InterpolateTuplesView.xaml.cs"> <Compile Include="Windows\Forces\InterpolateTuplesView.xaml.cs">
<DependentUpon>InterpolateTuplesView.xaml</DependentUpon> <DependentUpon>InterpolateTuplesView.xaml</DependentUpon>
</Compile> </Compile>
@@ -253,6 +256,7 @@
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" /> <Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" /> <Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForcesResultsViewModel.cs" /> <Compile Include="Windows\ViewModels\Calculations\Calculators\ForcesResultsViewModel.cs" />
<Compile Include="Windows\ViewModels\Calculations\Calculators\SetPrestrainViewModel.cs" />
<Compile Include="Windows\ViewModels\CRUDViewModelBase.cs" /> <Compile Include="Windows\ViewModels\CRUDViewModelBase.cs" />
<Compile Include="Windows\ViewModels\Forces\ForceTuplesViewModel.cs" /> <Compile Include="Windows\ViewModels\Forces\ForceTuplesViewModel.cs" />
<Compile Include="Windows\ViewModels\Forces\InterpolateTuplesViewModel.cs" /> <Compile Include="Windows\ViewModels\Forces\InterpolateTuplesViewModel.cs" />
@@ -260,6 +264,7 @@
<Compile Include="Windows\ViewModels\Materials\PartialFactorsViewModel.cs" /> <Compile Include="Windows\ViewModels\Materials\PartialFactorsViewModel.cs" />
<Compile Include="Windows\ViewModels\Materials\SafetyFactorsViewModel.cs" /> <Compile Include="Windows\ViewModels\Materials\SafetyFactorsViewModel.cs" />
<Compile Include="Windows\ViewModels\Forces\ActionsViewModel.cs" /> <Compile Include="Windows\ViewModels\Forces\ActionsViewModel.cs" />
<Compile Include="Windows\ViewModels\NdmCrossSections\AnalysisVewModel.cs" />
<Compile Include="Windows\ViewModels\NdmCrossSections\IPrimitiveViewModelLogic.cs" /> <Compile Include="Windows\ViewModels\NdmCrossSections\IPrimitiveViewModelLogic.cs" />
<Compile Include="Windows\ViewModels\NdmCrossSections\PrimitiveViewModelLogic.cs" /> <Compile Include="Windows\ViewModels\NdmCrossSections\PrimitiveViewModelLogic.cs" />
<Compile Include="Windows\ViewModels\NdmCrossSections\CrossSectionViewVisualProperty.cs" /> <Compile Include="Windows\ViewModels\NdmCrossSections\CrossSectionViewVisualProperty.cs" />
@@ -347,6 +352,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Windows\CalculationWindows\CalculatorsViews\SetPrestrainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\Forces\InterpolateTuplesView.xaml"> <Page Include="Windows\Forces\InterpolateTuplesView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

View File

@@ -6,15 +6,23 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces namespace StructureHelperCommon.Models.Forces
{ {
/// <inheritdoc/>
public class ForceTuple : IForceTuple public class ForceTuple : IForceTuple
{ {
/// <inheritdoc/>
public double Mx { get; set; } public double Mx { get; set; }
/// <inheritdoc/>
public double My { get; set; } public double My { get; set; }
/// <inheritdoc/>
public double Nz { get; set; } public double Nz { get; set; }
/// <inheritdoc/>
public double Qx { get; set; } public double Qx { get; set; }
/// <inheritdoc/>
public double Qy { get; set; } public double Qy { get; set; }
/// <inheritdoc/>
public double Mz { get; set; } public double Mz { get; set; }
/// <inheritdoc/>
public object Clone() public object Clone()
{ {
IForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz}; IForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz};

View File

@@ -6,13 +6,34 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces namespace StructureHelperCommon.Models.Forces
{ {
/// <summary>
/// Interface for generic force for beams
/// </summary>
public interface IForceTuple : ICloneable public interface IForceTuple : ICloneable
{ {
/// <summary>
/// Bending moment round about x-axis
/// </summary>
double Mx { get; set; } double Mx { get; set; }
/// <summary>
/// Bending moment round about y-axis
/// </summary>
double My { get; set; } double My { get; set; }
/// <summary>
/// Longitudinal force along x-axis
/// </summary>
double Nz { get; set; } double Nz { get; set; }
/// <summary>
/// Shear force along x-axis
/// </summary>
double Qx { get; set; } double Qx { get; set; }
/// <summary>
/// Shear force along z-axis
/// </summary>
double Qy { get; set; } double Qy { get; set; }
/// <summary>
/// Twisting moment round about z-axis
/// </summary>
double Mz { get; set; } double Mz { get; set; }
} }
} }

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Interface for generic curvature for beams
/// </summary>
public interface IStrainTuple : ICloneable
{
/// <summary>
/// Curvature about x-axis
/// </summary>
double Kx { get; set; }
/// <summary>
/// Curvature about y-axis
/// </summary>
double Ky { get; set; }
/// <summary>
/// Strain along z-axis
/// </summary>
double EpsZ { get; set; }
/// <summary>
/// Screw along x-axis
/// </summary>
double Gx { get; set; }
/// <summary>
/// Screw along y-axis
/// </summary>
double Gy { get; set; }
/// <summary>
/// Twisting about z-axis
/// </summary>
double Gz { get; set; }
}
}

View File

@@ -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
{
/// <inheritdoc/>
public class StrainTuple : IStrainTuple
{
/// <inheritdoc/>
public double Kx { get; set; }
/// <inheritdoc/>
public double Ky { get; set; }
/// <inheritdoc/>
public double EpsZ { get; set; }
/// <inheritdoc/>
public double Gx { get; set; }
/// <inheritdoc/>
public double Gy { get; set; }
/// <inheritdoc/>
public double Gz { get; set; }
/// <inheritdoc/>
public object Clone()
{
var target = new StrainTuple();
StrainTupleService.CopyProperties(this, target);
return target;
}
}
}

View File

@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Forces namespace StructureHelperCommon.Services.Forces
{ {
public static class TupleService public static class ForceTupleService
{ {
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D) public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
{ {

View File

@@ -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;
}
}
}

View File

@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="LoaderCalculator">
<HintPath>..\Libraries\LoaderCalculator.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@@ -68,6 +71,8 @@
<Compile Include="Models\Forces\IForceCombinationList.cs" /> <Compile Include="Models\Forces\IForceCombinationList.cs" />
<Compile Include="Models\Forces\IForceRepository.cs" /> <Compile Include="Models\Forces\IForceRepository.cs" />
<Compile Include="Models\Forces\IForceTuple.cs" /> <Compile Include="Models\Forces\IForceTuple.cs" />
<Compile Include="Models\Forces\Strains\IStrainTuple.cs" />
<Compile Include="Models\Forces\Strains\StrainTuple.cs" />
<Compile Include="Models\Materials\Libraries\ConcreteMaterialEntity.cs" /> <Compile Include="Models\Materials\Libraries\ConcreteMaterialEntity.cs" />
<Compile Include="Models\Materials\Libraries\Factories\ConcreteFactorsFactory.cs" /> <Compile Include="Models\Materials\Libraries\Factories\ConcreteFactorsFactory.cs" />
<Compile Include="Models\Materials\Libraries\Factories\LibMaterialFactory.cs" /> <Compile Include="Models\Materials\Libraries\Factories\LibMaterialFactory.cs" />
@@ -94,7 +99,8 @@
<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\Forces\ForceTupleService.cs" />
<Compile Include="Services\Forces\StrainTupleService.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" />

View File

@@ -56,7 +56,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] }; point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] };
} }
else point2D = combination.ForcePoint; else point2D = combination.ForcePoint;
var newTuple = TupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D); var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
var result = GetPrimitiveStrainMatrix(ndms, newTuple); var result = GetPrimitiveStrainMatrix(ndms, newTuple);
result.DesignForceTuple.LimitState = limitState; result.DesignForceTuple.LimitState = limitState;
result.DesignForceTuple.CalcTerm = calcTerm; result.DesignForceTuple.CalcTerm = calcTerm;

View File

@@ -7,6 +7,7 @@ using LoaderCalculator.Data.Materials;
using System.Collections.Generic; using System.Collections.Generic;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using System; using System;
using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.NdmCalculations.Primitives namespace StructureHelperLogics.NdmCalculations.Primitives
{ {
@@ -16,9 +17,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
double CenterX { get; set; } double CenterX { get; set; }
double CenterY { get; set; } double CenterY { get; set; }
IHeadMaterial HeadMaterial { get; set; } IHeadMaterial HeadMaterial { get; set; }
double PrestrainKx { get; set; } IStrainTuple UsersPrestrain { get; }
double PrestrainKy { get; set; } IStrainTuple AutoPrestrain { get; }
double PrestrainEpsZ { get; set; } //double PrestrainKx { get; set; }
//double PrestrainKy { get; set; }
//double PrestrainEpsZ { get; set; }
IVisualProperty VisualProperty {get; } IVisualProperty VisualProperty {get; }
IEnumerable<INdm> GetNdms(IMaterial material); IEnumerable<INdm> GetNdms(IMaterial material);

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials; using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices; using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
@@ -33,6 +34,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public IVisualProperty VisualProperty => throw new NotImplementedException(); public IVisualProperty VisualProperty => throw new NotImplementedException();
public IStrainTuple UsersPrestrain => throw new NotImplementedException();
public IStrainTuple AutoPrestrain => throw new NotImplementedException();
public LinePrimitive() public LinePrimitive()
{ {
StartPoint = new Point2D(); StartPoint = new Point2D();

View File

@@ -9,6 +9,7 @@ using System;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations; using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives; using StructureHelperLogics.Services.NdmPrimitives;
using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.Models.Primitives namespace StructureHelperLogics.Models.Primitives
{ {
@@ -21,18 +22,21 @@ namespace StructureHelperLogics.Models.Primitives
public IHeadMaterial HeadMaterial { get; set; } public IHeadMaterial HeadMaterial { get; set; }
public double NdmMaxSize { get; set; } public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; } public int NdmMinDivision { get; set; }
public double PrestrainKx { get; set; } public IStrainTuple UsersPrestrain { get; private set; }
public double PrestrainKy { get; set; } public IStrainTuple AutoPrestrain { get; private set; }
public double PrestrainEpsZ { get; set; }
public double Area { get; set; } public double Area { get; set; }
public IVisualProperty VisualProperty { get; } public IVisualProperty VisualProperty { get; }
public PointPrimitive() public PointPrimitive()
{ {
Name = "New Point"; Name = "New Point";
Area = 0.0005d; Area = 0.0005d;
VisualProperty = new VisualProperty(); VisualProperty = new VisualProperty();
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
} }
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; } public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials; using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices; using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
@@ -22,9 +23,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public double CenterX { get; set; } public double CenterX { get; set; }
public double CenterY { get; set; } public double CenterY { get; set; }
public IHeadMaterial HeadMaterial { get; set; } public IHeadMaterial HeadMaterial { get; set; }
public double PrestrainKx { get; set; } public IStrainTuple UsersPrestrain { get; private set; }
public double PrestrainKy { get; set; } public IStrainTuple AutoPrestrain { get; private set; }
public double PrestrainEpsZ { get; set; }
public double NdmMaxSize { get; set; } public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; } public int NdmMinDivision { get; set; }
public double Width { get; set; } public double Width { get; set; }
@@ -38,8 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
Name = "New Rectangle"; Name = "New Rectangle";
NdmMaxSize = 0.01d; NdmMaxSize = 0.01d;
NdmMinDivision = 10; NdmMinDivision = 10;
VisualProperty = new VisualProperty(); VisualProperty = new VisualProperty { Opacity = 0.8d};
VisualProperty.Opacity = 0.8; UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
} }
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; } public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }

View File

@@ -34,9 +34,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
{ {
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY }; Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Area = primitive.Area; Area = primitive.Area;
PrestrainKx = primitive.PrestrainKx; PrestrainKx = primitive.UsersPrestrain.Kx + primitive.AutoPrestrain.Kx;
PrestrainKy = primitive.PrestrainKy; PrestrainKy = primitive.UsersPrestrain.Ky + primitive.AutoPrestrain.Ky;
PrestrainEpsZ = primitive.PrestrainEpsZ; PrestrainEpsZ = primitive.UsersPrestrain.EpsZ + primitive.AutoPrestrain.EpsZ;
} }
} }
} }

View File

@@ -39,9 +39,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Rectangle = primitive; Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize; NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision; NdmMinDivision = primitive.NdmMinDivision;
PrestrainKx = primitive.PrestrainKx; PrestrainKx = primitive.UsersPrestrain.Kx + primitive.AutoPrestrain.Kx;
PrestrainKy = primitive.PrestrainKy; PrestrainKy = primitive.UsersPrestrain.Ky + primitive.AutoPrestrain.Ky;
PrestrainEpsZ = primitive.PrestrainEpsZ; PrestrainEpsZ = primitive.UsersPrestrain.EpsZ + primitive.AutoPrestrain.EpsZ;
} }
} }
} }

View File

@@ -29,7 +29,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
SetInGravityCenter = false SetInGravityCenter = false
}; };
combination.DesignForces.Clear(); 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.X = 0;
combination.ForcePoint.Y = 0; combination.ForcePoint.Y = 0;
calculator.ForceCombinationLists.Add(combination); calculator.ForceCombinationLists.Add(combination);

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.Models.Calculations.CalculationProperties; using StructureHelperLogics.Models.Calculations.CalculationProperties;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
@@ -31,9 +32,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
CopyVisualProperty(source.VisualProperty, target.VisualProperty); CopyVisualProperty(source.VisualProperty, target.VisualProperty);
target.CenterX = source.CenterX; target.CenterX = source.CenterX;
target.CenterY = source.CenterY; target.CenterY = source.CenterY;
target.PrestrainKx = source.PrestrainKx; StrainTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
target.PrestrainKy = source.PrestrainKy;
target.PrestrainEpsZ = source.PrestrainEpsZ;
} }
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target) public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)

View File

@@ -39,9 +39,10 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<StackPanel Grid.Column="1"> <StackPanel Grid.Column="1">
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/> <Button Margin="3" Content="Graphic" ToolTip="Show graphic results" Command="{Binding ShowIsoFieldCommand}"/>
<Button Margin="3" Content="Interpolate" Command="{Binding InterpolateCommand}"/> <Button Margin="3" Content="Interpolate" ToolTip="Create analysis by substep" Command="{Binding InterpolateCommand}"/>
<Button Margin="3" Content="Export" Command="{Binding ExportToCSVCommand}"/> <Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Window> </Window>

View File

@@ -0,0 +1,35 @@
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.SetPrestrainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance vm:SetPrestrainViewModel}"
Title="Set Prestrain" Height="200" Width="250" MinHeight="200" MinWidth="200" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="35"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Set Auto-prestrain"/>
<TextBlock Grid.Row="1" Text="Coefficient"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Coefficient}"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource CancelButton}"/>
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@@ -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
{
/// <summary>
/// Логика взаимодействия для Prestrain.xaml
/// </summary>
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();
}
}
}

View File

@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.MainWindow
public PrimitiveBase SelectedPrimitive { get; set; } public PrimitiveBase SelectedPrimitive { get; set; }
public IForceCombinationList SelectedForceCombinationList { get; set; } public IForceCombinationList SelectedForceCombinationList { get; set; }
private readonly ICalculatorsViewModelLogic calculatorsLogic; private readonly AnalysisVewModel calculatorsLogic;
public ICalculatorsViewModelLogic CalculatorsLogic { get => calculatorsLogic;} public AnalysisVewModel CalculatorsLogic { get => calculatorsLogic;}
public ActionsViewModel CombinationsLogic { get => combinationsLogic; } public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic; public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
@@ -202,7 +202,7 @@ namespace StructureHelper.Windows.MainWindow
Model = model; Model = model;
section = model.Section; section = model.Section;
combinationsLogic = new ActionsViewModel(repository); combinationsLogic = new ActionsViewModel(repository);
calculatorsLogic = new CalculatorsViewModelLogic(repository); calculatorsLogic = new AnalysisVewModel(repository);
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight }; primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
XX2 = CanvasWidth; XX2 = CanvasWidth;
XY1 = CanvasHeight / 2d; XY1 = CanvasHeight / 2d;

View File

@@ -115,17 +115,24 @@
<RowDefinition Height="22"/> <RowDefinition Height="22"/>
<RowDefinition Height="22"/> <RowDefinition Height="22"/>
<RowDefinition Height="22"/> <RowDefinition Height="22"/>
<RowDefinition Height="22"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="k_x"/> <TextBlock Grid.Row="0" Grid.Column="1" Text="User's" HorizontalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="k_y"/> <TextBlock Grid.Row="0" Grid.Column="2" Text="Auto" HorizontalAlignment="Center"/>
<TextBlock Grid.Row="2" Text="epsilon_z"/> <TextBlock Grid.Row="1" Text="k_x"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/> <TextBlock Grid.Row="2" Text="k_y"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/> <TextBlock Grid.Row="3" Text="epsilon_z"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/> <TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="2" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKx, Converter={StaticResource Curvature}, Mode=OneWay}"/>
<TextBox Grid.Row="2" Grid.Column="2" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKy, Converter={StaticResource Curvature}, Mode=OneWay}"/>
<TextBox Grid.Row="3" Grid.Column="2" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainEpsZ, Converter={StaticResource PlainDouble}, Mode=OneWay}"/>
</Grid> </Grid>
</Expander> </Expander>
</StackPanel> </StackPanel>

View File

@@ -1,11 +1,11 @@
using FieldVisualizer.Infrastructure.Commands; using LoaderCalculator.Data.Matrix;
using FieldVisualizer.ViewModels;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts; 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;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews; using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
using StructureHelper.Windows.Forces; using StructureHelper.Windows.Forces;
using StructureHelper.Windows.PrimitivePropertiesWindow; using StructureHelper.Windows.PrimitivePropertiesWindow;
@@ -14,6 +14,7 @@ using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings; using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Analyses; using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
@@ -21,6 +22,7 @@ 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.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -43,6 +45,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private RelayCommand showIsoFieldCommand; private RelayCommand showIsoFieldCommand;
private RelayCommand exportToCSVCommand; private RelayCommand exportToCSVCommand;
private RelayCommand interpolateCommand; private RelayCommand interpolateCommand;
private RelayCommand setPrestrainCommand;
public IForcesResults ForcesResults public IForcesResults ForcesResults
{ {
@@ -81,7 +84,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
)); ));
} }
} }
private void ExportToCSV() private void ExportToCSV()
{ {
SaveFileDialog saveFileDialog = new SaveFileDialog(); SaveFileDialog saveFileDialog = new SaveFileDialog();
@@ -109,6 +111,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
{ {
var logic = new ExportToCSVLogic(saveFileDialog.FileName); var logic = new ExportToCSVLogic(saveFileDialog.FileName);
logic.Export(forcesResults); logic.Export(forcesResults);
try
{
Process filopener = new Process();
filopener.StartInfo.FileName = saveFileDialog.FileName;
filopener.Start();
}
catch (Exception) { }
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -129,7 +138,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}, o => SelectedResult != null)); }, o => SelectedResult != null));
} }
} }
private void Interpolate() private void Interpolate()
{ {
IDesignForceTuple startDesignTuple, finishDesignTuple; 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) public ForcesResultsViewModel(IForceCalculator forceCalculator)
{ {
this.forceCalculator = forceCalculator; this.forceCalculator = forceCalculator;

View File

@@ -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;
}
}
}

View File

@@ -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<INdmCalculator>
{
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;
}
}
}

View File

@@ -90,6 +90,10 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
set => primitive.PrestrainEpsZ = value; set => primitive.PrestrainEpsZ = value;
} }
public double AutoPrestrainKx => primitive.AutoPrestrainKx;
public double AutoPrestrainKy => primitive.AutoPrestrainKy;
public double AutoPrestrainEpsZ => primitive.AutoPrestrainEpsZ;
public int MinElementDivision public int MinElementDivision
{ {
get => (primitive as IHasDivision).NdmMinDivision; get => (primitive as IHasDivision).NdmMinDivision;