Change value diagram calculator
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
|
||||
Binary file not shown.
@@ -56,17 +56,18 @@ namespace StructureHelper.Services.ResultViewers
|
||||
}
|
||||
private static List<ForceResultFunc> GetStrainResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
List<ForceResultFunc> resultFuncs = [];
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Section Strain", ResultFunction = stressLogic.GetSectionStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Prestrain", ResultFunction = stressLogic.GetPrestrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Limit Strain Ratio", ResultFunction = stressLogic.GetLimitStrainRatio });
|
||||
return resultFuncs;
|
||||
}
|
||||
private static List<ForceResultFunc> GetStressResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
List<ForceResultFunc> resultFuncs = [];
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
||||
@@ -74,7 +75,7 @@ namespace StructureHelper.Services.ResultViewers
|
||||
}
|
||||
private static List<ForceResultFunc> GetForcesResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
List<ForceResultFunc> resultFuncs = [];
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = unitForce.Multiplyer, UnitName = unitForce.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.States;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
public class GetMoqNdmLogic : IGetMoqNdmLogic
|
||||
{
|
||||
public INdm GetMockNdm(INdmPrimitive ndmPrimitive, IStateCalcTermPair stateCalcTermPair, IPoint2D point, double area = 0)
|
||||
{
|
||||
var limitState = stateCalcTermPair.LimitState;
|
||||
var calcTerm = stateCalcTermPair.CalcTerm;
|
||||
var material = ndmPrimitive.NdmElement.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||
var userPrestrain = ndmPrimitive.NdmElement.UsersPrestrain;
|
||||
var autoPrestrain = ndmPrimitive.NdmElement.AutoPrestrain;
|
||||
var ndm = new Ndm()
|
||||
{
|
||||
Area = area,
|
||||
CenterX = point.X,
|
||||
CenterY = point.Y,
|
||||
Material = material,
|
||||
};
|
||||
var prestrain = (userPrestrain.Mx + autoPrestrain.Mx) * point.Y
|
||||
+ (userPrestrain.My + autoPrestrain.My) * point.X
|
||||
+ userPrestrain.Nz + autoPrestrain.Nz;
|
||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, prestrain);
|
||||
return ndm;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.States;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
public interface IGetMoqNdmLogic
|
||||
{
|
||||
INdm GetMockNdm(INdmPrimitive ndmPrimitive, IStateCalcTermPair stateCalcTermPair, IPoint2D point, double area = 0);
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,12 @@ using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Services.Exports;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Services.Exports;
|
||||
using StructureHelperCommon.Services.Exports.Factories;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.Media3D;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
|
||||
@@ -6,6 +6,7 @@ using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculato
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ValueDiagrams;
|
||||
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.MainWindow.CrossSections;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
@@ -269,6 +270,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
var wnd = new CrackResultView(crackCalculator.Result as CrackResult);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
else if (SelectedItem is IValueDiagramCalculator valueDiagramCalculator)
|
||||
{
|
||||
IValueDiagramCalculatorResult? diagramCalcualtorResult = valueDiagramCalculator.Result as IValueDiagramCalculatorResult;
|
||||
ValueDiagramLogic valueDiagramLogic = new(diagramCalcualtorResult);
|
||||
valueDiagramLogic.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Export to *.dxf file"
|
||||
IconContent="{StaticResource ExportToDxf}"
|
||||
DescriptionText="Exports poligon to new *.dxf file"/>
|
||||
DescriptionText="Exports primitives to new *.dxf file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource ExportToDxf}"/>
|
||||
@@ -166,7 +166,7 @@
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Import from *.dxf file"
|
||||
IconContent="{StaticResource ImportFromDxf}"
|
||||
DescriptionText="Imports poligon from *.dxf file"/>
|
||||
DescriptionText="Imports primitives from *.dxf file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource ImportFromDxf}"/>
|
||||
@@ -307,6 +307,44 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates">
|
||||
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add Circle RC Column" Command="{Binding AddRCCircleCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/CircleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC Beam" Command="{Binding AddBeamCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Beam32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC slab" Command="{Binding AddSlabCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Slab32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Delete" DataContext="{Binding PrimitiveLogic}">
|
||||
<MenuItem Header="All" Command="{Binding DeleteAllCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Select" Command="{Binding DeleteSelectedCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
<ListBox DataContext="{Binding PrimitiveLogic}"
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
private RelayCommand setAsHostCommand;
|
||||
private RelayCommand setMaterialToPrimitivesCommand;
|
||||
private RelayCommand setHostToPrimitivesCommand;
|
||||
private RelayCommand deletAllCommand;
|
||||
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
@@ -68,6 +69,44 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
.NdmElement
|
||||
.HeadMaterial != null);
|
||||
|
||||
public ICommand DeleteAllCommand => deletAllCommand ??= new RelayCommand(DeleteAll, o => Items.Count > 0);
|
||||
|
||||
private void DeleteAll(object obj)
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete all primitives?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
repository.Primitives.Clear();
|
||||
Items.Clear();
|
||||
Refresh();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
}
|
||||
public ICommand DeleteSelectedCommand => deleteSelectedCommand ??= new RelayCommand(DeleteSelected, o => Items.Count > 0);
|
||||
|
||||
private void DeleteSelected(object commandParameter)
|
||||
{
|
||||
var vm = new SelectPrimitivesViewModel(repository.Primitives);
|
||||
var wnd = new SelectPrimitivesView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
var selectedNdmPrimitives = vm.Items.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item.GetNdmPrimitive());
|
||||
var deletePrimitivesList = Items
|
||||
.Where(x => selectedNdmPrimitives.Contains(x.NdmPrimitive))
|
||||
.ToList();
|
||||
foreach (var item in deletePrimitivesList)
|
||||
{
|
||||
repository.Primitives.Remove(item.NdmPrimitive);
|
||||
Items.Remove(item);
|
||||
}
|
||||
Refresh();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMaterialToPrimitives(object obj)
|
||||
{
|
||||
if (SelectedItem is null) { return; }
|
||||
@@ -478,5 +517,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
||||
}
|
||||
|
||||
private RelayCommand deleteSelectedCommand;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow.CrossSections
|
||||
{
|
||||
internal class ValueDiagramLogic
|
||||
{
|
||||
private IStressLogic stressLogic = new StressLogic();
|
||||
private IValueDiagramCalculatorResult valueDiagramResult;
|
||||
private List<ForceResultFunc> resultFuncs = [];
|
||||
private List<string> labels;
|
||||
|
||||
public ValueDiagramLogic(IValueDiagramCalculatorResult valueDiagramResult)
|
||||
{
|
||||
this.valueDiagramResult = valueDiagramResult;
|
||||
}
|
||||
|
||||
internal void Show()
|
||||
{
|
||||
resultFuncs.AddRange(ForceResultFuncFactory.GetResultFuncs(FuncsTypes.Strain));
|
||||
resultFuncs.AddRange(ForceResultFuncFactory.GetResultFuncs(FuncsTypes.Stress));
|
||||
GetLabels();
|
||||
if (valueDiagramResult.IsValid == false ||
|
||||
valueDiagramResult.ForceTupleResults
|
||||
.Where(x => x.IsValid)
|
||||
.Count() == 0)
|
||||
{
|
||||
//
|
||||
}
|
||||
List<Series> seriesList = [];
|
||||
foreach (var forceTupleResult in valueDiagramResult.ForceTupleResults)
|
||||
{
|
||||
if (forceTupleResult.IsValid == false) { continue; }
|
||||
foreach (var entityResult in valueDiagramResult.EntityResults)
|
||||
{
|
||||
var primitives = valueDiagramResult.InputData.Primitives
|
||||
.Where(x => x is IHasDivisionSize);
|
||||
Series series = GetSeries(forceTupleResult, valueDiagramResult.InputData.Primitives, entityResult.PointList);
|
||||
seriesList.Add(series);
|
||||
}
|
||||
}
|
||||
var vm = new GraphViewModel(seriesList);
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
private Series GetSeries(IForceTupleCalculatorResult tupleResult, List<INdmPrimitive> ndmPrimitives, List<IPoint2D> points)
|
||||
{
|
||||
List<(INdmPrimitive ndmPrimitive, IPoint2D point)> pointPrimitives = GetPrimitivePoints(ndmPrimitives, points);
|
||||
ArrayParameter<double> arrayParameter = new(pointPrimitives.Count + 3, labels);
|
||||
var data = arrayParameter.Data;
|
||||
IPoint2D startPoint = pointPrimitives[0].point;
|
||||
IPoint2D endPoint = pointPrimitives[^1].point;
|
||||
for (int i = 0; i < pointPrimitives.Count; i++)
|
||||
{
|
||||
IPoint2D currentPoint = pointPrimitives[i].point;
|
||||
double distance = GetDistance(startPoint, currentPoint);
|
||||
data[i, 0] = distance;
|
||||
data[i, 1] = currentPoint.X;
|
||||
data[i, 2] = currentPoint.Y;
|
||||
for (int j = 0; j < resultFuncs.Count; j++)
|
||||
{
|
||||
data[i, j + 3] = GetValueByPoint(tupleResult.LoaderResults.StrainMatrix, pointPrimitives[i].ndmPrimitive, pointPrimitives[i].point, resultFuncs[j]);
|
||||
}
|
||||
|
||||
}
|
||||
data[pointPrimitives.Count, 0] = GetDistance(startPoint, endPoint);
|
||||
data[pointPrimitives.Count, 1] = endPoint.X;
|
||||
data[pointPrimitives.Count, 2] = endPoint.Y;
|
||||
|
||||
data[pointPrimitives.Count + 1, 0] = 0.0;
|
||||
data[pointPrimitives.Count + 1, 1] = startPoint.X;
|
||||
data[pointPrimitives.Count + 1, 2] = startPoint.Y;
|
||||
|
||||
data[pointPrimitives.Count, 0] = 0.0;
|
||||
data[pointPrimitives.Count + 2, 1] = startPoint.X;
|
||||
data[pointPrimitives.Count + 2, 2] = startPoint.Y;
|
||||
for (int j = 0; j < resultFuncs.Count; j++)
|
||||
{
|
||||
data[pointPrimitives.Count, j+3] = 0.0;
|
||||
data[pointPrimitives.Count + 1, j+3] = 0.0;
|
||||
data[pointPrimitives.Count + 2, j + 3] = GetValueByPoint(tupleResult.LoaderResults.StrainMatrix, pointPrimitives[0].ndmPrimitive, pointPrimitives[0].point, resultFuncs[j]);
|
||||
}
|
||||
|
||||
StructureHelperCommon.Models.Forces.IForceTuple inputForceTuple = tupleResult.InputData.ForceTuple;
|
||||
Series series = new Series(arrayParameter)
|
||||
{
|
||||
Name = $"Mx = {inputForceTuple.Mx}, My = {inputForceTuple.My}, Nz = {inputForceTuple.Nz}",
|
||||
};
|
||||
return series;
|
||||
}
|
||||
|
||||
private static double GetDistance(IPoint2D startPoint, IPoint2D currentPoint)
|
||||
{
|
||||
double dx = currentPoint.X - startPoint.X;
|
||||
double dy = currentPoint.Y - startPoint.Y;
|
||||
double distance = Math.Sqrt(dx * dx + dy * dy);
|
||||
return distance;
|
||||
}
|
||||
|
||||
private List<(INdmPrimitive ndmPrimitive, IPoint2D point)> GetPrimitivePoints(List<INdmPrimitive> primitives, List<IPoint2D> points)
|
||||
{
|
||||
List<(INdmPrimitive ndmPrimitive, IPoint2D point)> values = [];
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
var currentPoint = points[i];
|
||||
|
||||
var areaPrimitives = GetPrimitivesInPoint(primitives, currentPoint);
|
||||
|
||||
if (areaPrimitives.Count() == 1)
|
||||
{
|
||||
(INdmPrimitive ndmPrimitive, IPoint2D point) newValue = (areaPrimitives[0], points[i]);
|
||||
values.Add(newValue);
|
||||
}
|
||||
else if (areaPrimitives.Count() > 1)
|
||||
{
|
||||
values.AddRange(GetPrimitiveByFewPoints(areaPrimitives, points, i));
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private static List<INdmPrimitive> GetPrimitivesInPoint(List<INdmPrimitive> primitives, IPoint2D point)
|
||||
{
|
||||
return primitives
|
||||
.Where(x => x is IHasDivisionSize)
|
||||
.Where(x => (x as IHasDivisionSize).IsPointInside(point) == true)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private List<(INdmPrimitive ndmPrimitive, IPoint2D point)> GetPrimitiveByFewPoints(List<INdmPrimitive> areaPrimitives, List<IPoint2D> points, int i)
|
||||
{
|
||||
List<(INdmPrimitive ndmPrimitive, IPoint2D point)> values = [];
|
||||
var primitives = areaPrimitives
|
||||
.OrderBy(x=> x.VisualProperty.ZIndex)
|
||||
.ToList();
|
||||
if (primitives[0] is IHasDivisionSize firstPrimitiveHasSize)
|
||||
{
|
||||
if (firstPrimitiveHasSize.DivisionSize.ClearUnderlying == true)
|
||||
{
|
||||
if (primitives[0].NdmElement.Triangulate == true)
|
||||
{
|
||||
(INdmPrimitive ndmPrimitive, IPoint2D point) newValue = (primitives[0], points[i]);
|
||||
values.Add(newValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (primitives.Count > 2)
|
||||
{
|
||||
throw new StructureHelperException($"Too many primitives in point X = {points[i].X}, Y = {points[i].Y}");
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
var primitive = GetPrimitiveInAjacentPoint(primitives, points, i, 1);
|
||||
(INdmPrimitive ndmPrimitive, IPoint2D point) newValue = (primitive, points[i]);
|
||||
values.Add(newValue);
|
||||
}
|
||||
else if (i == points.Count - 1)
|
||||
{
|
||||
var primitive = GetPrimitiveInAjacentPoint(primitives, points, i, -1);
|
||||
(INdmPrimitive ndmPrimitive, IPoint2D point) newValue = (primitive, points[i]);
|
||||
values.Add(newValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var primitive in primitives)
|
||||
{
|
||||
(INdmPrimitive ndmPrimitive, IPoint2D point) newValue = (primitive, points[i]);
|
||||
values.Add(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private INdmPrimitive GetPrimitiveInAjacentPoint(List<INdmPrimitive> primitives, List<IPoint2D> points, int i, int sign)
|
||||
{
|
||||
var nextPointPrimitives = GetPrimitivesInPoint(primitives, points[i + 1 * sign]);
|
||||
try
|
||||
{
|
||||
var primitive = nextPointPrimitives.Single();
|
||||
return primitive;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StructureHelperException($"Error of obtaining of primitive X = {points[i].X}, Y = {points[i].Y}");
|
||||
}
|
||||
}
|
||||
|
||||
private double GetValueByPoint(IStrainMatrix strainMatrix, INdmPrimitive primitive, IPoint2D point, ForceResultFunc resultFunc)
|
||||
{
|
||||
var logic = new GetMoqNdmLogic();
|
||||
var moqNdm = logic.GetMockNdm(primitive, valueDiagramResult.InputData.StateTermPair, point);
|
||||
return resultFunc.ResultFunction(strainMatrix, moqNdm) * resultFunc.UnitFactor;
|
||||
}
|
||||
|
||||
private void GetLabels()
|
||||
{
|
||||
labels = [];
|
||||
labels.Add("Distance");
|
||||
labels.Add("Global X");
|
||||
labels.Add("Global Y");
|
||||
foreach (var resultFunc in resultFuncs)
|
||||
{
|
||||
labels.Add($"{resultFunc.Name}, {resultFunc.UnitName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,9 +123,14 @@
|
||||
<ColumnDefinition Width="auto" MinWidth="100" MaxWidth="250"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="44"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Center"/>
|
||||
<Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
@@ -139,7 +144,7 @@
|
||||
<TextBlock Grid.Row="1" Text="y = "/>
|
||||
<TextBox Grid.Column="1" Margin="2" Grid.Row="1" Text="{Binding Center.Y, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}" IsEnabled="False"/>
|
||||
</Grid>
|
||||
<DataGrid ItemsSource="{Binding Vertices}" SelectedItem="{Binding SelectedVertex}" AutoGenerateColumns="False"
|
||||
<DataGrid Grid.Row="2" ItemsSource="{Binding Vertices}" SelectedItem="{Binding SelectedVertex}" AutoGenerateColumns="False"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="5" Foreground="DarkGray"/>
|
||||
@@ -147,7 +152,7 @@
|
||||
<DataGridTextColumn Width="100" Header="Y" Binding="{Binding Point.Y, Converter={StaticResource LengthConverter}}" CanUserSort="False"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ucwp:WorkPlaneRoot x:Name="WorkPlaneRootPanel" Grid.Column="1" DataContext="{Binding WorkPlaneRoot}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
@@ -103,6 +103,22 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Delete" DataContext="{Binding ParentViewModel.PrimitiveLogic}">
|
||||
<MenuItem Header="All" Command="{Binding DeleteAllCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Select" Command="{Binding DeleteSelectedCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Canvas.ContextMenu>
|
||||
<i:Interaction.Behaviors>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
return calculators;
|
||||
}
|
||||
|
||||
private ValueDiagramCalculator GetDiagramCalculator()
|
||||
private static ValueDiagramCalculator GetDiagramCalculator()
|
||||
{
|
||||
ValueDiagramCalculator diagramCalculator = new(Guid.NewGuid()) { Name = "New value diagram calcualtor"};
|
||||
ValueDiagramEntity diagramEntity = new(Guid.NewGuid()) { Name = "New diagram" };
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
public interface IValueDiagramCalculatorResult : IResult
|
||||
{
|
||||
IValueDiagramCalculatorInputData? InputData { get; set; }
|
||||
List<IPoint2D> Points { get; set; }
|
||||
List<IExtendedForceTupleCalculatorResult> ForceTupleResults { get; set; }
|
||||
List<IValueDiagramEntityResult> EntityResults { get; set; }
|
||||
List<IForceTupleCalculatorResult> ForceTupleResults { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public interface IValueDiagramEntityResult : IResult
|
||||
{
|
||||
IValueDiagramEntity ValueDiagramEntity { get; }
|
||||
List<IPoint2D> PointList { get; set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public interface IValueDiagramEntityLogic : ILogic
|
||||
{
|
||||
IValueDiagramEntity ValueDiagramEntity { get; set; }
|
||||
IValueDiagramEntityResult Result { get; }
|
||||
void Run();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Sections.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramCalculatorLogic : IValueDiagramCalculatorLogic
|
||||
{
|
||||
private readonly IValueDiagramEntityLogic entityLogic = new ValueDiagramEntityLogic();
|
||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||
|
||||
private List<INdm> ndms;
|
||||
private IValueDiagramCalculatorResult result;
|
||||
public IValueDiagramCalculatorInputData InputData { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
public IValueDiagramCalculatorResult GetResult()
|
||||
{
|
||||
PrepareResult();
|
||||
GetPoints();
|
||||
GetEntitiesResults();
|
||||
CalculateTupleResults();
|
||||
return result;
|
||||
}
|
||||
@@ -37,30 +37,67 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
CalcTerm = InputData.StateTermPair.CalcTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
ndms = triangulateLogic.GetNdms();
|
||||
foreach (var forceAction in InputData.ForceActions)
|
||||
{
|
||||
var combination = forceAction.GetCombinations();
|
||||
List<IForceTuple> forceTuples = [];
|
||||
foreach (var action in combination)
|
||||
{
|
||||
var actionCombination = action
|
||||
var forceTuple = action
|
||||
.DesignForces
|
||||
.Where(x => x.LimitState == InputData.StateTermPair.LimitState && x.CalcTerm == InputData.StateTermPair.CalcTerm);
|
||||
}
|
||||
ForceTupleInputData forceTupleInputData = new()
|
||||
{
|
||||
NdmCollection = ndms,
|
||||
Accuracy = new Accuracy(),
|
||||
CheckStrainLimit = true,
|
||||
.Single(x => x.LimitState == InputData.StateTermPair.LimitState && x.CalcTerm == InputData.StateTermPair.CalcTerm)
|
||||
.ForceTuple;
|
||||
|
||||
|
||||
IPoint2D point2D;
|
||||
IProcessorLogic<IForceTuple> forcelogic = new ForceTupleCopier(forceTuple);
|
||||
if (action.SetInGravityCenter == true)
|
||||
{
|
||||
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D() { X = Cx, Y = Cy };
|
||||
forcelogic = new ForceTupleMoveToPointDecorator(forcelogic) { Point2D = point2D };
|
||||
}
|
||||
var newTuple = forcelogic.GetValue();
|
||||
GetForceTupleResult(forceAction, newTuple);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPoints()
|
||||
private void GetForceTupleResult(IForceAction forceAction, IForceTuple forceTuple)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
ForceTupleInputData forceTupleInputData = new()
|
||||
{
|
||||
ForceTuple = forceTuple,
|
||||
NdmCollection = ndms,
|
||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001, MaxIterationCount = 1000},
|
||||
CheckStrainLimit = InputData.CheckStrainLimit,
|
||||
};
|
||||
ForceTupleCalculator calculator = new ForceTupleCalculator()
|
||||
{
|
||||
InputData = forceTupleInputData,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
|
||||
};
|
||||
calculator.Run();
|
||||
var tupleResult = calculator.Result as IForceTupleCalculatorResult;
|
||||
if (tupleResult.IsValid == false)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Result is not valid for action {forceAction.Name}: {tupleResult.Description}", TraceLogStatuses.Error);
|
||||
}
|
||||
result.ForceTupleResults.Add(tupleResult);
|
||||
}
|
||||
|
||||
private void GetEntitiesResults()
|
||||
{
|
||||
var entities = InputData.Digrams
|
||||
.Where(x => x.IsTaken == true);
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
entityLogic.ValueDiagramEntity = entity;
|
||||
entityLogic.Run();
|
||||
result.EntityResults.Add(entityLogic.Result);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareResult()
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramEntityLogic : IValueDiagramEntityLogic
|
||||
{
|
||||
public IValueDiagramEntity ValueDiagramEntity { get; set; }
|
||||
|
||||
private IValueDiagramEntityResult result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public IValueDiagramEntityResult Result => result;
|
||||
|
||||
public void Run()
|
||||
{
|
||||
result = new ValueDiagramEntityResult(ValueDiagramEntity);
|
||||
result.PointList = GetPoints();
|
||||
}
|
||||
|
||||
private List<IPoint2D> GetPoints()
|
||||
{
|
||||
TraceLogger?.AddMessage($"Getting point for diagram {ValueDiagramEntity.Name} has been started");
|
||||
var startPoint = ValueDiagramEntity.ValueDigram.Point2DRange.StartPoint;
|
||||
var endPoint = ValueDiagramEntity.ValueDigram.Point2DRange.EndPoint;
|
||||
double dx = (endPoint.X - startPoint.X) / ValueDiagramEntity.ValueDigram.StepNumber;
|
||||
double dy = (endPoint.Y - startPoint.Y) / ValueDiagramEntity.ValueDigram.StepNumber;
|
||||
List<IPoint2D> point2Ds = [];
|
||||
for (int i = 0; i < ValueDiagramEntity.ValueDigram.StepNumber + 1; i++)
|
||||
{
|
||||
double x = startPoint.X + dx * i;
|
||||
double y = startPoint.Y + dy * i;
|
||||
point2Ds.Add(new Point2D(x, y));
|
||||
}
|
||||
TraceLogger?.AddMessage($"Getting point for diagram {ValueDiagramEntity.Name} has been finished, total {point2Ds.Count} points obtained");
|
||||
return point2Ds;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramCalculator : IValueDiagramCalculator
|
||||
{
|
||||
private readonly IValueDiagramCalculatorLogic valueDiagramCalculatorLogic = new ValueDiagramCalculatorLogic();
|
||||
private readonly ICheckInputDataLogic<IValueDiagramCalculatorInputData> checkInputDataLogic;
|
||||
private IValueDiagramCalculatorResult result;
|
||||
|
||||
public Guid Id { get; }
|
||||
@@ -38,7 +35,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
valueDiagramCalculatorLogic.InputData = InputData;
|
||||
result = valueDiagramCalculatorLogic.GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public IValueDiagramCalculatorInputData? InputData { get; set; }
|
||||
|
||||
public List<IPoint2D> Points { get; set; } = [];
|
||||
|
||||
public List<IExtendedForceTupleCalculatorResult> ForceTupleResults { get; set; } = [];
|
||||
public List<IForceTupleCalculatorResult> ForceTupleResults { get; set; } = [];
|
||||
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
public List<IValueDiagramEntityResult> EntityResults { get; set; } = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramEntityResult : IValueDiagramEntityResult
|
||||
{
|
||||
public IValueDiagramEntity ValueDiagramEntity { get; }
|
||||
|
||||
public ValueDiagramEntityResult(IValueDiagramEntity valueDiagramEntity)
|
||||
{
|
||||
ValueDiagramEntity = valueDiagramEntity;
|
||||
}
|
||||
|
||||
public List<IPoint2D> PointList { get; set; } = [];
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
@@ -57,8 +50,16 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (var primitive in Entity.Primitives)
|
||||
{
|
||||
if (primitive.NdmElement.HeadMaterial is null)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Primitive {primitive.Name} does not have material\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
if (primitive is IRebarNdmPrimitive rebar)
|
||||
{
|
||||
CheckRebar(rebar);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
|
||||
Reference in New Issue
Block a user