Exemplo n.º 1
0
        public void DrawBendingMomentDiagram(DovDrawings g, ChartStyle cs)
        {
            DimensionLine dim = new DimensionLine();

            dim.Graphic     = g;
            g.TextBase      = TextBaseline.Bottom;
            g.TextAlignment = TextAlign.Left;
            g.TextFont      = "12px Arial";
            float[,] Am     = ca.AmAllMemeAction;
            float[]      El = ca.El;
            float        maxMom;
            float        minMom;
            List <float> mom    = new List <float>();
            float        length = 0;

            for (int i = 0; i < Am.GetLength(0); i++)
            {
                float ml = Am[i, 1]; float mr = -Am[i, 3];
                mom.Add(ml);
                mom.Add(mr);
                length += El[i];
            }
            maxMom  = Max(mom.ToArray());
            minMom  = Min(mom.ToArray());
            cs.YMax = maxMom;
            cs.YMin = minMom;
            cs.XMax = length;
            cs.XMin = 0;
            float  preLength = 0;
            float  m1;
            float  m2;
            float  mnext;
            PointF pt1;
            PointF pt2;
            PointF pt3;

            for (int i = 0; i < Am.GetLength(0); i++)
            {
                m1         = Am[i, 1]; m2 = -Am[i, 3];
                pt1        = new PointF(preLength, m1);
                preLength += El[i];
                pt2        = new PointF(preLength, m2);
                pt1        = cs.Point2D(pt1);
                pt2        = cs.Point2D(pt2);
                g.DrawLine(pt1, pt2);
                if (i < Am.GetLength(0) - 1)
                {
                    mnext = Am[i + 1, 1];
                    if (mnext == m2)
                    {
                        continue;
                    }
                    else
                    {
                        pt3 = new PointF(preLength, mnext);
                        pt3 = cs.Point2D(pt3);
                        g.DrawLine(pt2, pt3);
                    }
                }
            }
            PointF pt4 = new PointF(0, 0);
            PointF pt5 = new PointF(length, 0);

            pt4 = cs.Point2D(pt4);
            pt5 = cs.Point2D(pt5);
            g.DrawLine(pt4, pt5);
            float l1 = 0;

            for (int j = 0; j < nel; j++)
            {
                l1 += El[j];
            }
            float ml1 = -Am[nel - 1, 3];

            g.FillColorOpt = "black";
            PointF pt6 = new PointF(l1, ml1);

            pt6 = cs.Point2D(pt6);
            dim.DrawTextAtAngle(pt6, 0f, string.Format("{0} kNm", Math.Round(ml1, 2).ToString()));
            int   nelem = Am.GetLength(0);
            float mr1   = -Am[nelem - ner - 1, 3];
            float l2    = 0;

            for (int j = 0; j < nelem - ner; j++)
            {
                l2 += El[j];
            }
            pt6             = new PointF(l2, mr1);
            pt6             = cs.Point2D(pt6);
            g.TextBase      = TextBaseline.Bottom;
            g.TextAlignment = TextAlign.Left;
            dim.DrawTextAtAngle(pt6, 0f, string.Format("{0} kNm", Math.Round(mr1, 2).ToString()));
            float[] locAndMin = MinAndLocation(mom.ToArray());
            int     elno      = FindElement((int)locAndMin[0]);
            float   m         = locAndMin[1];

            l2 = 0;
            for (int j = 0; j <= elno; j++)
            {
                l2 += El[j];
            }
            g.TextBase      = TextBaseline.Hanging;
            g.TextAlignment = TextAlign.Right;
            pt6             = new PointF(l2, m);
            pt6             = cs.Point2D(pt6);
            dim.DrawTextAtAngle(pt6, 0f, string.Format("{0} kNm", Math.Round(m, 2).ToString()));
        }
Exemplo n.º 2
0
        public void DrawShearForceDiagram(DovDrawings g, ChartStyle cs)
        {
            DimensionLine dim = new DimensionLine();

            dim.Graphic     = g;
            g.TextBase      = TextBaseline.Hanging;
            g.TextAlignment = TextAlign.Left;
            g.TextFont      = "12px Arial";
            float[,] Am     = ca.AmAllMemeAction;
            float[]      El       = ca.El;
            float        maxShear = 0;
            float        minShear = 0;
            List <float> shear    = new List <float>();
            float        length   = 0;

            for (int i = 0; i < Am.GetLength(0); i++)
            {
                float vl = Am[i, 0]; float vr = -Am[i, 2];
                shear.Add(vl);
                shear.Add(vr);
                length += El[i];
            }
            maxShear = Max(shear.ToArray());
            minShear = Min(shear.ToArray());
            cs.YMax  = maxShear;
            cs.YMin  = minShear;
            cs.XMin  = 0;
            cs.XMax  = length;
            float  preLength = 0;
            float  v1        = 0;
            float  v2        = 0;
            float  vnext     = 0;
            PointF pt1       = new PointF();
            PointF pt2       = new PointF();
            PointF pt3       = new PointF();

            for (int i = 0; i < Am.GetLength(0); i++)
            {
                v1         = Am[i, 0]; v2 = -Am[i, 2];
                pt1        = new PointF(preLength, v1);
                preLength += El[i];
                pt2        = new PointF(preLength, v2);
                pt1        = cs.Point2D(pt1);
                pt2        = cs.Point2D(pt2);
                g.DrawLine(pt1, pt2);
                if (i < Am.GetLength(0) - 1)
                {
                    vnext = Am[i + 1, 0];
                    if (vnext == v2)
                    {
                        continue;
                    }
                    else
                    {
                        pt3 = new PointF(preLength, vnext);
                        pt3 = cs.Point2D(pt3);
                        g.DrawLine(pt2, pt3);
                    }
                }
            }
            PointF pt4 = new PointF(0, 0);
            PointF pt5 = new PointF(length, 0);

            pt4 = cs.Point2D(pt4);
            pt5 = cs.Point2D(pt5);
            g.DrawLine(pt4, pt5);
            float l1 = 0;

            for (int j = 0; j < nel; j++)
            {
                l1 += El[j];
            }
            float vl1 = -Am[nel - 1, 2];
            float vl2 = Am[nel, 0];

            g.FillColorOpt = "black";
            PointF pt6 = new PointF(l1, vl1);
            PointF pt7 = new PointF(l1, vl2);

            pt6 = cs.Point2D(pt6);
            dim.DrawTextAtAngle(pt6, 0f, string.Format("{0} kNm", Math.Round(vl1, 2).ToString()));
            pt7             = cs.Point2D(pt7);
            g.TextBase      = TextBaseline.Bottom;
            g.TextAlignment = TextAlign.Left;
            dim.DrawTextAtAngle(pt7, 0f, string.Format("{0} kNm", Math.Round(vl2, 2).ToString()));
            int   nelem = Am.GetLength(0);
            float vr1   = -Am[nelem - ner - 1, 2];
            float vr2   = Am[nelem - ner, 0];
            float l2    = 0;

            for (int j = 0; j < nelem - ner; j++)
            {
                l2 += El[j];
            }
            pt6             = new PointF(l2, vr1);
            pt7             = new PointF(l2, vr2);
            pt6             = cs.Point2D(pt6);
            pt7             = cs.Point2D(pt7);
            g.TextBase      = TextBaseline.Hanging;
            g.TextAlignment = TextAlign.Left;
            dim.DrawTextAtAngle(pt6, 0f, string.Format("{0} kNm", Math.Round(vr1, 2).ToString()));
            g.TextBase      = TextBaseline.Bottom;
            g.TextAlignment = TextAlign.Left;
            dim.DrawTextAtAngle(pt7, 0f, string.Format("{0} kNm", Math.Round(vr2, 2).ToString()));
        }