// ============================= VIEWPORT BUTTON METHODS ============================ private void SectionClick(object sender, RoutedEventArgs e) { if (ModelLoaded == true) { // ChangeColor ClipMode if (ClipMode == true) { ClipMode = false; } else { ClipMode = true; } // Clip/Unclip Part and Show/Hide ClipPlane foreach (Part p in DB.PartLib.Values) { p.ClipPart(iRen.Get_ClipPlane(), ClipMode); } foreach (BoundaryCondition BC in DB.BCLib.Values) { BC.ClipBC(iRen.Get_ClipPlane(), ClipMode); } iRen.ShowClip(ClipMode); // Refresh Viewport iRen.Refresh(); } }
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); }