Ejemplo n.º 1
0
        /// <summary>The split rebar.</summary>
        /// <param name="originalRebar">The original rebar.</param>
        /// <param name="section">The section.</param>
        /// <param name="barPosition">The bar position.</param>
        /// <param name="remainingOffset">The remaining offset.</param>
        /// <param name="splitRebarSet">The split reinforcement bar set.</param>
        /// <returns>The System.Boolean.</returns>
        private bool SplitRebar(
            SingleRebar originalRebar,
            SpliceSection section,
            BarPositions barPosition,
            ref double remainingOffset,
            out ArrayList splitRebarSet)
        {
            var    result = true;
            double maxLength, totalOffset, remainingLength, hookLength, incrementalLength = 0.0;

            splitRebarSet = new ArrayList();
            var totalRebarLength = Distance.PointToPoint((Point)originalRebar.Polygon.Points[1], (Point)originalRebar.Polygon.Points[0]);
            var splitPattern     = new Vector((Point)originalRebar.Polygon.Points[1] - (Point)originalRebar.Polygon.Points[0]);

            this.GetRebarMaximumLength(FirstOrLastEnum.MiddleRebar, out maxLength);
            this.CalculateTotalOffset(
                totalRebarLength,
                section,
                barPosition,
                remainingOffset,
                out totalOffset,
                out remainingLength,
                out hookLength);

            for (var ii = 0; incrementalLength + this.GetRebarLengthEpsilon() < totalRebarLength; ii++)
            {
                if (ii == 0)
                {
                    result &= this.CreateStartRebar(originalRebar, splitPattern, splitRebarSet, totalOffset, hookLength, ref incrementalLength);
                }
                else if (incrementalLength + maxLength + this.GetRebarLengthEpsilon() < totalRebarLength)
                {
                    var centralBarsCount = (int)Math.Floor(totalRebarLength / maxLength);

                    if (this.splitData.SpliceSymmetry == 2 && barPosition == BarPositions.First && centralBarsCount > 1 &&
                        incrementalLength < totalRebarLength / 2.0 &&
                        incrementalLength + maxLength > totalRebarLength / 2.0)
                    {
                        result &= this.CreateDifferentMiddleRebarInCenterSymmetry(remainingLength, originalRebar, ref splitPattern, ref incrementalLength, ref splitRebarSet);
                    }
                    else
                    {
                        result &= this.CreateMiddleRebar(originalRebar, splitPattern, splitRebarSet, ref incrementalLength);
                    }
                }
                else
                {
                    double lastSegment;
                    result &= this.CreateEndRebar(originalRebar, maxLength, splitPattern, splitRebarSet, ref incrementalLength, out lastSegment);

                    if (barPosition == BarPositions.First)
                    {
                        remainingOffset = lastSegment;
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>The split rebar.</summary>
        /// <param name="originalRebar">The original rebar.</param>
        /// <param name="section">The section.</param>
        /// <param name="barPosition">The bar position.</param>
        /// <param name="rebarSegmentLengths">Lengths of all rebars segments.</param>
        /// <param name="remainingOffset">The remaining offset.</param>
        /// <param name="splitRebarSet">The split reinforcement bar set.</param>
        /// <returns>The System.Boolean.</returns>
        private bool SplitRebar(
            SingleRebar originalRebar,
            SpliceSection section,
            BarPositions barPosition,
            List <double> rebarSegmentLengths,
            ref double remainingOffset,
            out ArrayList splitRebarSet)
        {
            bool   result = true;
            double maxLength;
            double totalOffset;
            double remainingLength;
            double hookLength;
            double incrementalLength = 0.0;
            double totalRebarLength  = 0.0;
            double previousLength    = 0.0;

            splitRebarSet = new ArrayList();

            ArrayList previousPoints = new ArrayList();

            foreach (double length in rebarSegmentLengths)
            {
                totalRebarLength += length;
            }

            CreateSingleRebar createSingleRebar = new CreateSingleRebar(originalRebar);

            for (int jj = 0; jj < originalRebar.Polygon.Points.Count - 1; jj++)
            {
                Vector splitPattern = new Vector((Point)originalRebar.Polygon.Points[jj + 1] - (Point)originalRebar.Polygon.Points[jj]);

                this.GetRebarMaximumLength(FirstOrLastEnum.MiddleRebar, out maxLength);
                this.CalculateTotalOffset(
                    totalRebarLength,
                    section,
                    barPosition,
                    remainingOffset,
                    out totalOffset,
                    out remainingLength,
                    out hookLength);

                ArrayList splitRebarSegment = new ArrayList();
                ArrayList rebarPoints       = new ArrayList();
                rebarPoints.Add(originalRebar.Polygon.Points[jj]);
                rebarPoints.Add(originalRebar.Polygon.Points[jj + 1]);

                SingleRebar segmentToSplit = createSingleRebar.GetSingleRebar(rebarPoints);

                if ((previousLength + rebarSegmentLengths[jj]) > maxLength)
                {
                    for (int ii = 0; incrementalLength + this.GetRebarLengthEpsilon() < totalRebarLength; ii++)
                    {
                        if (ii == 0 && jj == 0)
                        {
                            result &= this.CreateStartRebar(segmentToSplit, splitPattern, splitRebarSegment, totalOffset, hookLength, ref incrementalLength);
                        }
                        else if (incrementalLength + maxLength + this.GetRebarLengthEpsilon() < totalRebarLength)
                        {
                            int centralBarsCount = (int)Math.Floor(totalRebarLength / maxLength);

                            if (this.splitData.SpliceSymmetry == 2 &&
                                barPosition == BarPositions.First &&
                                centralBarsCount > 1 &&
                                incrementalLength < totalRebarLength / 2.0 &&
                                incrementalLength + maxLength > totalRebarLength / 2.0)
                            {
                                result &= this.CreateDifferentMiddleRebarInCenterSymmetry(remainingLength, segmentToSplit, ref splitPattern, ref incrementalLength, ref splitRebarSegment);
                            }
                            else
                            {
                                result &= this.CreateMiddleRebar(segmentToSplit, splitPattern, splitRebarSegment, ref incrementalLength);
                            }
                        }
                        else
                        {
                            double lastSegment;
                            double segmentLength;

                            if (incrementalLength < maxLength + DistanceEpsilon)
                            {
                                segmentLength = rebarSegmentLengths[jj] - (maxLength - incrementalLength);
                            }
                            else
                            {
                                int multiplayer = (int)(incrementalLength / maxLength);
                                segmentLength = rebarSegmentLengths[jj] - ((multiplayer + 1) * maxLength - incrementalLength);
                            }

                            result           &= this.CreateEndRebar(segmentToSplit, maxLength, splitPattern, splitRebarSegment, ref segmentLength, out lastSegment);
                            incrementalLength = segmentLength;

                            if (barPosition == BarPositions.First)
                            {
                                remainingOffset = lastSegment;
                            }
                        }
                    }
                }
                else
                {
                    incrementalLength += rebarSegmentLengths[jj];
                    previousLength    += rebarSegmentLengths[jj];
                    this.AddRebarPoint(originalRebar.Polygon.Points[jj] as Point, previousPoints);
                    this.AddRebarPoint(originalRebar.Polygon.Points[jj + 1] as Point, previousPoints);

                    DrawPoint(originalRebar.Polygon.Points[jj] as Point, jj.ToString());
                    DrawPoint(originalRebar.Polygon.Points[jj + 1] as Point, (jj + 1).ToString());
                }

                if (splitRebarSegment.Count != 0 && previousPoints.Count > 0)
                {
                    DrawPoint(((SingleRebar)splitRebarSegment[0]).Polygon.Points[0] as Point, "SP" + jj.ToString());
                    DrawPoint(((SingleRebar)splitRebarSegment[0]).Polygon.Points[1] as Point, "SP" + (jj + 1).ToString());

                    previousPoints.Add(((SingleRebar)splitRebarSegment[0]).Polygon.Points[0]);
                    SingleRebar previousBar = createSingleRebar.GetSingleRebar(previousPoints);
                    splitRebarSegment.Insert(0, previousBar);

                    previousPoints.Clear();
                    previousLength = 0.0;
                }

                splitRebarSet.AddRange(splitRebarSegment);
            }

            return(result);
        }