Beispiel #1
0
        protected void DrawRebar(DovDrawings graphic, ChartStyle cs)
        {
            float  x;
            float  y;
            float  radius;
            float  limitXNeg = -secRec.Width * 0.5f;
            float  limitXPos = secRec.Width * 0.5f;
            float  limitYNeg = -secRec.Height * 0.5f;
            float  limitYPos = secRec.Height * 0.5f;
            PointF loc;

            rebarLocLibrary = rebarLocLibrary.OrderBy(reb => reb.LocY).ToList();
            float locY  = 0;
            bool  start = true;

            RebarLocSorted.Clear();
            foreach (DovRebarLocation bars in rebarLocLibrary)
            {
                if (start)
                {
                    locY  = bars.LocY;
                    start = false;
                }
                if (locY == bars.LocY)
                {
                    if (!RebarLocSorted.ContainsKey(locY))
                    {
                        Stack <DovRebarLocation> bar = new Stack <DovRebarLocation>();
                        bar.Push(bars);
                        RebarLocSorted[locY] = bar;
                    }
                    else
                    {
                        RebarLocSorted[locY].Push(bars);
                    }
                }
                else
                {
                    locY = bars.LocY;
                    Stack <DovRebarLocation> bar = new Stack <DovRebarLocation>();
                    bar.Push(bars);
                    RebarLocSorted[locY] = bar;
                }
                x = bars.LocX;
                y = bars.LocY;
                if ((x < limitXNeg || x > limitXPos) || (y < limitYNeg || y > limitYPos))
                {
                    RebarLocationMessage = "Error: location is not within the boundary of the section";
                    RebarLocMsgColor     = "red";
                    continueDesign       = false;
                    break;
                }
                else
                {
                    graphic.DrwColor      = "white";
                    graphic.LineThickness = 2;
                    graphic.FillColorOpt  = "red";
                    RebarLocMsgColor      = "";
                    RebarLocationMessage  = "Enter Location of rebars";
                    radius = bars.Diameter * 0.5f;
                    radius = cs.ScaleX(radius);
                    loc    = cs.Point2D(new PointF(x, y));
                    graphic.DrawArc(loc.X, loc.Y, radius, 0, 2 * Math.PI);
                    continueDesign = true;
                }

                foreach (KeyValuePair <float, Stack <DovRebarLocation> > rebar in RebarLocSorted)
                {
                    re = rebar.Value.ToArray();
                    for (int i = 0; i < re.Length - 1; i++)
                    {
                        float xl = re[i].LocX;
                        for (int j = i + 1; j < re.Length; j++)
                        {
                            if (xl == re[j].LocX)
                            {
                                RebarLocationMessage = "Warning: There are dublicate of bars, one of them will be used.";
                                RebarLocMsgColor     = "red";
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected void IsoFootDetailOnElev()
        {
            DimensionLine dim = new DimensionLine();

            DetailingGraphics = new DovDrawings(detailingContext);
            detailingChart    = new ChartStyle();
            dim.Graphic       = DetailingGraphics;
            float footW = DetailingCanvWidth;
            float footH = 0.4f * DetailingCanvHeight;

            detailingChart.ChartArea = new RectangleF(0, 0, footW, footH);
            float startX = 0;
            float startY = 0.6f * DetailingCanvHeight;

            DetailingGraphics.Clear(startX, startY, footW, footH);
            float limit = footingData.Width;
            float xMax  = 0.5f * limit;
            float xMin  = -0.5f * limit;
            float yMax  = 0.5f * footingData.Thickness;
            float yMin  = -2 * footingData.Thickness;

            SetGraphicLayout(footW, footH, startX, startY, detailingChart, new float[] { xMin, xMax, yMin, yMax });

            float  thick = footingData.Thickness;
            float  w     = footingData.Width;
            float  l     = footingData.Length;
            float  c     = footingData.Cover * 0.1f;
            float  dia   = footingData.Dia;
            float  locX  = footingData.ColLocX;
            float  locY  = footingData.ColLocY;
            float  cw    = footingData.ColumnWidth;
            float  cl    = footingData.ColumnLength;
            PointF fPt1  = new PointF(-0.5f * footingData.Width, 0f);
            PointF fPt2  = new PointF(0.5f * footingData.Width, -footingData.Thickness);

            fPt1 = detailingChart.Point2D(fPt1);
            fPt2 = detailingChart.Point2D(fPt2);
            DetailingGraphics.FillColorOpt = "lightslategrey";
            DetailingGraphics.FillColor(fPt1, fPt2);
            DetailingGraphics.DrwColor = "dimgrey";
            //await DetailingGraphics.DrawRecAsync(fPt1, fPt2);
            PointF pt1 = new PointF(-0.5f * w, 0f);
            PointF pt2 = new PointF(locX - 0.5f * w - 0.5f * cw, 0);
            PointF pt3 = new PointF(locX - 0.5f * w - 0.5f * cw, 0.5f * thick);
            PointF pt4 = new PointF(locX - 0.5f * w + 0.5f * cw, 0.5f * thick);
            PointF pt5 = new PointF(locX - 0.5f * w + 0.5f * cw, 0);
            PointF pt6 = new PointF(0.5f * w, 0);
            PointF pt7 = new PointF(0.5f * w, -thick);
            PointF pt8 = new PointF(-0.5f * w, -thick);

            PointF[] pts = new PointF[] { pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8 };
            for (int i = 0; i < pts.Length; i++)
            {
                pts[i] = detailingChart.Point2D(pts[i]);
            }
            DetailingGraphics.FillPolygone(pts);
            dim.DrawDimLineAligned(pts[0], pts[7], thick.ToString());
            dim.DrawDimLineAligned(pts[6], pts[7], w.ToString());
            dim.DimDir = DimensionLine.DimensionDirection.right;
            DetailingGraphics.TextBase = TextBaseline.Bottom;
            dim.DrawDimLineAligned(pts[0], pts[1], (footingData.ColLocX - 0.5f * cw).ToString());
            DetailingGraphics.DrwColor = "red";
            pt1 = new PointF(-0.5f * w + c, -thick + c);
            pt2 = new PointF(0.5f * w - c, -thick + c);
            pt3 = new PointF(pt1.X, pt1.Y + thick - 2 * c);
            pt4 = new PointF(pt2.X, pt2.Y + thick - 2 * c);
            pt1 = detailingChart.Point2D(pt1);
            pt2 = detailingChart.Point2D(pt2);
            DetailingGraphics.DrawLine(pt1, pt2);
            pt3 = detailingChart.Point2D(pt3);
            pt4 = detailingChart.Point2D(pt4);
            DetailingGraphics.DrawLine(pt1, pt3);
            DetailingGraphics.DrawLine(pt2, pt4);
            //Drawing column bars
            pt5 = new PointF(locX - 0.5f * w - 0.5f * cw + c, -thick + c + 3 * dia * 0.1f);
            pt6 = new PointF(locX - 0.5f * w - 0.5f * cw + c, 0.5f * thick);
            pt7 = new PointF(locX - 0.5f * w + 0.5f * cw - c, -thick + c + 3 * dia * 0.1f);
            pt8 = new PointF(locX - 0.5f * w + 0.5f * cw - c, 0.5f * thick);
            //47 factor for development length
            PointF pt9  = new PointF(pt5.X - 47 * dia * 0.1f, pt5.Y);
            PointF pt10 = new PointF(pt7.X + 47 * dia * 0.1f, pt7.Y);

            pt9  = detailingChart.Point2D(pt9);
            pt10 = detailingChart.Point2D(pt10);
            pt5  = detailingChart.Point2D(pt5);
            pt6  = detailingChart.Point2D(pt6);
            pt7  = detailingChart.Point2D(pt7);
            pt8  = detailingChart.Point2D(pt8);
            DetailingGraphics.DrawLine(pt5, pt6);
            DetailingGraphics.DrawLine(pt7, pt8);
            DetailingGraphics.DrawLine(pt5, pt9);
            DetailingGraphics.DrawLine(pt7, pt10);
            pt1 = detailingChart.Point2D(new PointF(-0.5f * w + c, -2 * thick));
            pt2 = detailingChart.Point2D(new PointF(0.5f * w - c, -2 * thick));
            pt3 = detailingChart.Point2D(new PointF(-0.5f * w + c, -thick - 2 * c));
            pt4 = detailingChart.Point2D(new PointF(0.5f * w - c, -thick - 2 * c));
            DetailingGraphics.DrawLine(pt1, pt2);
            DetailingGraphics.DrwColor = "dimgrey";
            dim.DimDir = DimensionLine.DimensionDirection.left;
            DetailingGraphics.TextBase = TextBaseline.Hanging;
            dim.DrawDimLineAligned(pt1, pt2, (w - 2 * c).ToString());
            DetailingGraphics.DrwColor = "red";
            DetailingGraphics.DrawLine(pt1, pt3);
            dim.DimDir = DimensionLine.DimensionDirection.right;
            DetailingGraphics.DrwColor = "dimgrey";
            DetailingGraphics.TextBase = TextBaseline.Bottom;
            dim.DrawDimLineAligned(pt1, pt3, (thick - 2 * c).ToString());
            DetailingGraphics.DrwColor = "red";
            DetailingGraphics.DrawLine(pt2, pt4);
            float barArea    = (float)Math.PI * dia * dia / 4;
            int   nbar       = (int)Math.Ceiling(fDesign.Asy / barArea);
            int   barSpacing = 1000 / nbar;

            barSpacing = barSpacing.RoundDown() / 10;
            for (int i = (int)(2 * c); i < (w - 2 * c); i += barSpacing)
            {
                float  start = -0.5f * (w - 2 * c);
                float  y     = -(thick - c - 1.5f * dia * 0.1f);
                float  x     = start + i;
                PointF pt    = new PointF(x, y);
                pt = detailingChart.Point2D(pt);
                DetailingGraphics.DrawArc(pt.X, pt.Y, 1.5f * dia * 0.1f, 0, 2 * Math.PI);
            }
        }