Anchoring isofields has been added

This commit is contained in:
Evgeny Redikultsev
2023-03-25 19:38:40 +05:00
parent a88fa40f29
commit 3d22c3440e
23 changed files with 599 additions and 112 deletions

View File

@@ -1,10 +1,14 @@
using LoaderCalculator.Data.Materials;
using FieldVisualizer.Entities.Values.Primitives;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses.RC;
@@ -12,6 +16,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Intrinsics.Arm;
using System.Text;
using System.Threading.Tasks;
@@ -19,53 +24,139 @@ namespace StructureHelper.Services.ResultViewers
{
public static class ShowAnchorageResult
{
private static IStressLogic stressLogic => new StressLogic();
public static void ShowAnchorageField (IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<PrimitiveBase> primitives)
internal static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives)
{
foreach (var item in primitives)
{
if (item is ReinforcementViewPrimitive)
{
var primitive = item as ReinforcementViewPrimitive;
var ndmPrimitive = primitive.GetNdmPrimitive() as ReinforcementPrimitive;
var inputData = new AnchorageInputData();
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
inputData.ReinforcementStrength = GetReinforcementStrength(limitState, calcTerm, ndmPrimitive);
inputData.CrossSectionArea = ndmPrimitive.Area;
var diameter = Math.Sqrt(ndmPrimitive.Area / Math.PI) * 2d;
inputData.CrossSectionPerimeter = Math.PI * diameter;
var material = ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
var ndm = ndmPrimitive.GetNdms(material).Single();
inputData.ReinforcementStress = stressLogic.GetStress(strainMatrix, ndm);
inputData.LappedCountRate = 0.5d;
}
}
}
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
{
if (primitive.HostPrimitive is not null)
{
var host = primitive.HostPrimitive;
var hostMaterial = host.HeadMaterial.HelperMaterial;
if (hostMaterial is IConcreteLibMaterial)
{
var concreteMaterial = hostMaterial as IConcreteLibMaterial;
var concreteStrength = concreteMaterial.GetStrength(limitState, calcTerm).Tensile;
return concreteStrength;
}
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null");
var primitiveSets = new List<IPrimitiveSet>();
PrimitiveSet primitiveSet;
primitiveSet = GetBaseDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives);
primitiveSets.Add(primitiveSet);
primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
primitiveSet.Name = "Development length full strength";
primitiveSets.Add(primitiveSet);
primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives,false);
primitiveSet.Name = "Development length actual stress";
primitiveSets.Add(primitiveSet);
primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, true);
primitiveSet.Name = "Lapping length full strength, r=50%";
primitiveSets.Add(primitiveSet);
primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, true);
primitiveSet.Name = "Lapping length full strength, r=100%";
primitiveSets.Add(primitiveSet);
primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, false);
primitiveSet.Name = "Lapping length actual stress, r=50%";
primitiveSets.Add(primitiveSet);
primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, false);
primitiveSet.Name = "Lapping length actual stress, r=100%";
primitiveSets.Add(primitiveSet);
primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
primitiveSet.Name = "Full strength";
primitiveSets.Add(primitiveSet);
primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, false);
primitiveSet.Name = "Actual stress";
primitiveSets.Add(primitiveSet);
return primitiveSets;
}
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
private static PrimitiveSet GetStrength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, bool fullStrength)
{
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
var material = primitive.HeadMaterial.HelperMaterial as IReinforcementLibMaterial;
var strength = material.GetStrength(limitState, calcTerm).Tensile;
return strength;
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var val = inputData.ReinforcementStress * UnitConstatnts.Stress;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null");
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetBaseDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives)
{
PrimitiveSet primitiveSet = new PrimitiveSet() { Name = "Base Development Length"};
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetBaseDevLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, bool fullStrength)
{
PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetDevLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetFullStrengthLapLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, double lapperdCountRate, bool fullStrength)
{
PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetLapLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static FieldVisualizer.Entities.Values.Primitives.CirclePrimitive GetValuePrimitive(IPointPrimitive primitive, double val)
{
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
{
CenterX = primitive.CenterX,
CenterY = primitive.CenterY,
Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
Value = val
};
return valuePrimitive;
}
}
}

View File

@@ -9,6 +9,9 @@
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Compile Update="Windows\Errors\ErrorMessage.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -23,6 +26,9 @@
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Errors\ErrorMessage.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -0,0 +1,37 @@
<Window x:Class="StructureHelper.Windows.Errors.ErrorMessage"
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.Errors"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Errors"
d:DataContext="{d:DesignInstance vm:ErrorProcessor}"
mc:Ignorable="d"
Title="Error Message" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Width="500" Height="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--<Image Source="IconBug128.png"/>-->
<TabControl Grid.Column="1" x:Name="tabControl">
<TabItem Header="Short information" Margin="0">
<Grid Background="#FFE5E5E5">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="HeaderText" TextWrapping="Wrap" Text="Happened something wrong" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontWeight="Bold"/>
<TextBlock Grid.Row="1" x:Name="MainText" TextWrapping="Wrap" Text="{Binding ShortText}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</TabItem>
<TabItem Header="Detailed Information">
<Grid Background="#FFE5E5E5">
<ScrollViewer>
<TextBlock x:Name="ExtendedText" TextWrapping="Wrap" Text="{Binding DetailText}"/>
</ScrollViewer>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>

View File

@@ -0,0 +1,31 @@
using StructureHelper.Windows.ViewModels.Errors;
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.Errors
{
/// <summary>
/// Логика взаимодействия для ErrorMessage.xaml
/// </summary>
public partial class ErrorMessage : Window
{
ErrorProcessor vm;
public ErrorMessage(ErrorProcessor errorProcessor)
{
vm = errorProcessor;
this.DataContext = vm;
InitializeComponent();
}
}
}

View File

@@ -7,16 +7,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels
{
public abstract class CRUDViewModelBase<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
{
private RelayCommand addCommand;
private RelayCommand deleteCommand;
private RelayCommand copyCommand;
private RelayCommand editCommand;
private ICommand addCommand;
private ICommand deleteCommand;
private ICommand copyCommand;
private ICommand editCommand;
public List<TItem> Collection { get; set; }
@@ -25,7 +26,7 @@ namespace StructureHelper.Windows.ViewModels
public ObservableCollection<TItem> Items { get; private set; }
public RelayCommand Add
public ICommand Add
{
get
{
@@ -43,7 +44,7 @@ namespace StructureHelper.Windows.ViewModels
Collection.Add(NewItem);
Items.Add(NewItem);
}
public RelayCommand Delete
public ICommand Delete
{
get
{
@@ -61,7 +62,7 @@ namespace StructureHelper.Windows.ViewModels
Collection.Remove(SelectedItem);
Items.Remove(SelectedItem);
}
public RelayCommand Edit
public ICommand Edit
{
get
{
@@ -84,7 +85,7 @@ namespace StructureHelper.Windows.ViewModels
OnPropertyChanged(nameof(Items));
}
public RelayCommand Copy
public ICommand Copy
{
get
{

View File

@@ -7,8 +7,10 @@ using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
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;
@@ -74,7 +76,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}
}
public RelayCommand ExportToCSVCommand
public ICommand ExportToCSVCommand
{
get
{
@@ -105,7 +107,12 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}
catch (Exception ex)
{
throw new StructureHelperException(ErrorStrings.FileCantBeDeleted + ex + filename);
var vm = new ErrorProcessor()
{
ShortText = ErrorStrings.FileCantBeDeleted + ex + filename,
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
}
@@ -115,15 +122,21 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
logic.Export(forcesResults);
try
{
Process filopener = new Process();
filopener.StartInfo.FileName = saveFileDialog.FileName;
var filopener = new Process();
var startInfo = new ProcessStartInfo(saveFileDialog.FileName) { UseShellExecute = true};
filopener.StartInfo = startInfo;
filopener.Start();
}
catch (Exception) { }
}
catch (Exception ex)
{
throw new StructureHelperException(ErrorStrings.FileCantBeSaved + ex + filename);
var vm = new ErrorProcessor()
{
ShortText = ErrorStrings.FileCantBeSaved + ex + filename,
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
}
}
@@ -209,7 +222,24 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private void showAnchorage()
{
throw new NotImplementedException();
try
{
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var limitState = SelectedResult.DesignForceTuple.LimitState;
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
var primitiveSets = ShowAnchorageResult.GetPrimitiveSets(strainMatrix, limitState, calcTerm, ndmPrimitives);
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
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)
@@ -221,10 +251,23 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private void ShowIsoField()
{
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
try
{
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
catch (Exception ex)
{
var vm = new ErrorProcessor()
{
ShortText = "Errors apearred during showing isofield, see detailed information",
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
}
private void GetNdms()

View File

@@ -12,30 +12,30 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
public class SetPrestrainViewModel : ViewModelBase
{
IStrainTuple SourceTuple;
private double coeffcient;
private double coefficient;
public double Coefficient
{
get
{
return coeffcient;
return coefficient;
}
set
{
SetProperty(ref coeffcient, value);
SetProperty(ref coefficient, value);
}
}
public SetPrestrainViewModel(IStrainTuple sourceTuple)
{
SourceTuple = sourceTuple;
coeffcient = 1d;
coefficient = 1d;
}
public IStrainTuple GetStrainTuple()
{
var result = new StrainTuple();
StrainTupleService.CopyProperties(SourceTuple, result, coeffcient);
StrainTupleService.CopyProperties(SourceTuple, result, coefficient);
return result;
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Errors
{
public class ErrorProcessor
{
public string? ShortText { get; set; }
public string? DetailText { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels
{
@@ -13,10 +14,10 @@ namespace StructureHelper.Windows.ViewModels
{
TItem SelectedItem { get; set; }
ObservableCollection<TItem> Items { get; }
RelayCommand Add { get; }
RelayCommand Delete { get; }
RelayCommand Edit { get; }
RelayCommand Copy { get; }
ICommand Add { get; }
ICommand Delete { get; }
ICommand Edit { get; }
ICommand Copy { get; }
void AddItems(IEnumerable<TItem> items);
}
}

View File

@@ -23,8 +23,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public ObservableCollection<IForceAction> Items { get; private set; }
private RelayCommand addForceCombinationCommand;
public RelayCommand Add
private ICommand addForceCombinationCommand;
public ICommand Add
{
get
{
@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
Items.Add(item);
repository.ForceActions.Add(item);
}
private RelayCommand deleteForceCombinationCommand;
public RelayCommand Delete
private ICommand deleteForceCombinationCommand;
public ICommand Delete
{
get
{
@@ -65,10 +65,10 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
repository.ForceActions.Remove(SelectedItem);
}
}
private RelayCommand editForceCombinationCommand;
private RelayCommand copyCommand;
private ICommand editForceCombinationCommand;
private ICommand copyCommand;
public RelayCommand Edit
public ICommand Edit
{
get
{
@@ -84,7 +84,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
}
}
public RelayCommand Copy
public ICommand Copy
{
get
{

View File

@@ -19,6 +19,7 @@ using System.Windows.Forms;
using System.Windows.Documents;
using StructureHelper.Windows.PrimitiveProperiesWindow;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
@@ -26,12 +27,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
private ICrossSection section;
private ICrossSectionRepository repository => section.SectionRepository;
private RelayCommand addCommand;
private RelayCommand deleteCommand;
private RelayCommand editCommand;
private RelayCommand copyCommand;
private RelayCommand setToFront;
private RelayCommand setToBack;
private ICommand addCommand;
private ICommand deleteCommand;
private ICommand editCommand;
private ICommand copyCommand;
private ICommand setToFront;
private ICommand setToBack;
public double CanvasWidth { get; set; }
public double CanvasHeight { get; set; }
@@ -40,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public ObservableCollection<PrimitiveBase> Items { get; private set; }
public RelayCommand Add
public ICommand Add
{
get
{
@@ -106,7 +107,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
OnPropertyChanged(nameof(PrimitivesCount));
}
public RelayCommand Delete
public ICommand Delete
{
get
{
@@ -148,7 +149,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
OnPropertyChanged(nameof(PrimitivesCount));
}
public RelayCommand Edit
public ICommand Edit
{
get
{
@@ -166,7 +167,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
wnd.ShowDialog();
}
public RelayCommand Copy
public ICommand Copy
{
get
{
@@ -197,7 +198,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public int PrimitivesCount => repository.Primitives.Count();
public RelayCommand SetToFront
public ICommand SetToFront
{
get
{
@@ -226,7 +227,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
else return false;
}
public RelayCommand SetToBack
public ICommand SetToBack
{
get
{

View File

@@ -10,6 +10,7 @@ using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
@@ -19,6 +20,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Linq;
@@ -314,7 +316,33 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
foreach (var item in sectionRepository.Primitives)
{
if (item is RectanglePrimitive || item is CirclePrimitive)
{HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));}
{
CheckHost(primitive, item);
HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));
}
}
}
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
{
var ndm = primitive.GetNdmPrimitive();
if (ndm is ReinforcementPrimitive)
{
var host = item as IHasDivisionSize;
var reinforcement = ndm as ReinforcementPrimitive;
if (host.IsPointInside(new Point2D() { X = reinforcement.CenterX, Y = reinforcement.CenterY })
&& reinforcement.HostPrimitive is null)
{
var dialogResult = MessageBox.Show($"Primitive {reinforcement.Name} is inside primitive {item.Name}",
"Assign new host?",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
reinforcement.HostPrimitive = item;
}
}
}
}