private void StepClick(object sender, RoutedEventArgs e) { // Hide BC actors foreach (BoundaryCondition bc in DB.BCLib.Values) { bc.HideActor(); } string s = (sender as Button).Name.ToString(); if (s.Contains("NextStep")) { int step = int.Parse(Step.Content.ToString()); if (step < DB.AnalysisLib.GetIncNumb()) { ResControl.Step = step + 1; Step.Content = (step + 1).ToString(); ResControl = Fun.UpdateMesh(DB, iRen, ResControl); Update_RangeText(); } } if (s.Contains("PrevStep")) { int step = int.Parse(Step.Content.ToString()); if (step > 0) { ResControl.Step = step - 1; Step.Content = (step - 1).ToString(); ResControl = Fun.UpdateMesh(DB, iRen, ResControl); Update_RangeText(); } } }
private void RemoveResults_Click(object sender, RoutedEventArgs e) { DialogResult d = System.Windows.Forms.MessageBox.Show( "Are you sure you want to remove all results from database?", "Warning", MessageBoxButtons.YesNo); if (d == System.Windows.Forms.DialogResult.Yes) { ResControl = new ResultControl(); foreach (Part P in DB.PartLib.Values) { P.UpdateNode(DB, 0); P.UpdateScalar(0, "None", "Element Max"); P.Load_Scalar(DB); } iRen.HideScalarBar(); DB.AnalysisLib.SetResultStepNo(0); PropertyBox.Children.Clear(); foreach (Element E in DB.ElemLib.Values) { E.ClearResults(); } foreach (Node N in DB.NodeLib.Values) { N.Initialize_StepZero(); } TreeResult.Header = "Results (not avaliable)"; TreeResult.IsEnabled = false; iRen.Refresh(); } }
private void Result_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Initial_Load == false && ResultBox.Items.Count > 0) { // Catch selected result in ResultBox ResControl.Result = ResultBox.SelectedItem.ToString(); // Update View ResControl = Fun.UpdateMesh(DB, iRen, ResControl); Update_RangeText(); } }
private void Manual_Range_Apply(object sender, RoutedEventArgs e) { if (double.TryParse(Manual_Min.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out _)) { ResControl.ResultRange[0] = double.Parse(Manual_Min.Text, CultureInfo.InvariantCulture); } if (double.TryParse(Manual_Max.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out _)) { ResControl.ResultRange[1] = double.Parse(Manual_Max.Text, CultureInfo.InvariantCulture); } ResControl = Fun.UpdateMesh(DB, iRen, ResControl); }
public MainWindow() { InitializeComponent(); // Initialize Fun = new Functions(); // General methods iRen = new RenderInterface(); // 3D Graphics interface ResControl = new ResultControl(); // Result Display object // Deactive buttons OpenButton.IsEnabled = false; ImportButton.IsEnabled = false; TopButtonBar.IsEnabled = false; // Deactive Menu items Open.IsEnabled = false; Import.IsEnabled = false; Save.IsEnabled = false; }
private void Manual_CheckBox_Click(object sender, RoutedEventArgs e) { bool status = (bool)(sender as CheckBox).IsChecked; if (status == true) { ResultManualWindow.IsEnabled = true; ResControl.ManualRange = true; } else { ResultManualWindow.IsEnabled = false; ResControl.ManualRange = false; if (Initial_Load == false) { ResControl = Fun.UpdateMesh(DB, iRen, ResControl); Update_RangeText(); } } }
// ======================= VISUALIZATION AND VIEW METHODS =========================== private void CreateNewModel() { // Clear Database DB = null; ModelLoaded = false; // Create new View iRen.CreateViewport(RenderingWindow); // Remove initial rectangle with background color RenderingWindow.Children.Remove(InitialBackground); // Clear Treeview, PartBox and PropertyBox TreePart.Items.Clear(); TreeBC.Items.Clear(); TreeMat.Items.Clear(); PartBox.Items.Clear(); PropertyBox.Children.Clear(); // Clear Result Control ResControl = new ResultControl(); // Active/Deactive buttons OpenButton.IsEnabled = true; ImportButton.IsEnabled = true; TopButtonBar.IsEnabled = false; TreeResult.IsEnabled = false; TreeResult.Header = "Results (not avaliable)"; // Active Menu items Open.IsEnabled = true; Import.IsEnabled = true; // Deactive TreeView Tree.IsEnabled = false; }
public ResultControl UpdateMesh(Database DB, RenderInterface iRen, ResultControl ResControl) { // Catch increment int inc = ResControl.Step; // --- Scalar Bar --------------------------------------------- if (ResControl.Result != "None") { string title = ResControl.Result; if (ResControl.Result.Contains("Displacement")) // Use shorter title { title = ResControl.Result.Replace("Displacement", "Displ."); } if (ResControl.Result == "von Mises Stress") // Use shorter title { title = "Stress\nvon Mises"; } if (ResControl.Result == "Effective Strain") // Use shorter title { title = "Effective\nStrain"; } iRen.ChangeScalarName(title); iRen.ShowScalarBar(); } else { iRen.HideScalarBar(); } // --- Colormaps -------------------------------------------- // Set range of results (manual or automatic, depends on variable "Manual_Range") if (ResControl.ManualRange == false) { //Set automatic result range List <double> MinVal = new List <double>(); List <double> MaxVal = new List <double>(); foreach (Part p in DB.PartLib.Values) { double[] PartRange = p.Get_ScalarRange(inc, ResControl.Result, ResControl.ResultStyle); MinVal.Add(PartRange[0]); MaxVal.Add(PartRange[1]); } // Calculate total result range ResControl.ResultRange = new double[2] { MinVal.Min(), MaxVal.Max() }; } // Change Color LookupTable range iRen.ChangeColorRange(ResControl.ResultRange[0], ResControl.ResultRange[1]); // Update Parts foreach (Part p in DB.PartLib.Values) { p.UpdateNode(DB, inc); p.UpdateScalar(inc, ResControl.Result, ResControl.ResultStyle); } double[] N = iRen.Get_ClipPlane().GetNormal(); if (N[0] < 0) { iRen.SetClipPlane("-X"); } if (N[1] < 0) { iRen.SetClipPlane("-Y"); } if (N[2] < 0) { iRen.SetClipPlane("-Z"); } if (N[0] > 0) { iRen.SetClipPlane("X"); } if (N[1] > 0) { iRen.SetClipPlane("Y"); } if (N[2] > 0) { iRen.SetClipPlane("Z"); } // Refresh Viewport iRen.Refresh(); return(ResControl); }
private void Result_Changed(object sender, SelectionChangedEventArgs e) { if ((sender as ComboBox).Name == "Result_ComboBox") { // Clear ResultBox if exists if (ResultBox != null) { ResultBox.Items.Clear(); } // Catch selected Result type ComboBoxItem item = (ComboBoxItem)Result_ComboBox.SelectedItem; string type = item.Content.ToString(); if (type == "None") { ResControl.Result = "None"; } if (type == "Displacement") { ResultBox.Items.Add("Displacement X"); ResultBox.Items.Add("Displacement Y"); ResultBox.Items.Add("Displacement Z"); ResultBox.Items.Add("Total Displacement"); } if (type == "Stress") { ResultBox.Items.Add("von Mises Stress"); ResultBox.Items.Add("Stress P1"); ResultBox.Items.Add("Stress P2"); ResultBox.Items.Add("Stress P3"); ResultBox.Items.Add("Stress XX"); ResultBox.Items.Add("Stress YY"); ResultBox.Items.Add("Stress ZZ"); ResultBox.Items.Add("Stress XY"); ResultBox.Items.Add("Stress YZ"); ResultBox.Items.Add("Stress XZ"); } if (type == "Strain") { ResultBox.Items.Add("Effective Strain"); ResultBox.Items.Add("Strain P1"); ResultBox.Items.Add("Strain P2"); ResultBox.Items.Add("Strain P3"); ResultBox.Items.Add("Strain XX"); ResultBox.Items.Add("Strain YY"); ResultBox.Items.Add("Strain ZZ"); ResultBox.Items.Add("Strain XY"); ResultBox.Items.Add("Strain YZ"); ResultBox.Items.Add("Strain XZ"); } } if ((sender as ComboBox).Name == "ResultStyle_ComboBox") { ComboBoxItem item = (ComboBoxItem)ResultStyle_ComboBox.SelectedItem; ResControl.ResultStyle = item.Content.ToString(); } // Update Mesh ResControl = Fun.UpdateMesh(DB, iRen, ResControl); Update_RangeText(); }
public BOX_Result(ResultControl res, Database db, RenderInterface iren) { InitializeComponent(); ResControl = res; DB = db; iRen = iren; // Set changes as initial load - not update mesh Initial_Load = true; // Select current Result general type (Stress, strain, etc.) foreach (ComboBoxItem i in Result_ComboBox.Items) { if (ResControl.Result.Contains(i.Content.ToString())) { Result_ComboBox.SelectedItem = i; break; } } // Select current Result direction (XX, YY, XY, etc.) foreach (string i in ResultBox.Items) { if (i.ToString() == ResControl.Result) { ResultBox.SelectedItem = i; break; } } // Select current Result style ("Element Max", etc.) foreach (ComboBoxItem i in ResultStyle_ComboBox.Items) { if (i.Content.ToString() == ResControl.ResultStyle) { ResultStyle_ComboBox.SelectedItem = i; break; } } // Set Manual or Automatic range if (ResControl.ManualRange == true) { Manual_CheckBox.IsChecked = true; ResultManualWindow.IsEnabled = true; } else { Manual_CheckBox.IsChecked = false; ResultManualWindow.IsEnabled = false; } // Set Current analysis step Step.Content = ResControl.Step.ToString(); // Update Manual Range textboxes Update_RangeText(); // Set window as loaded - from now on the mesh will be updated Initial_Load = false; // Disable this window if there are no results in Database if (DB.AnalysisLib.GetIncNumb() > 0) { ResultWindow.IsEnabled = true; } else { ResultWindow.IsEnabled = false; } }