Material diagram Window was changed
This commit is contained in:
@@ -12,4 +12,5 @@
|
||||
<convertersUnits:Moment x:Key="MomentConverter"/>
|
||||
<convertersUnits:Stress x:Key="StressConverter"/>
|
||||
<convertersUnits:Curvature x:Key="Curvature"/>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
</ResourceDictionary>
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<DataTemplate x:Key="SourceToTarget">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -19,4 +19,27 @@
|
||||
SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{Binding ItemDataDemplate}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="SelectItems">
|
||||
<StackPanel>
|
||||
<StackPanel Height="25" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
|
||||
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
||||
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
16
StructureHelper/Services/Exports/ExportToFileInputData.cs
Normal file
16
StructureHelper/Services/Exports/ExportToFileInputData.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.Exports
|
||||
{
|
||||
internal class ExportToFileInputData : IExportToFileInputData
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public string Filter { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
}
|
||||
97
StructureHelper/Services/Exports/ExportToFileService.cs
Normal file
97
StructureHelper/Services/Exports/ExportToFileService.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Services.Exports
|
||||
{
|
||||
internal class ExportToFileService : IExportService
|
||||
{
|
||||
IExportToFileInputData inputData;
|
||||
IExportResultLogic logic;
|
||||
|
||||
public ExportToFileService(IExportToFileInputData inputData, IExportResultLogic logic)
|
||||
{
|
||||
this.inputData = inputData;
|
||||
this.logic = logic;
|
||||
}
|
||||
public void Export()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = inputData.Filter;
|
||||
saveFileDialog.Title = inputData.Title;
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var filename = saveFileDialog.FileName;
|
||||
// If the file name is not an empty string open it for saving.
|
||||
if (filename != "")
|
||||
{
|
||||
SaveFile(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SaveFile(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
DeleteFile(filename);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ExportFile(filename);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = ErrorStrings.FileCantBeSaved + ex + filename,
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
private void DeleteFile(string filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = ErrorStrings.FileCantBeDeleted + ex + filename,
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ExportFile(string fileName)
|
||||
{
|
||||
logic.FileName = fileName;
|
||||
logic.Export();
|
||||
try
|
||||
{
|
||||
OpenFile(fileName);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
private void OpenFile(string fileName)
|
||||
{
|
||||
var filopener = new Process();
|
||||
var startInfo = new ProcessStartInfo(fileName) { UseShellExecute = true };
|
||||
filopener.StartInfo = startInfo;
|
||||
filopener.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
StructureHelper/Services/Exports/IExportService.cs
Normal file
14
StructureHelper/Services/Exports/IExportService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.Exports
|
||||
{
|
||||
internal interface IExportService
|
||||
{
|
||||
void Export();
|
||||
}
|
||||
}
|
||||
16
StructureHelper/Services/Exports/IExportToFileInputData.cs
Normal file
16
StructureHelper/Services/Exports/IExportToFileInputData.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.Exports
|
||||
{
|
||||
internal interface IExportToFileInputData
|
||||
{
|
||||
string FileName { get; set; }
|
||||
string Filter { get; set; }
|
||||
string Title { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculator\GeometryCalculatorResultView.xaml.cs">
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\Errors\ErrorMessage.xaml.cs">
|
||||
@@ -38,7 +38,7 @@
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculator\GeometryCalculatorResultView.xaml">
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\Errors\ErrorMessage.xaml">
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculator.GeometryCalculatorResultView"
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews.GeometryCalculatorResultView"
|
||||
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.GeometryCalculator"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculator"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculatorVMs"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:GeometryCalculatorResultViewModel}"
|
||||
Title="Geometry Properies" Height="450" Width="850" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="90"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding TextParameters}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
@@ -28,5 +32,8 @@
|
||||
<DataGridTextColumn Header="Description" Width="400" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,5 +1,6 @@
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculator;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculatorVMs;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,7 +15,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculator
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для GeometryCalculatorResultView.xaml
|
||||
@@ -22,9 +23,9 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCa
|
||||
public partial class GeometryCalculatorResultView : Window
|
||||
{
|
||||
GeometryCalculatorResultViewModel viewModel;
|
||||
public GeometryCalculatorResultView(List<ITextParameter> textParameters)
|
||||
public GeometryCalculatorResultView(IGeometryResult geometryResult)
|
||||
{
|
||||
viewModel = new GeometryCalculatorResultViewModel(textParameters);
|
||||
viewModel = new GeometryCalculatorResultViewModel(geometryResult);
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
@@ -7,40 +7,52 @@
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||
d:DataContext="{d:DesignInstance vm:InterpolateTuplesViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Interpolate Combinations" Height="200" Width="350" MinHeight="180" MinWidth="250" WindowStartupLocation="CenterScreen">
|
||||
Title="Interpolate Combinations" Height="200" Width="440" MinHeight="180" MinWidth="440" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="90"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartDesignForce.ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartDesignForce.ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartDesignForce.ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Finish Combination"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding FinishDesignForce.ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding FinishDesignForce.ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding FinishDesignForce.ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Step count"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}"/>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Finish Combination"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Step count"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}"/>
|
||||
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Invert comb's" Command="{Binding InvertForcesCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
|
||||
@@ -10,12 +10,53 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Material Diagram" Height="450" Width="800" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding MaterialName}"/>
|
||||
<lvc:CartesianChart Grid.Row="1" Series="{Binding SeriesCollection}" LegendLocation="Right" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<Expander Header="Materials" IsExpanded="True">
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding MaterialsModel}"/>
|
||||
</Expander>
|
||||
<Expander Header="Limit States">
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding LimitStatesModel}"/>
|
||||
</Expander>
|
||||
<Expander Header="Calculation terms">
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding CalcTermsModel}"/>
|
||||
</Expander>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Minimum strain"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding MinValue, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Maximum strain"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding MaxValue, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Step count"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding StepCount, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Positive in tension"/>
|
||||
<CheckBox Grid.Column="1" Grid.Row="3" Margin="4" IsChecked="{Binding PositiveInTension}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" FlowDirection="RightToLeft">
|
||||
<Button Content="Redraw Lines" Command="{Binding RedrawLinesCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<lvc:CartesianChart Grid.Column="1" Series="{Binding SeriesCollection}" LegendLocation="Bottom" >
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Title="Stress"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
InitializeComponent();
|
||||
this.DataContext = this.vm;
|
||||
}
|
||||
public MaterialDiagramView(IHeadMaterial material) : this(new MaterialDiagramViewModel(material))
|
||||
public MaterialDiagramView(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material) : this(new MaterialDiagramViewModel(headMaterials, material))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -10,29 +10,10 @@
|
||||
Title="Select Primitives" Height="250" Width="250" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="Select All" Command="{Binding Items.SelectAllCommand}"/>
|
||||
<Button Content="Unselect All" Command="{Binding Items.UnSelectAllCommand}"/>
|
||||
<Button Content="Invert Selection" Command="{Binding Items.InvertSelectionCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Items.CollectionItems}" SelectedItem="Items.SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Items}"/>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Exports;
|
||||
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.CalculationWindows.CalculatorsViews.GeometryCalculator;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
@@ -29,8 +29,6 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -87,56 +85,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
private void ExportToCSV()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "csv |*.csv";
|
||||
saveFileDialog.Title = "Save in csv File";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var filename = saveFileDialog.FileName;
|
||||
// If the file name is not an empty string open it for saving.
|
||||
if (filename != "")
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = ErrorStrings.FileCantBeDeleted + ex + filename,
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var logic = new ExportToCSVLogic(saveFileDialog.FileName);
|
||||
logic.Export(forcesResults);
|
||||
try
|
||||
{
|
||||
var filopener = new Process();
|
||||
var startInfo = new ProcessStartInfo(saveFileDialog.FileName) { UseShellExecute = true};
|
||||
filopener.StartInfo = startInfo;
|
||||
filopener.Start();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = ErrorStrings.FileCantBeSaved + ex + filename,
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
var inputData = new ExportToFileInputData();
|
||||
inputData.FileName = "New File";
|
||||
inputData.Filter = "csv |*.csv";
|
||||
inputData.Title = "Save in csv File";
|
||||
var logic = new ExportForceResultToCSVLogic(forcesResults);
|
||||
var exportService = new ExportToFileService(inputData, logic);
|
||||
exportService.Export();
|
||||
}
|
||||
|
||||
public RelayCommand InterpolateCommand
|
||||
@@ -248,8 +203,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var textParametrsLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
var textParameters = textParametrsLogic.GetTextParameters();
|
||||
var wnd = new GeometryCalculatorResultView(textParameters);
|
||||
var calculator = new GeometryCalculator(textParametrsLogic);
|
||||
calculator.Run();
|
||||
var result = calculator.Result as IGeometryResult;
|
||||
var wnd = new GeometryCalculatorResultView(result);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculator
|
||||
{
|
||||
internal class GeometryCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
private List<ITextParameter> textParameters;
|
||||
|
||||
public List<ITextParameter> TextParameters
|
||||
{ get => textParameters;
|
||||
|
||||
}
|
||||
public GeometryCalculatorResultViewModel(List<ITextParameter> textParameters)
|
||||
{
|
||||
this.textParameters = textParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Services.Exports;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculatorVMs
|
||||
{
|
||||
internal class GeometryCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
IGeometryResult result;
|
||||
private ICommand exportToCSVCommand;
|
||||
|
||||
public List<ITextParameter> TextParameters
|
||||
{
|
||||
get => result.TextParameters;
|
||||
}
|
||||
public ICommand ExportToCSVCommand
|
||||
{
|
||||
get => exportToCSVCommand ??= new RelayCommand(o => ExportToCSV());
|
||||
}
|
||||
public GeometryCalculatorResultViewModel(IGeometryResult geometryResult)
|
||||
{
|
||||
this.result = geometryResult;
|
||||
}
|
||||
private void ExportToCSV()
|
||||
{
|
||||
var inputData = new ExportToFileInputData();
|
||||
inputData.FileName = "New File";
|
||||
inputData.Filter = "csv |*.csv";
|
||||
inputData.Title = "Save in csv File";
|
||||
var logic = new ExportGeometryResultToCSVLogic(result);
|
||||
var exportService = new ExportToFileService(inputData, logic);
|
||||
exportService.Export();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,90 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
public class InterpolateTuplesViewModel : OkCancelViewModelBase
|
||||
{
|
||||
public IDesignForceTuple StartDesignForce { get; }
|
||||
public IDesignForceTuple FinishDesignForce { get; }
|
||||
private RelayCommand invertForcesCommand;
|
||||
|
||||
public IDesignForceTuple StartDesignForce { get; private set; }
|
||||
public IDesignForceTuple FinishDesignForce { get; private set; }
|
||||
public double StartMx
|
||||
{
|
||||
get => StartDesignForce.ForceTuple.Mx;
|
||||
set
|
||||
{
|
||||
StartDesignForce.ForceTuple.Mx = value;
|
||||
OnPropertyChanged(nameof(StartMx));
|
||||
}
|
||||
}
|
||||
public double StartMy
|
||||
{
|
||||
get => StartDesignForce.ForceTuple.My;
|
||||
set
|
||||
{
|
||||
StartDesignForce.ForceTuple.My = value;
|
||||
OnPropertyChanged(nameof(StartMy));
|
||||
}
|
||||
}
|
||||
public double StartNz
|
||||
{
|
||||
get => StartDesignForce.ForceTuple.Nz;
|
||||
set
|
||||
{
|
||||
StartDesignForce.ForceTuple.Nz = value;
|
||||
OnPropertyChanged(nameof(StartNz));
|
||||
}
|
||||
}
|
||||
public double FinishMx
|
||||
{
|
||||
get => FinishDesignForce.ForceTuple.Mx;
|
||||
set
|
||||
{
|
||||
FinishDesignForce.ForceTuple.Mx = value;
|
||||
OnPropertyChanged(nameof(FinishMx));
|
||||
}
|
||||
}
|
||||
public double FinishMy
|
||||
{
|
||||
get => FinishDesignForce.ForceTuple.My;
|
||||
set
|
||||
{
|
||||
FinishDesignForce.ForceTuple.My = value;
|
||||
OnPropertyChanged(nameof(FinishMy));
|
||||
}
|
||||
}
|
||||
public double FinishNz
|
||||
{
|
||||
get => FinishDesignForce.ForceTuple.Nz;
|
||||
set
|
||||
{
|
||||
FinishDesignForce.ForceTuple.Nz = value;
|
||||
OnPropertyChanged(nameof(FinishNz));
|
||||
}
|
||||
}
|
||||
public int StepCount { get; set; }
|
||||
|
||||
public ICommand InvertForcesCommand
|
||||
{
|
||||
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
|
||||
}
|
||||
|
||||
private void InvertForces()
|
||||
{
|
||||
var tmpForce = StartDesignForce.Clone() as IDesignForceTuple;
|
||||
StartDesignForce = FinishDesignForce;
|
||||
FinishDesignForce = tmpForce;
|
||||
OnPropertyChanged(nameof(StartMx));
|
||||
OnPropertyChanged(nameof(StartMy));
|
||||
OnPropertyChanged(nameof(StartNz));
|
||||
OnPropertyChanged(nameof(FinishMx));
|
||||
OnPropertyChanged(nameof(FinishMy));
|
||||
OnPropertyChanged(nameof(FinishNz));
|
||||
}
|
||||
|
||||
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
|
||||
{
|
||||
if (startDesignForce !=null)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
return showMaterialDiagram ??= new RelayCommand(o =>
|
||||
{
|
||||
var material = selectedMaterial;
|
||||
var wnd = new MaterialDiagramView(material);
|
||||
var wnd = new MaterialDiagramView(headMaterials, material);
|
||||
wnd.ShowDialog();
|
||||
|
||||
}, o => SelectedMaterial != null
|
||||
|
||||
@@ -1,76 +1,166 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Wpf;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
public class MaterialDiagramViewModel
|
||||
public class MaterialDiagramViewModel : ViewModelBase
|
||||
{
|
||||
private IHeadMaterial material;
|
||||
public string MaterialName => material.Name;
|
||||
private ICommand redrawLinesCommand;
|
||||
double minValue;
|
||||
double maxValue;
|
||||
int stepCount;
|
||||
bool positiveInTension;
|
||||
|
||||
public string MaterialName => material.Name;
|
||||
public double MinValue
|
||||
{
|
||||
get => minValue;
|
||||
set
|
||||
{
|
||||
minValue = Math.Min(value, maxValue - 0.001d);
|
||||
OnPropertyChanged(nameof(MinValue));
|
||||
}
|
||||
}
|
||||
public double MaxValue
|
||||
{
|
||||
get => maxValue;
|
||||
set
|
||||
{
|
||||
maxValue = Math.Max(value, minValue + 0.001d);
|
||||
OnPropertyChanged(nameof(MaxValue));
|
||||
}
|
||||
}
|
||||
public int StepCount
|
||||
{
|
||||
get => stepCount;
|
||||
set
|
||||
{
|
||||
stepCount = value;
|
||||
stepCount = Math.Max(stepCount, 10);
|
||||
stepCount = Math.Min(stepCount, 500);
|
||||
OnPropertyChanged(nameof(StepCount));
|
||||
}
|
||||
}
|
||||
public bool PositiveInTension
|
||||
{
|
||||
get => positiveInTension;
|
||||
set
|
||||
{
|
||||
positiveInTension = value;
|
||||
var tmpMinValue = minValue;
|
||||
minValue = maxValue * -1d;
|
||||
maxValue = tmpMinValue * -1d;
|
||||
OnPropertyChanged(nameof(PositiveInTension));
|
||||
OnPropertyChanged(nameof(MinValue));
|
||||
OnPropertyChanged(nameof(MaxValue));
|
||||
}
|
||||
}
|
||||
public SelectItemsViewModel<IHeadMaterial> MaterialsModel { get; private set; }
|
||||
public SelectItemsViewModel<LimitStateEntity> LimitStatesModel { get; private set; }
|
||||
public SelectItemsViewModel<CalcTermEntity> CalcTermsModel { get; private set; }
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public List<string> Labels { get; set; }
|
||||
public Func<double, string> YFormatter { get; set; }
|
||||
|
||||
public MaterialDiagramViewModel(IHeadMaterial material)
|
||||
public ICommand RedrawLinesCommand
|
||||
{
|
||||
get => redrawLinesCommand ??= new RelayCommand(o => DrawLines(), b => IsDrawPossible());
|
||||
}
|
||||
|
||||
public MaterialDiagramViewModel(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material)
|
||||
{
|
||||
MaterialsModel = new SelectItemsViewModel<IHeadMaterial>(headMaterials) { ShowButtons = true};
|
||||
LimitStatesModel = new SelectItemsViewModel<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates) { ShowButtons = false};
|
||||
CalcTermsModel = new SelectItemsViewModel<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms) { ShowButtons = false};
|
||||
foreach (var item in MaterialsModel.CollectionItems)
|
||||
{
|
||||
if (item.Item == material)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
}
|
||||
else item.IsSelected = false;
|
||||
}
|
||||
this.material = material;
|
||||
minValue = -0.005d;
|
||||
maxValue = 0.005d;
|
||||
stepCount = 50;
|
||||
positiveInTension = true;
|
||||
SetLines();
|
||||
}
|
||||
|
||||
private void SetLines()
|
||||
{
|
||||
var titles = new List<string>() { "ULS Short Term", "ULS Long Term", "SLS Short Term","SLS Long Term"};
|
||||
var limitStates = new List<LimitStates> { LimitStates.ULS, LimitStates.SLS };
|
||||
var calcTerms = new List<CalcTerms> { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
var materials = MaterialsModel.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item);
|
||||
var limitStates = LimitStatesModel.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item);
|
||||
var calcTerms = CalcTermsModel.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item); ;
|
||||
var labels = new List<string>();
|
||||
var factor = positiveInTension ? 1d : -1d;
|
||||
|
||||
double minValue = -0.005d;
|
||||
double maxValue = 0.005d;
|
||||
if (material.HelperMaterial is IConcreteLibMaterial)
|
||||
{
|
||||
maxValue = 0.0005d;
|
||||
}
|
||||
int stepCount = 100;
|
||||
double step = (maxValue - minValue) / stepCount;
|
||||
|
||||
SeriesCollection = new SeriesCollection();
|
||||
|
||||
for (int i = 0; i < limitStates.Count(); i++)
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
for (int j = 0; j < calcTerms.Count(); j++)
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
int n = i * 2 + j;
|
||||
var line = new LineSeries() { Title = titles[n], PointGeometry = null, Fill = Brushes.Transparent};
|
||||
var chartValues = new ChartValues<double>();
|
||||
|
||||
var loaderMaterial = material.GetLoaderMaterial(limitStates[i], calcTerms[j]);
|
||||
var title = titles[n];
|
||||
for (double s = minValue; s < maxValue; s += step)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
double diagramValue = Math.Round(loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters,s)) * UnitConstants.Stress;
|
||||
//var point = new PointF() { X = (float)s, Y = (float)diagramValue };
|
||||
//chartValues.Add(point);
|
||||
chartValues.Add(diagramValue);
|
||||
labels.Add(Convert.ToString(Math.Round(s,4)));
|
||||
var loaderMaterial = material.GetLoaderMaterial(limitState.LimitState, calcTerm.CalcTerm);
|
||||
var lineSeries = new LineSeries()
|
||||
{ Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})",
|
||||
PointGeometry = null,
|
||||
Fill = Brushes.Transparent,
|
||||
};
|
||||
if (limitStates.Count() == 1 && calcTerms.Count() == 1)
|
||||
{
|
||||
lineSeries.Stroke = new SolidColorBrush(material.Color);
|
||||
}
|
||||
var chartValues = new ChartValues<double>();
|
||||
for (double s = minValue; s < maxValue; s += step)
|
||||
{
|
||||
//var trueStep = s * factor;
|
||||
double diagramValue = Math.Round(loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters, s * factor)) * factor * UnitConstants.Stress;
|
||||
//var point = new PointF() { X = (float)s, Y = (float)diagramValue };
|
||||
//chartValues.Add(point);
|
||||
chartValues.Add(diagramValue);
|
||||
labels.Add(Convert.ToString(Math.Round(s , 4)));
|
||||
}
|
||||
lineSeries.Values = chartValues;
|
||||
SeriesCollection.Add(lineSeries);
|
||||
}
|
||||
line.Values = chartValues;
|
||||
SeriesCollection.Add(line);
|
||||
}
|
||||
}
|
||||
Labels = labels;
|
||||
}
|
||||
private void DrawLines()
|
||||
{
|
||||
SetLines();
|
||||
OnPropertyChanged(nameof(SeriesCollection));
|
||||
OnPropertyChanged(nameof(Labels));
|
||||
}
|
||||
|
||||
private bool IsDrawPossible()
|
||||
{
|
||||
if (MaterialsModel.CollectionItems.Count == 0) return false;
|
||||
if (LimitStatesModel.CollectionItems.Count == 0) return false;
|
||||
if (CalcTermsModel.CollectionItems.Count == 0) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,18 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
PrimitiveBase primitiveBase;
|
||||
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
||||
else if (newPrimitive is ICirclePrimitive) { primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive); }
|
||||
else if (newPrimitive is IPointPrimitive) { primitiveBase = new PointViewPrimitive(newPrimitive as IPointPrimitive); }
|
||||
else if (newPrimitive is IPointPrimitive)
|
||||
{
|
||||
if (newPrimitive is ReinforcementPrimitive)
|
||||
{
|
||||
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as ReinforcementPrimitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
primitiveBase = new PointViewPrimitive(newPrimitive as IPointPrimitive);
|
||||
}
|
||||
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
primitiveBase.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
Items.Add(primitiveBase);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
public SelectPrimitivesViewModel(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
|
||||
Items = new SelectItemsViewModel<PrimitiveBase>(primitiveViews);
|
||||
Items = new SelectItemsViewModel<PrimitiveBase>(primitiveViews) { ShowButtons = true };
|
||||
Items.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace StructureHelper.Windows.ViewModels
|
||||
}
|
||||
|
||||
public DataTemplate ItemDataDemplate { get; set; }
|
||||
|
||||
public bool ShowButtons { get; set; }
|
||||
public ObservableCollection<CollectionItem> CollectionItems { get; }
|
||||
|
||||
public ICommand SelectAllCommand
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public class CalcTermEntity
|
||||
{
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public CalcTermEntity()
|
||||
{
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public class CalcTermList
|
||||
{
|
||||
public List<CalcTermEntity> CalcTerms { get; private set; }
|
||||
public CalcTermList()
|
||||
{
|
||||
CalcTerms = new List<CalcTermEntity>()
|
||||
{
|
||||
new CalcTermEntity()
|
||||
{CalcTerm = Enums.CalcTerms.ShortTerm,
|
||||
Name = "Short term",
|
||||
ShortName = "Short term",
|
||||
Color = (Color)ColorConverter.ConvertFromString("Red")},
|
||||
new CalcTermEntity()
|
||||
{CalcTerm = Enums.CalcTerms.LongTerm,
|
||||
Name = "Long term",
|
||||
ShortName = "Long term",
|
||||
Color = (Color)ColorConverter.ConvertFromString("Green")}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public class LimitStateEntity
|
||||
{
|
||||
public LimitStates LimitState { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public LimitStateEntity()
|
||||
{
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public class LimitStatesList
|
||||
{
|
||||
public List<LimitStateEntity> LimitStates { get; private set; }
|
||||
public LimitStatesList()
|
||||
{
|
||||
LimitStates = new List<LimitStateEntity>()
|
||||
{
|
||||
new LimitStateEntity()
|
||||
{LimitState = Enums.LimitStates.ULS,
|
||||
Name = "Ultimate limit state",
|
||||
ShortName = "ULS",
|
||||
Color = (Color)ColorConverter.ConvertFromString("Red")},
|
||||
new LimitStateEntity()
|
||||
{LimitState = Enums.LimitStates.SLS,
|
||||
Name = "Serviceability limit state",
|
||||
ShortName = "SLS",
|
||||
Color = (Color)ColorConverter.ConvertFromString("Green")}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public static CodeTypes CodeType => CodeTypes.SP63_13330_2018;
|
||||
public static CrossSectionAxisNames CrossSectionAxisNames => new CrossSectionAxisNames();
|
||||
public static LimitStatesList LimitStatesList => new LimitStatesList();
|
||||
public static CalcTermList CalcTermList => new CalcTermList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportForceResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IForcesResults results;
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public ExportForceResultToCSVLogic(IForcesResults forcesResults)
|
||||
{
|
||||
this.results = forcesResults;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in results.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportGeometryResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IGeometryResult result;
|
||||
public string FileName { get; set; }
|
||||
public ExportGeometryResultToCSVLogic(IGeometryResult geometryResult)
|
||||
{
|
||||
this.result = geometryResult;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Name",
|
||||
"Short",
|
||||
"Measerement Unit",
|
||||
"Value",
|
||||
"Description",
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in result.TextParameters)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
string[] newLine =
|
||||
{
|
||||
item.Name,
|
||||
item.ShortName,
|
||||
item.MeasurementUnit,
|
||||
item.Value.ToString(),
|
||||
item.Description
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportToCSVLogic : IExportResultLogic
|
||||
{
|
||||
string filename;
|
||||
|
||||
public void Export(INdmResult ndmResult)
|
||||
{
|
||||
string separator = ";";
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
if (ndmResult is ForcesResults)
|
||||
{
|
||||
var forceResults = ndmResult as ForcesResults;
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
foreach (var item in forceResults.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
File.AppendAllText(filename, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown +": "+ nameof(ndmResult));
|
||||
}
|
||||
|
||||
public ExportToCSVLogic(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryCalculator : IGeometryCalculator
|
||||
{
|
||||
TextParametersLogic parametersLogic;
|
||||
IGeometryResult geometryResult;
|
||||
public string Name { get; set; }
|
||||
|
||||
public INdmResult Result => geometryResult;
|
||||
|
||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
}
|
||||
|
||||
public GeometryCalculator(TextParametersLogic parametersLogic)
|
||||
{
|
||||
this.parametersLogic = parametersLogic;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
geometryResult = new GeometryResult() { IsValid = true };
|
||||
geometryResult.TextParameters = parametersLogic.GetTextParameters();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryResult : IGeometryResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ITextParameter> TextParameters { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryCalculator : INdmCalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryResult : INdmResult
|
||||
{
|
||||
List<ITextParameter> TextParameters { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public interface IExportResultLogic
|
||||
{
|
||||
void Export(INdmResult ndmResult);
|
||||
string FileName { get; set; }
|
||||
void Export();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,17 +27,51 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
parameters.AddRange(GetGravityCenter(prefixInitial, ndms));
|
||||
parameters.AddRange(GetSimpleArea(ndms));
|
||||
parameters.AddRange(GetArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetMomentOfInertia(prefixInitial, ndms));
|
||||
parameters.AddRange(GetGravityCenter(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetArea(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetMomentOfInertia(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetAreaRatio(ndms, strainMatrix));
|
||||
parameters.AddRange(GetMomentOfInertiaRatio(ndms, strainMatrix));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetSecondMomentOfArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
private IEnumerable<ITextParameter> GetSimpleArea(IEnumerable<INdm> ndms)
|
||||
{
|
||||
const string name = "Moment of inertia";
|
||||
const string name = "Summary Area";
|
||||
const string shortName = "A";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitName = $"{unitArea.Name}";
|
||||
var unitMultiPlayer = unitArea.Multiplyer;
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{name}",
|
||||
ShortName = $"{shortName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{name} of cross-section without reduction"
|
||||
};
|
||||
try
|
||||
{
|
||||
firstParameter.Value = ndms.Sum(x => x.Area) * unitMultiPlayer;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetMomentOfInertia(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Bending stiffness";
|
||||
const string shortName = "EI";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
@@ -47,7 +81,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {firstAxisName.ToUpper()}",
|
||||
ShortName = $"I{firstAxisName}",
|
||||
ShortName = $"{shortName}{firstAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {firstAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
@@ -55,7 +89,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {secondAxisName}",
|
||||
ShortName = $"I{secondAxisName}",
|
||||
ShortName = $"{shortName}{secondAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {secondAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
@@ -78,9 +112,51 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
parameters.Add(secondParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetMomentOfInertiaRatio(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Bending stiffness";
|
||||
const string shortName = "EI";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} {firstAxisName.ToUpper()} ratio",
|
||||
ShortName = $"{shortName}{firstAxisName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {firstAxisName}-axis ratio"
|
||||
};
|
||||
var secondParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} {secondAxisName} ratio",
|
||||
ShortName = $"{shortName}{secondAxisName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {secondAxisName}-axis ratio"
|
||||
};
|
||||
try
|
||||
{
|
||||
var initialMoments = GeometryOperations.GetReducedMomentsOfInertia(locNdms);
|
||||
var actualMoments = GeometryOperations.GetReducedMomentsOfInertia(locNdms, locStrainMatrix);
|
||||
firstParameter.Value = actualMoments.MomentX / initialMoments.MomentX;
|
||||
secondParameter.Value = actualMoments.MomentY / initialMoments.MomentY;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
secondParameter.IsValid = false;
|
||||
secondParameter.Value = double.NaN;
|
||||
secondParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
parameters.Add(secondParameter);
|
||||
return parameters;
|
||||
}
|
||||
private IEnumerable<ITextParameter> GetArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Longitudinal stiffness";
|
||||
const string shortName = "EA";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
@@ -89,10 +165,10 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} Area",
|
||||
ShortName = "EA",
|
||||
Name = $"{prefix} {name}",
|
||||
ShortName = $"{shortName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} Area of cross-section multiplied by {prefix} modulus"
|
||||
Description = $"{prefix} {name} of cross-section multiplied by {prefix} modulus"
|
||||
};
|
||||
try
|
||||
{
|
||||
@@ -107,13 +183,39 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetAreaRatio(IEnumerable<INdm> locNdms, IStrainMatrix locStrainMatrix)
|
||||
{
|
||||
const string name = "Longitudinal stiffness";
|
||||
const string shortName = "EA";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} ratio",
|
||||
ShortName = $"{shortName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name}-ratio of cross-section"
|
||||
};
|
||||
try
|
||||
{
|
||||
var actual = GeometryOperations.GetReducedArea(locNdms, locStrainMatrix);
|
||||
var initial = GeometryOperations.GetReducedArea(locNdms);
|
||||
firstParameter.Value = actual / initial;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
public TextParametersLogic(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
this.ndms = ndms;
|
||||
this.strainMatrix = strainMatrix;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetGravityCenter(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
|
||||
Reference in New Issue
Block a user