Beispiel #1
0
        public static CompositeGeometry Layout(this PerimeterReinforcement reinforcement, RectangleProfile dimensions, ConcreteSection property)
        {
            double       h           = dimensions.Height;
            double       w           = dimensions.Width;
            double       tieDiameter = property.TieDiameter();
            List <Point> location    = new List <Point>();

            int    topCount  = 0;
            int    sideCount = 0;
            double tieOffset = tieDiameter + Math.Cos(Math.PI / 4) * (2 * tieDiameter * (Math.Sqrt(2) - 1) + reinforcement.Diameter / 2) - reinforcement.Diameter / 2;

            switch (reinforcement.Pattern)
            {
            case ReinforcementPattern.Equispaced:
                topCount  = (int)(reinforcement.BarCount * w / (2 * w + 2 * h) + 1);
                sideCount = (reinforcement.BarCount - 2 * topCount) / 2 + 2;
                break;

            case ReinforcementPattern.Horizontal:
                topCount  = reinforcement.BarCount / 2;
                sideCount = 2;
                break;

            case ReinforcementPattern.Vertical:
                topCount  = 2;
                sideCount = reinforcement.BarCount / 2;
                break;
            }
            double verticalSpacing = (h - 2 * property.MinimumCover - reinforcement.Diameter - 2 * tieOffset) / (sideCount - 1);
            double depth           = property.MinimumCover + reinforcement.Diameter / 2 + tieOffset;

            for (int i = 0; i < sideCount; i++)
            {
                int    count        = topCount;
                double currentDepth = depth + i * verticalSpacing;
                if (i > 0 && i < sideCount - 1)
                {
                    count = 2;
                }
                List <IGeometry> layout = ((CompositeGeometry) new LayerReinforcement {
                    Diameter = reinforcement.Diameter, Depth = currentDepth, BarCount = count
                }.Layout(property)).Elements;

                foreach (IGeometry geom in layout)
                {
                    location.Add(geom as Point);
                }
            }
            return(new CompositeGeometry {
                Elements = location.ToList <IGeometry>()
            });
        }
Beispiel #2
0
        public static CompositeGeometry Layout(this LayerReinforcement reinforcement, ConcreteSection property, bool extrude = false)
        {
            BoundingBox bounds = new BoundingBox();

            foreach (ICurve curve in property.SectionProfile.Edges)
            {
                bounds += curve.IBounds();
            }

            double relativeDepth = reinforcement.IsVertical ? bounds.Max.X - reinforcement.Depth : bounds.Max.Y - reinforcement.Depth;

            double[] range       = null;
            double   tieDiameter = property.TieDiameter();

            if (property.SectionProfile.Shape == ShapeType.Rectangle && tieDiameter > 0)
            {
                //TODO: Check this part
                tieDiameter = tieDiameter + Math.Cos(Math.PI / 4) * (2 * tieDiameter * (Math.Sqrt(2) - 1) + reinforcement.Diameter / 2) - reinforcement.Diameter / 2;
            }
            double width = reinforcement.IsVertical ? property.SectionProfile.DepthAt(relativeDepth, ref range) : property.SectionProfile.WidthAt(relativeDepth, ref range);

            double spacing = (width - 2 * property.MinimumCover - reinforcement.Diameter - 2 * tieDiameter) / (reinforcement.BarCount - 1.0);
            double start   = range != null && range.Length > 0 ? range[0] : 0;

            List <Point> location = new List <Point>();

            for (int i = 0; i < reinforcement.BarCount; i++)
            {
                double x = reinforcement.IsVertical ? relativeDepth : property.MinimumCover + reinforcement.Diameter / 2 + tieDiameter + spacing * i + start;
                double y = reinforcement.IsVertical ? property.MinimumCover + reinforcement.Diameter / 2 + spacing * i + tieDiameter + start : relativeDepth;

                location.Add(new Point {
                    X = x, Y = y, Z = 0
                });
            }

            return(new CompositeGeometry {
                Elements = location.ToList <IGeometry>()
            });


            //GeometryGroup<Point> location = new GeometryGroup<Point>();
            //for (int i = 0; i < BarCount; i++)
            //{
            //    double x = IsVertical ? relativeDepth : property.MinimumCover + Diameter / 2 + tieDiameter + spacing * i + start;
            //    double y = IsVertical ? property.MinimumCover + Diameter / 2 + spacing * i + tieDiameter + start : relativeDepth;

            //    location.Add(new Point { X = x, Y = y, Z = 0 });
            //}
            //return location;
        }