Geometry property results have been added
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
Binary file not shown.
@@ -9,6 +9,9 @@
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculator\GeometryCalculatorResultView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\Errors\ErrorMessage.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -35,6 +38,9 @@
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculator\GeometryCalculatorResultView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\Errors\ErrorMessage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<DataGridTextColumn Header="EpsZ" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.EpsZ}"/>
|
||||
<DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding LoaderResults.AccuracyRate}"/>
|
||||
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding LoaderResults.IterationCounter}"/>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Desctription}"/>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
@@ -44,6 +44,7 @@
|
||||
<Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
|
||||
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
||||
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
||||
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculator.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"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:GeometryCalculatorResultViewModel}"
|
||||
Title="Geometry Properies" Height="450" Width="850" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding TextParameters}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="Pink"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="Name" Width="100" Binding="{Binding Name}"/>
|
||||
<DataGridTextColumn Header="Short" Width="50" Binding="{Binding ShortName}"/>
|
||||
<DataGridTextColumn Header="Unit" Width="100" Binding="{Binding MeasurementUnit}"/>
|
||||
<DataGridTextColumn Header="Value" Width="150" Binding="{Binding Value}"/>
|
||||
<DataGridTextColumn Header="Description" Width="400" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators.GeometryCalculator;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculator
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для GeometryCalculatorResultView.xaml
|
||||
/// </summary>
|
||||
public partial class GeometryCalculatorResultView : Window
|
||||
{
|
||||
GeometryCalculatorResultViewModel viewModel;
|
||||
public GeometryCalculatorResultView(List<ITextParameter> textParameters)
|
||||
{
|
||||
viewModel = new GeometryCalculatorResultViewModel(textParameters);
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,13 +98,25 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Expander>
|
||||
<Expander Header="Materials" MinWidth="20">
|
||||
<Expander Header="Materials" MinWidth="20" DataContext="{Binding MaterialsLogic}">
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||
<Button Content="Materials" Command="{Binding EditMaterialsCommand}"/>
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Concrete" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}"/>
|
||||
<Button Content="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}"/>
|
||||
<Button Content="Elastic" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Button Content="Edit" Command="{Binding Edit}"/>
|
||||
<Button Content="Copy" Command="{Binding Copy}"/>
|
||||
<Button Content="Delete" Command="{Binding Delete}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
</ListBox>
|
||||
</Expander>
|
||||
<Expander Header="Geometry" MinWidth="20" DataContext="{Binding PrimitiveLogic}">
|
||||
|
||||
@@ -6,7 +6,9 @@ using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
@@ -40,6 +42,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public MaterialsViewModel MaterialsLogic { get => materialsLogic; }
|
||||
public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
public HelpLogic HelpLogic => new HelpLogic();
|
||||
|
||||
@@ -153,11 +156,13 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand AddRCCircleCase
|
||||
{ get
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -215,6 +220,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private PrimitiveViewModelLogic primitiveLogic;
|
||||
private RelayCommand showVisualProperty;
|
||||
private RelayCommand selectPrimitive;
|
||||
private MaterialsViewModel materialsLogic;
|
||||
|
||||
public MainViewModel(MainModel model)
|
||||
{
|
||||
@@ -222,6 +228,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
materialsLogic = new MaterialsViewModel(repository);
|
||||
materialsLogic.AfterItemsEdit += afterMaterialEdit;
|
||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
@@ -253,7 +261,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||
}
|
||||
});
|
||||
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
||||
|
||||
SetColor = new RelayCommand(o =>
|
||||
{
|
||||
@@ -279,16 +286,19 @@ namespace StructureHelper.Windows.MainWindow
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddSlabCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
});
|
||||
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
@@ -318,11 +328,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
});
|
||||
}
|
||||
|
||||
private void EditHeadMaterials()
|
||||
private void afterMaterialEdit(CRUDViewModelBase<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||
{
|
||||
var wnd = new HeadMaterialsView(repository);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
foreach (var primitive in primitiveLogic.Items)
|
||||
{
|
||||
primitive.RefreshColor();
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
Title="Select Primitives" Height="250" Width="250" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ItemsSource="{Binding Items.CollectionItems}" SelectedItem="Items.SelectedItem">
|
||||
<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>
|
||||
@@ -27,7 +33,7 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
12
StructureHelper/Windows/ViewModels/CRUDVMEventArgs.cs
Normal file
12
StructureHelper/Windows/ViewModels/CRUDVMEventArgs.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public class CRUDVMEventArgs
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using Microsoft.VisualBasic;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,7 +14,6 @@ namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public abstract class CRUDViewModelBase<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
|
||||
{
|
||||
|
||||
private ICommand addCommand;
|
||||
private ICommand deleteCommand;
|
||||
private ICommand copyCommand;
|
||||
@@ -83,6 +83,7 @@ namespace StructureHelper.Windows.ViewModels
|
||||
Items.Add(item);
|
||||
}
|
||||
OnPropertyChanged(nameof(Items));
|
||||
AfterItemsEdit?.Invoke(this, new CRUDVMEventArgs());
|
||||
}
|
||||
|
||||
public ICommand Copy
|
||||
@@ -113,15 +114,19 @@ namespace StructureHelper.Windows.ViewModels
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
public CRUDViewModelBase()
|
||||
{
|
||||
Items = new ObservableCollection<TItem>();
|
||||
}
|
||||
|
||||
public CRUDViewModelBase(List<TItem> collection)
|
||||
{
|
||||
Collection = collection;
|
||||
Items = new ObservableCollection<TItem>(collection);
|
||||
Refresh();
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
Items = new ObservableCollection<TItem>(Collection);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
AfterItemsEdit?.Invoke(this, new CRUDVMEventArgs());
|
||||
}
|
||||
public delegate void CRUDHandler(CRUDViewModelBase<TItem> sender, CRUDVMEventArgs e);
|
||||
public event CRUDHandler? AfterItemsEdit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.Errors;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
@@ -50,6 +51,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private RelayCommand interpolateCommand;
|
||||
private RelayCommand setPrestrainCommand;
|
||||
private ICommand showAnchorageCommand;
|
||||
private ICommand showGeometryResultCommand;
|
||||
|
||||
public IForcesResults ForcesResults
|
||||
{
|
||||
@@ -63,13 +65,8 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
return showIsoFieldCommand ??
|
||||
(showIsoFieldCommand = new RelayCommand(o =>
|
||||
{
|
||||
var vm = new SelectPrimitivesViewModel(ndmPrimitives);
|
||||
var wnd = new SelectPrimitivesView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
if (SelectPrimitives() == true)
|
||||
{
|
||||
selectedNdmPrimitives = vm.Items.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item.GetNdmPrimitive());
|
||||
GetNdms();
|
||||
ShowIsoField();
|
||||
}
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||
@@ -169,7 +166,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
var result = calculator.Result;
|
||||
if (result is null || result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -215,11 +212,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
(showAnchorageCommand = new RelayCommand(o =>
|
||||
{
|
||||
showAnchorage();
|
||||
}, o => SelectedResult != null
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void showAnchorage()
|
||||
{
|
||||
try
|
||||
@@ -239,7 +235,33 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
DetailText = $"{ex}"};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ShowGeometryResultCommand =>
|
||||
showGeometryResultCommand ??= new RelayCommand(o =>
|
||||
showGeometryResult(), o => SelectedResult != null && SelectedResult.IsValid);
|
||||
private void showGeometryResult()
|
||||
{
|
||||
if (SelectPrimitives() == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var textParametrsLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
var textParameters = textParametrsLogic.GetTextParameters();
|
||||
var wnd = new GeometryCalculatorResultView(textParameters);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = "Errors apearred during showing isofield, see detailed information",
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ForcesResultsViewModel(IForceCalculator forceCalculator)
|
||||
@@ -269,7 +291,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void GetNdms()
|
||||
{
|
||||
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
@@ -293,5 +314,19 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
ndms = ndmRange;
|
||||
}
|
||||
|
||||
private bool SelectPrimitives()
|
||||
{
|
||||
var vm = new SelectPrimitivesViewModel(ndmPrimitives);
|
||||
var wnd = new SelectPrimitivesView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
selectedNdmPrimitives = vm.Items.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item.GetNdmPrimitive());
|
||||
GetNdms();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,40 @@ using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||
using System.Windows.Forms;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelper.Infrastructure;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class MaterialsViewModel : CRUDViewModelBase<IHeadMaterial>
|
||||
public class MaterialsViewModel : CRUDViewModelBase<IHeadMaterial>
|
||||
{
|
||||
ICrossSectionRepository repository;
|
||||
private ICommand editMaterialsCommand;
|
||||
|
||||
public ICommand EditMaterialsCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return editMaterialsCommand ??
|
||||
(
|
||||
editMaterialsCommand = new RelayCommand(o => EditHeadMaterials())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
public MaterialsViewModel(ICrossSectionRepository repository) : base(repository.HeadMaterials)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
CheckParameters(parameter);
|
||||
@@ -28,17 +52,26 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
public override void DeleteMethod(object parameter)
|
||||
{
|
||||
#error
|
||||
//to do delete method
|
||||
var primitives = repository.Primitives;
|
||||
var primitivesWithMaterial = primitives.Where(x => x.HeadMaterial == SelectedItem);
|
||||
int primitivesCount = primitivesWithMaterial.Count();
|
||||
if (primitivesCount > 0)
|
||||
{
|
||||
MessageBox.Show("Some primitives reference to this material", "Material can not be deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
base.DeleteMethod(parameter);
|
||||
}
|
||||
}
|
||||
public override void EditMethod(object parameter)
|
||||
{
|
||||
var wnd = new HeadMaterialView(SelectedItem);
|
||||
wnd.ShowDialog();
|
||||
base.EditMethod(parameter);
|
||||
}
|
||||
|
||||
private void AddElastic()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||
@@ -62,5 +95,11 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
if (parameter is null) { throw new StructureHelperException(ErrorStrings.ParameterIsNull); }
|
||||
if (parameter is not MaterialType) { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)} . Actual type: {nameof(parameter)}"); }
|
||||
}
|
||||
private void EditHeadMaterials()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(repository);
|
||||
wnd.ShowDialog();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,19 +1,37 @@
|
||||
using System;
|
||||
using StructureHelper.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public class SelectItemsViewModel<TItem>
|
||||
public class SelectItemsViewModel<TItem> : ViewModelBase
|
||||
where TItem : class
|
||||
{
|
||||
public class CollectionItem
|
||||
private ICommand? selectAllCommand;
|
||||
private ICommand? unSelectAllCommand;
|
||||
private ICommand? invertSelectionCommand;
|
||||
|
||||
public class CollectionItem : ViewModelBase
|
||||
{
|
||||
public bool IsSelected { get; set; }
|
||||
bool isSelected;
|
||||
public bool IsSelected
|
||||
{
|
||||
get
|
||||
{
|
||||
return isSelected;
|
||||
}
|
||||
set
|
||||
{
|
||||
isSelected = value;
|
||||
OnPropertyChanged(nameof(IsSelected));
|
||||
}
|
||||
}
|
||||
public TItem Item { get; set; }
|
||||
}
|
||||
|
||||
@@ -21,6 +39,45 @@ namespace StructureHelper.Windows.ViewModels
|
||||
|
||||
public ObservableCollection<CollectionItem> CollectionItems { get; }
|
||||
|
||||
public ICommand SelectAllCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectAllCommand ??= new RelayCommand(o => setIsSelected(true));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand UnSelectAllCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return unSelectAllCommand ??= new RelayCommand(o => setIsSelected(false));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand InvertSelectionCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return invertSelectionCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
item.IsSelected = !item.IsSelected;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void setIsSelected(bool isSelected)
|
||||
{
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
item.IsSelected = isSelected;
|
||||
}
|
||||
}
|
||||
|
||||
public SelectItemsViewModel(IEnumerable<TItem> items)
|
||||
{
|
||||
CollectionItems = new ObservableCollection<CollectionItem>();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public class CrossSectionAxisNames
|
||||
{
|
||||
public string FirstAxis => "x";
|
||||
public string SecondAxis => "y";
|
||||
public string ThirdAxis => "z";
|
||||
}}
|
||||
@@ -1,9 +1,11 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public static class ProgramSetting
|
||||
{
|
||||
public static CodeTypes CodeType => CodeTypes.SP63_13330_2018;
|
||||
public static CrossSectionAxisNames CrossSectionAxisNames => new CrossSectionAxisNames();
|
||||
}
|
||||
}
|
||||
|
||||
18
StructureHelperCommon/Models/Parameters/ITextParameter.cs
Normal file
18
StructureHelperCommon/Models/Parameters/ITextParameter.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Parameters
|
||||
{
|
||||
public interface ITextParameter
|
||||
{
|
||||
bool IsValid { get; set; }
|
||||
string Name { get; set; }
|
||||
string ShortName { get; set; }
|
||||
string MeasurementUnit { get; set; }
|
||||
double Value { get; set; }
|
||||
string Description { get; set; }
|
||||
}
|
||||
}
|
||||
18
StructureHelperCommon/Models/Parameters/TextParameter.cs
Normal file
18
StructureHelperCommon/Models/Parameters/TextParameter.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Parameters
|
||||
{
|
||||
public class TextParameter : ITextParameter
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public string MeasurementUnit { get; set; }
|
||||
public double Value { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
@@ -8,13 +6,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
internal static class CommonOperation
|
||||
public static class CommonOperation
|
||||
{
|
||||
private static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
|
||||
|
||||
@@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
internal interface IStringDoublePair
|
||||
public interface IStringDoublePair
|
||||
{
|
||||
double Digit { get; }
|
||||
string Text { get; }
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
internal class StringDoublePair : IStringDoublePair
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != "")
|
||||
{
|
||||
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
|
||||
Result = new ForcesResults() { IsValid = false, Description = checkResult };
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -86,7 +86,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
if (bucklingResult.IsValid != true)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Desctription += $"Buckling result:\n{bucklingResult.Desctription}\n";
|
||||
result.Description += $"Buckling result:\n{bucklingResult.Description}\n";
|
||||
}
|
||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
||||
result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
||||
@@ -94,7 +94,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Desctription = $"Buckling error:\n{ex}\n";
|
||||
result.Description = $"Buckling error:\n{ex}\n";
|
||||
}
|
||||
}
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
|
||||
@@ -57,19 +57,19 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
var calcResult = calculator.Result;
|
||||
if (calcResult.AccuracyRate <= accuracy.IterationAccuracy)
|
||||
{
|
||||
return new ForcesTupleResult() { IsValid = true, Desctription = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
return new ForcesTupleResult() { IsValid = true, Description = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesTupleResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = calcResult };
|
||||
return new ForcesTupleResult() { IsValid = false, Description = "Required accuracy rate has not achived", LoaderResults = calcResult };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var result = new ForcesTupleResult() { IsValid = false };
|
||||
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero") { result.Desctription = "Stiffness matrix is equal to zero \nProbably section was collapsed"; }
|
||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero") { result.Description = "Stiffness matrix is equal to zero \nProbably section was collapsed"; }
|
||||
else { result.Description = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<IForcesTupleResult> ForcesResultList { get; }
|
||||
public string Desctription { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public ForcesResults()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <summary>
|
||||
/// Text of result of calculations
|
||||
/// </summary>
|
||||
public string Desctription { get; set; }
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// Keep result of calculations from ndm-library
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesResults : INdmResult
|
||||
{
|
||||
string Desctription { get; set; }
|
||||
string Description { get; set; }
|
||||
List<IForcesTupleResult> ForcesResultList { get; }
|
||||
bool IsValid { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
/// True if result of calculation is valid
|
||||
/// </summary>
|
||||
bool IsValid { get; set; }
|
||||
string Desctription { get; set; }
|
||||
string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
|
||||
{
|
||||
var stiffness = GetStiffness();
|
||||
criticalForceLogic.LongForce = options.CalcForceTuple.Nz;
|
||||
criticalForceLogic.LongitudinalForce = options.CalcForceTuple.Nz;
|
||||
criticalForceLogic.StiffnessEI = stiffness.DX;
|
||||
criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorY;
|
||||
var etaAlongY = criticalForceLogic.GetEtaFactor();
|
||||
@@ -77,8 +77,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
{
|
||||
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
|
||||
|
||||
var concreteInertia = GeometryOperations.GetMomentsOfInertiaMod(concreteNdms, gravityCenter);
|
||||
var otherInertia = GeometryOperations.GetMomentsOfInertiaMod(otherNdms, gravityCenter);
|
||||
var concreteInertia = GeometryOperations.GetReducedMomentsOfInertia(concreteNdms, gravityCenter);
|
||||
var otherInertia = GeometryOperations.GetReducedMomentsOfInertia(otherNdms, gravityCenter);
|
||||
|
||||
var stiffnessX = stiffnessLogicX.GetStiffnessCoeffitients();
|
||||
var dX = stiffnessX.Kc * concreteInertia.MomentX + stiffnessX.Ks * otherInertia.MomentX;
|
||||
@@ -127,7 +127,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != "")
|
||||
{
|
||||
Result = new ConcreteBucklingResult() { IsValid = false, Desctription = checkResult };
|
||||
Result = new ConcreteBucklingResult() { IsValid = false, Description = checkResult };
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Desctription { get; set; }
|
||||
public string Description { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double EtaFactorAlongX { get; set; }
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
{
|
||||
internal class EilerCriticalForceLogic : IEilerCriticalForceLogic
|
||||
{
|
||||
public double LongForce { get; set; }
|
||||
public double LongitudinalForce { get; set; }
|
||||
public double StiffnessEI { get; set; }
|
||||
public double DesignLength { get; set; }
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public double GetEtaFactor()
|
||||
{
|
||||
if (LongForce >= 0d) return 1d;
|
||||
if (LongitudinalForce >= 0d) return 1d;
|
||||
var Ncr = GetCriticalForce();
|
||||
if (LongForce <= Ncr)
|
||||
if (LongitudinalForce <= Ncr)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.LongitudinalForceMustBeLessThanCriticalForce);
|
||||
}
|
||||
double eta = 1 / (1 - LongForce / Ncr);
|
||||
double eta = 1 / (1 - LongitudinalForce / Ncr);
|
||||
return eta;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
{
|
||||
internal interface IEilerCriticalForceLogic : ICriticalBucklingForceLogic
|
||||
{
|
||||
double LongForce { get; set; }
|
||||
double LongitudinalForce { get; set; }
|
||||
double StiffnessEI { get; set; }
|
||||
double DesignLength { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
public class TextParametersLogic
|
||||
{
|
||||
const string prefixInitial = "Initial";
|
||||
const string prefixActual = "Actual";
|
||||
static string firstAxisName => ProgramSetting.CrossSectionAxisNames.FirstAxis;
|
||||
static string secondAxisName => ProgramSetting.CrossSectionAxisNames.SecondAxis;
|
||||
static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
|
||||
private IEnumerable<INdm> ndms;
|
||||
private IStrainMatrix strainMatrix;
|
||||
public List<ITextParameter> GetTextParameters()
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
parameters.AddRange(GetGravityCenter(prefixInitial, ndms));
|
||||
parameters.AddRange(GetArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetGravityCenter(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetArea(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixActual, ndms, strainMatrix));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetSecondMomentOfArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Moment of inertia";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
var unitName = $"{unitStress.Name} * {unitArea.Name} * {unitArea.Name}";
|
||||
var unitMultiPlayer = unitArea.Multiplyer * unitArea.Multiplyer * unitStress.Multiplyer;
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {firstAxisName.ToUpper()}",
|
||||
ShortName = $"I{firstAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {firstAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
var secondParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {secondAxisName}",
|
||||
ShortName = $"I{secondAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {secondAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
try
|
||||
{
|
||||
var gravityCenter = GeometryOperations.GetReducedMomentsOfInertia(locNdms, locStrainMatrix);
|
||||
firstParameter.Value = gravityCenter.MomentX * unitMultiPlayer;
|
||||
secondParameter.Value = gravityCenter.MomentY * unitMultiPlayer;
|
||||
}
|
||||
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)
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
var unitName = $"{unitStress.Name} * {unitArea.Name}" ;
|
||||
var unitMultiPlayer = unitArea.Multiplyer * unitStress.Multiplyer;
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} Area",
|
||||
ShortName = "EA",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} Area of cross-section multiplied by {prefix} modulus"
|
||||
};
|
||||
try
|
||||
{
|
||||
firstParameter.Value = GeometryOperations.GetReducedArea(locNdms, locStrainMatrix) * unitMultiPlayer;
|
||||
}
|
||||
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>();
|
||||
var unitType = UnitTypes.Length;
|
||||
var unit = CommonOperation.GetUnit(unitType, "mm");
|
||||
var unitName = unit.Name;
|
||||
var unitMultiPlayer = unit.Multiplyer;
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} Center{firstAxisName.ToUpper()}",
|
||||
ShortName = $"{firstAxisName.ToUpper()}c",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} Displacement of center of gravity of cross-section along {firstAxisName}-axis"
|
||||
};
|
||||
var secondParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} Center{secondAxisName.ToUpper()}",
|
||||
ShortName = $"{secondAxisName.ToUpper()}c",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} Displacement of center of gravity of cross-section along {secondAxisName}-axis"
|
||||
};
|
||||
try
|
||||
{
|
||||
var gravityCenter = GeometryOperations.GetGravityCenter(locNdms, locStrainMatrix);
|
||||
firstParameter.Value = gravityCenter.CenterX * unitMultiPlayer;
|
||||
secondParameter.Value = gravityCenter.CenterY * unitMultiPlayer;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
var moments = GeometryOperations.GetReducedMomentsOfInertia(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
@@ -89,7 +89,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
var moments = GeometryOperations.GetReducedMomentsOfInertia(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
@@ -120,7 +120,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
var moments = GeometryOperations.GetReducedMomentsOfInertia(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
|
||||
Reference in New Issue
Block a user