diff --git a/StructureHelper/Libraries/FunctionParser.dll b/StructureHelper/Libraries/FunctionParser.dll new file mode 100644 index 0000000..8e88889 Binary files /dev/null and b/StructureHelper/Libraries/FunctionParser.dll differ diff --git a/StructureHelperCommon/Models/Materials/MaterialSettings.cs b/StructureHelperCommon/Models/Materials/MaterialSettings.cs new file mode 100644 index 0000000..e41ada2 --- /dev/null +++ b/StructureHelperCommon/Models/Materials/MaterialSettings.cs @@ -0,0 +1,18 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials +{ + public class MaterialSettings + { + public bool IsActive { get; set; } + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } + public IOneVariableFunction Function { get; set; } + } +} diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj index 0d7c275..0b5175e 100644 --- a/StructureHelperCommon/StructureHelperCommon.csproj +++ b/StructureHelperCommon/StructureHelperCommon.csproj @@ -16,7 +16,7 @@ - ..\..\FunctionParser\FunctionParser\bin\Debug\FunctionParser.dll + ..\StructureHelper\Libraries\FunctionParser.dll ..\StructureHelper\Libraries\LoaderCalculator.dll diff --git a/StructureHelperCommon/StructureHelperCommon.csproj.user b/StructureHelperCommon/StructureHelperCommon.csproj.user index 0505297..5ab7385 100644 --- a/StructureHelperCommon/StructureHelperCommon.csproj.user +++ b/StructureHelperCommon/StructureHelperCommon.csproj.user @@ -2,11 +2,17 @@ + + Code + Code + + Designer + Designer diff --git a/StructureHelperCommon/Windows/FunctionMaterialCreationVM.cs b/StructureHelperCommon/Windows/FunctionMaterialCreationVM.cs new file mode 100644 index 0000000..fdca4a9 --- /dev/null +++ b/StructureHelperCommon/Windows/FunctionMaterialCreationVM.cs @@ -0,0 +1,76 @@ +using FunctionParser; +using StructureHelperCommon.Infrastructures.Commands; +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Infrastructures.Settings; +using StructureHelperCommon.Models.Functions; +using StructureHelperCommon.Models.Materials; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace StructureHelperCommon.Windows +{ + public class FunctionMaterialCreationVM + { + public string CREATE_MATERIAL { get; } = "Create Function Material"; + public string MODULUS_OF_ELASTICITY { get; } = "Modulus of elasticity = "; + + private const string ERROR_TEXT_1 = "Not all material states have functions "; + private RelayCommand createFunctionMaterialCommand; + public ICommand CreateFunctionMaterialCommand + { + get => createFunctionMaterialCommand ??= new RelayCommand(o => CreateFunctionMaterial(o)); + } + public double Modulus { get; set; } = 2e11d; + public ObservableCollection Functions { get; set; } = new ObservableCollection(); + public ObservableCollection MaterialSettingsList { get; set; } = new() { new MaterialSettings() }; + public FunctionMaterialCreationVM() + { + var stressStrainFunctions = new ObservableCollection + ( + ProgramSetting.Functions + .Where(x => x.FunctionPurpose == Infrastructures.Enums.FunctionPurpose.StressStrain) + ); + GetFunctionsFromTree(stressStrainFunctions); + } + private void GetFunctionsFromTree(ObservableCollection stressStrainFunctions) + { + foreach (IOneVariableFunction func in stressStrainFunctions) + { + Functions.Add(func); + if (func.Functions.Count > 0) + { + GetFunctionsFromTree(func.Functions); + } + } + } + private void CreateFunctionMaterial(object parameter) + { + // var window = parameter as Window; + // if (Func_ST_ULS == null || + // Func_ST_SLS == null || + // Func_ST_Special == null || + // Func_LT_ULS == null || + // Func_LT_SLS == null || + // Func_LT_Special == null) + // { + // MessageBox.Show($"{ERROR_TEXT_1}"); + // return; + // } + // FunctionStorage.Func_ST_ULS = Func_ST_ULS; + // FunctionStorage.Func_ST_SLS = Func_ST_SLS; + // FunctionStorage.Func_ST_Special = Func_ST_Special; + // FunctionStorage.Func_LT_ULS = Func_LT_ULS; + // FunctionStorage.Func_LT_SLS = Func_LT_SLS; + // FunctionStorage.Func_LT_Special = Func_LT_Special; + // window.DialogResult = true; + // window.Close(); + } + + } +} diff --git a/StructureHelperCommon/Windows/FunctionMaterialCreationView.xaml b/StructureHelperCommon/Windows/FunctionMaterialCreationView.xaml new file mode 100644 index 0000000..df89fd9 --- /dev/null +++ b/StructureHelperCommon/Windows/FunctionMaterialCreationView.xaml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +