示例#1
0
        private bool recalculateMinMaxStressesOfSelection(Canguro.Model.Model model)
        {
            if (!model.HasResults || model.Results.ActiveCase == null)
            {
                return(false);
            }

            Model.Load.AbstractCase ac = model.Results.ActiveCase.AbstractCase;
            int numPoints = Properties.Settings.Default.ElementForcesSegments;

            LineStressCalculator lsc = new LineStressCalculator();

            Model.Section.FrameSection section;
            StraightFrameProps         sfProps;

            Vector2[][] contour;
            float       stress;

            float[,] s1, m22, m33;

            foreach (LineElement line in model.LineList)
            {
                if (line != null && line.IsVisible)
                {
                    sfProps = line.Properties as StraightFrameProps;
                    if (sfProps != null)
                    {
                        s1  = lsc.GetForcesDiagram(ac, line, Canguro.Model.Load.LineForceComponent.Axial, numPoints);
                        m22 = lsc.GetForcesDiagram(ac, line, Canguro.Model.Load.LineForceComponent.Moment22, numPoints);
                        m33 = lsc.GetForcesDiagram(ac, line, Canguro.Model.Load.LineForceComponent.Moment33, numPoints);

                        section = sfProps.Section;
                        contour = section.Contour;
                        for (int j = 0; j < numPoints; j++)
                        {
                            for (int i = 0; i < contour[0].Length; i++)
                            {
                                stress = lsc.GetStressAtPoint(section, s1, m22, m33, j, contour[0][i].X, contour[0][i].Y);
                                if (stress > maxStress)
                                {
                                    maxStress = stress;
                                }
                                if (stress < minStress)
                                {
                                    minStress = stress;
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
        private string getLineForcesInfo(LineElement l, float xPos, RenderOptions.InternalForces iForces)
        {
            string force  = units.UnitName(Canguro.Model.UnitSystem.Units.Force);
            string moment = units.UnitName(Canguro.Model.UnitSystem.Units.Moment);

            string unitStr = force;

            float[] diagram;
            string  iForceName = string.Empty;
            int     numPoints  = Properties.Settings.Default.ElementForcesSegments;

            Model.Load.AbstractCase       ac        = model.Results.ActiveCase.AbstractCase;
            Model.Load.LineForceComponent component = Canguro.Model.Load.LineForceComponent.Axial;

            bool lastUndoEnabled       = model.Undo.Enabled;
            bool lastUnitSystemEnabled = Model.UnitSystem.UnitSystemsManager.Instance.Enabled;

            try
            {
                if (model.IsLocked)
                {
                    model.Undo.Enabled = false;
                }

                Model.UnitSystem.UnitSystemsManager.Instance.Enabled = false;

                Analysis.LineStressCalculator calc = new Analysis.LineStressCalculator();

                // Shear forces
                switch (iForces)
                {
                case RenderOptions.InternalForces.Sx:
                    component  = Canguro.Model.Load.LineForceComponent.Axial;
                    iForceName = Culture.Get("Axial");
                    break;

                case RenderOptions.InternalForces.Sy:
                    component  = Canguro.Model.Load.LineForceComponent.Shear22;
                    iForceName = Culture.Get("Shear") + " 22";
                    break;

                case RenderOptions.InternalForces.Sz:
                    component  = Canguro.Model.Load.LineForceComponent.Shear33;
                    iForceName = Culture.Get("Shear") + " 33";
                    break;

                // Moments
                case RenderOptions.InternalForces.Mx:
                    component  = Canguro.Model.Load.LineForceComponent.Torsion;
                    iForceName = Culture.Get("Torsion");
                    unitStr    = moment;
                    break;

                case RenderOptions.InternalForces.My:
                    component  = Canguro.Model.Load.LineForceComponent.Moment22;
                    iForceName = Culture.Get("Moment") + " 22";
                    unitStr    = moment;
                    break;

                case RenderOptions.InternalForces.Mz:
                    component  = Canguro.Model.Load.LineForceComponent.Moment33;
                    iForceName = Culture.Get("Moment") + " 33";
                    unitStr    = moment;
                    break;
                }

                // Get Diagram
                diagram = calc.GetForceAtPoint(ac, l, component, xPos);
            }
            finally
            {
                Model.UnitSystem.UnitSystemsManager.Instance.Enabled = lastUnitSystemEnabled;
                model.Undo.Enabled = lastUndoEnabled;
            }

            return("\n" + iForceName + ": " + units.FromInternational(diagram[1], Canguro.Model.UnitSystem.Units.Force).ToString("G3") + unitStr);
        }