Esempio n. 1
0
        /// <summary>The create splitted reinforcement bars.</summary>
        /// <param name="position">The position.</param>
        /// <param name="rebarPoints">The reinforcement bar points.</param>
        /// <param name="splitRebarSet">The split reinforcement bar set.</param>
        /// <param name="finalRebarLength">The final reinforcement bar length.</param>
        /// <returns>The System.Boolean.</returns>
        private bool CreateSplittedRebars(FirstOrLastEnum position, ArrayList rebarPoints, ArrayList splitRebarSet, out double finalRebarLength)
        {
            var result = false;

            finalRebarLength = 0.0;

            var singleRebarCreator = new CreateSingleRebar(this.originalRebar);
            var newRebar           = singleRebarCreator.GetSingleRebar(rebarPoints);

            if (newRebar != null)
            {
                // Rounding the lenth of the rebar
                var reportLength = 0.0;
                newRebar.Insert();
                newRebar.GetReportProperty("LENGTH", ref reportLength);
                newRebar.Delete();

                var rebarLength = Distance.PointToPoint(newRebar.Polygon.Points[1] as Point, newRebar.Polygon.Points[0] as Point);

                if (rebarLength > reportLength)
                {
                    var rebarVector = new Vector((Point)newRebar.Polygon.Points[1] - (Point)newRebar.Polygon.Points[0]);
                    rebarVector.Normalize(rebarLength + AdditionalRebarLength);
                    rebarPoints[1] = (Point)rebarPoints[0] + rebarVector;
                    newRebar       = singleRebarCreator.GetSingleRebar(rebarPoints);
                }

                if (newRebar != null)
                {
                    finalRebarLength = Distance.PointToPoint(
                        newRebar.Polygon.Points[1] as Point, newRebar.Polygon.Points[0] as Point);

                    if (position == FirstOrLastEnum.FirstRebar)
                    {
                        newRebar.EndHook.Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK;
                    }
                    else if (position == FirstOrLastEnum.MiddleRebar)
                    {
                        newRebar.StartHook.Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK;
                        newRebar.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.NO_HOOK;
                    }
                    else if (position == FirstOrLastEnum.LastRebar)
                    {
                        newRebar.StartHook.Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK;
                    }

                    splitRebarSet.Add(newRebar);
                    result = true;
                }
            }

            return(result);
        }
Esempio 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);
        }