int Step; // Current selected analysis Step public BOX_BC(BoundaryCondition bc, Database db, TreeView tree, RenderInterface iren, double arrowScale, int step) { InitializeComponent(); VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; BC = bc; DB = db; iRen = iren; ArrowScale = arrowScale; Step = step; // Define BC TreeView item TreeBC = (TreeViewItem)tree.Items[2]; if (TreeBC.Items != null) { foreach (TreeViewItem i in TreeBC.Items) { if (i.Header.ToString().Contains("BC ID " + BC.ID + ":")) { TreeItem = i; break; } } } // Load data Name.Text = BC.Name; Color_Box.SelectedIndex = BC.ColorID; if (BC.Type == "SPC") { Type_Box.SelectedIndex = 0; } if (BC.Type == "PointLoad") { Type_Box.SelectedIndex = 1; } Table.Items.Clear(); foreach (KeyValuePair <int, MatrixST> i in BC.NodalValues) { Table.Items.Add(new SPC_Row { NID = i.Key, X = i.Value.GetFast(0, 0), Y = i.Value.GetFast(1, 0), Z = i.Value.GetFast(2, 0) }); } }
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; }
public void AddPart2GUI(Part part, RenderInterface iRen, ListBox PartBox, TreeView Tree) { // Define Part TreeView item TreeViewItem TreePart = (TreeViewItem)Tree.Items[0]; // Add Part to Selection Box and Viewport PartBox.Items.Add("PID " + part.ID.ToString() + ": " + part.Name); iRen.AddActor(part.Get_Actor()); iRen.AddActor(part.GetEdges()); iRen.AppendFaces.AddInput(part.GetFaces()); // Add Part to TreeView TreeViewItem item = new TreeViewItem() { Header = "Part ID " + part.ID.ToString() + ": " + part.Name }; TreePart.Items.Add(item); TreePart.IsExpanded = true; // Expand Parts in Tree }
public void AddBC2GUI(BoundaryCondition BC, RenderInterface iRen, TreeView Tree, bool Selected) { // Define BC TreeView item TreeViewItem TreeBC = (TreeViewItem)Tree.Items[2]; // Add BC actor to Viewport iRen.AddActor(BC.GetActor()[0]); iRen.AddActor(BC.GetActor()[1]); iRen.AddActor(BC.GetActor()[2]); BC.HideActor(); // Add BC to TreeView TreeViewItem item = new TreeViewItem() { Header = "BC ID " + BC.ID.ToString() + ": " + BC.Name, IsSelected = Selected }; TreeBC.Items.Add(item); TreeBC.IsExpanded = true; }
public BOX_Part(Part p, Database db, TreeView Tree, RenderInterface iren) { InitializeComponent(); VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; P = p; DB = db; iRen = iren; // Define BC TreeView item TreeViewItem TreePart = (TreeViewItem)Tree.Items[0]; if (TreePart.Items != null) { foreach (TreeViewItem i in TreePart.Items) { if (i.Header.ToString().Contains("Part ID " + P.ID + ":")) { TreeItem = i; break; } } } // Load data Name.Text = P.Name; // Load Materials if (DB.MatLib != null && DB.MatLib.Count > 0) { foreach (Material mat in DB.MatLib.Values) { Material_Box.Items.Add("Mat ID " + mat.ID.ToString() + ": " + mat.Name); } } //Load Color Color_Box.SelectedIndex = P.ColorID; // Load FE types if (DB.FELib.FE.Count > 0) { foreach (string type in DB.FELib.FE.Keys) { if (type.Contains("HEX")) { HEX_Type.Items.Add(type); } if (type.Contains("PENTA")) { PENTA_Type.Items.Add(type); } if (type.Contains("TET")) { TETRA_Type.Items.Add(type); } } } // Select right material from list if it should be // if MatID is 0 just leave it, selected field will be empty - right way for new model if (P.Get_MatID() != 0) { for (int i = 0; i < Material_Box.Items.Count; i++) { if (P.Get_MatID() == int.Parse(Fun.Between(Material_Box.Items[i].ToString(), "ID", ":"))) { Material_Box.SelectedIndex = i; break; } } } // Select FE type for (int i = 0; i < HEX_Type.Items.Count; i++) { if (P.Get_FEtype()[0] == HEX_Type.Items[i].ToString()) { HEX_Type.SelectedIndex = i; break; } } for (int i = 0; i < PENTA_Type.Items.Count; i++) { if (P.Get_FEtype()[1] == PENTA_Type.Items[i].ToString()) { PENTA_Type.SelectedIndex = i; break; } } for (int i = 0; i < TETRA_Type.Items.Count; i++) { if (P.Get_FEtype()[2] == TETRA_Type.Items[i].ToString()) { TETRA_Type.SelectedIndex = i; break; } } }
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); }
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; } }