コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: Functions.cs プロジェクト: ovevans/STAN
        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);
        }