/// <summary>
        /// Get the geometry information of bottom reinforcement
        /// </summary>
        /// <returns>the gotten geometry information</returns>
        public RebarGeometry GetBottomRebar()
        {
            // sort the points of the swept profile
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            // Get the normal parameter for bottom reinforcement creation
            List <Autodesk.Revit.DB.XYZ> directions = GetRelatedVectors(m_points[0]);

            directions.Sort(comparer);
            Autodesk.Revit.DB.XYZ normal = directions[0];

            double offset      = BeamRebarData.BottomOffset;      //offset value of the reinforcement
            int    rebarNumber = BeamRebarData.BottomRebarNumber; //the number of the reinforcement
            // the spacing of the reinforcement
            double spacing = (m_beamWidth - 2 * offset) / (rebarNumber - 1);

            // Get the curve which define the shape of the bottom reinforcement curve
            List <Autodesk.Revit.DB.XYZ> movedPoints = OffsetPoints(offset);

            Autodesk.Revit.DB.XYZ startPoint = movedPoints[0]; //get the coordinate of startpoint
            //get the coordinate of endpoint
            Autodesk.Revit.DB.XYZ endPoint = GeomUtil.OffsetPoint(startPoint, m_drivingVector, m_beamLength);

            IList <Curve> curves = new List <Curve>(); //the profile of the bottom reinforcement

            curves.Add(Line.CreateBound(startPoint, endPoint));

            // return the reinforcement geometry information
            return(new RebarGeometry(normal, curves, rebarNumber, spacing));
        }
        /// <summary>
        /// Get the geometry information for top rebar
        /// </summary>
        /// <param name="location">indicate where top rebar is placed</param>
        /// <returns>the gotten geometry information</returns>
        public RebarGeometry GetTopRebar(TopRebarLocation location)
        {
            // sort the points of the swept profile
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            // Get the normal parameter for reinforcement creation
            List <Autodesk.Revit.DB.XYZ> directions = GetRelatedVectors(m_points[3]);

            directions.Sort(comparer);
            Autodesk.Revit.DB.XYZ normal = directions[1];

            double offset           = 0;                            //the offset from the beam surface to the reinforcement
            double startPointOffset = 0;                            // the offset of start point from swept profile
            double rebarLength      = m_beamLength / 3;             //the length of the reinforcement
            int    rebarNumber      = BeamRebarData.TopRebarNumber; //the number of the reinforcement

            // set offset and startPointOffset according to the location of reinforcement
            switch (location)
            {
            case TopRebarLocation.Start:       // top start reinforcement
                offset = BeamRebarData.TopEndOffset;
                break;

            case TopRebarLocation.Center:      // top center reinforcement
                offset           = BeamRebarData.TopCenterOffset;
                startPointOffset = m_beamLength / 3 - 0.5;
                rebarLength      = m_beamLength / 3 + 1;
                break;

            case TopRebarLocation.End:         // top end reinforcement
                offset           = BeamRebarData.TopEndOffset;
                startPointOffset = m_beamLength * 2 / 3;
                break;

            default:
                throw new Exception("The program should never go here.");
            }

            // Get the curve which define the shape of the top reinforcement curve
            List <Autodesk.Revit.DB.XYZ> movedPoints = OffsetPoints(offset);

            Autodesk.Revit.DB.XYZ startPoint = movedPoints[movedPoints.Count - 1];

            // offset the start point according startPointOffset
            startPoint = GeomUtil.OffsetPoint(startPoint, m_drivingVector, startPointOffset);
            // get the coordinate of endpoint
            Autodesk.Revit.DB.XYZ endPoint = GeomUtil.OffsetPoint(startPoint, m_drivingVector, rebarLength);
            IList <Curve>         curves   = new List <Curve>(); //the profile of the top reinforcement

            curves.Add(Line.CreateBound(startPoint, endPoint));

            // the spacing of the reinforcement
            double spacing = spacing = (m_beamWidth - 2 * offset) / (rebarNumber - 1);

            // return the reinforcement geometry information
            return(new RebarGeometry(normal, curves, rebarNumber, spacing));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the width of the column
        /// </summary>
        /// <returns>the width data</returns>
        private double GetColumnWidth()
        {
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            Autodesk.Revit.DB.XYZ        refPoint   = m_points[0];
            List <Autodesk.Revit.DB.XYZ> directions = GetRelatedVectors(refPoint);

            directions.Sort(comparer);

            return(GeomUtil.GetLength(directions[1]));
        }
        /// <summary>
        /// Get the down direction, which stand for the top hook direction
        /// </summary>
        /// <returns>the down direction</returns>
        public Autodesk.Revit.DB.XYZ GetDownDirection()
        {
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            Autodesk.Revit.DB.XYZ        refPoint   = m_points[3];
            List <Autodesk.Revit.DB.XYZ> directions = GetRelatedVectors(refPoint);

            directions.Sort(comparer);

            return(directions[0]);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get the geometry information of the transverse reinforcement
        /// </summary>
        /// <param name="location">the location of transverse rebar</param>
        /// <param name="spacing">the spacing value of the rebar</param>
        /// <returns>the got geometry information</returns>
        public RebarGeometry GetTransverseRebar(TransverseRebarLocation location, double spacing)
        {
            // sort the points of the swept profile
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            // the offset from the column surface to the reinforcement
            double offset = ColumnRebarData.TransverseOffset;
            //the length of the transverse reinforcement
            double rebarLength = 0;

            // get the origin and normal parameter for reinforcement creation
            Autodesk.Revit.DB.XYZ normal = m_drivingVector;
            double curveOffset           = 0;

            //set reinforcement length and origin according to the location of reinforcement
            switch (location)
            {
            case TransverseRebarLocation.Start:     // start transverse reinforcement
                rebarLength = m_columnHeight / 4;
                break;

            case TransverseRebarLocation.Center:    // center transverse reinforcement
                rebarLength = m_columnHeight / 2;
                curveOffset = m_columnHeight / 4 + (rebarLength % spacing) / 2;
                break;

            case TransverseRebarLocation.End:       // end transverse reinforcement
                rebarLength = m_columnHeight / 4;
                curveOffset = m_columnHeight - rebarLength + (rebarLength % spacing);
                break;

            default:
                throw new Exception("The program should never go here.");
            }

            // the number of the transverse reinforcement
            int rebarNumber = (int)(rebarLength / spacing) + 1;
            // get the profile of the transverse reinforcement
            List <Autodesk.Revit.DB.XYZ> movedPoints = OffsetPoints(offset);

            List <Autodesk.Revit.DB.XYZ> translatedPoints = new List <Autodesk.Revit.DB.XYZ>();

            foreach (Autodesk.Revit.DB.XYZ point in movedPoints)
            {
                translatedPoints.Add(GeomUtil.OffsetPoint(point, m_drivingVector, curveOffset));
            }

            IList <Curve> curves = new List <Curve>(); //the profile of the transverse reinforcement

            Autodesk.Revit.DB.XYZ first  = translatedPoints[0];
            Autodesk.Revit.DB.XYZ second = translatedPoints[1];
            Autodesk.Revit.DB.XYZ third  = translatedPoints[2];
            Autodesk.Revit.DB.XYZ fourth = translatedPoints[3];
            curves.Add(Line.CreateBound(first, second));
            curves.Add(Line.CreateBound(second, fourth));
            curves.Add(Line.CreateBound(fourth, third));
            curves.Add(Line.CreateBound(third, first));

            // return the reinforcement geometry information
            return(new RebarGeometry(normal, curves, rebarNumber, spacing));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get the geometry information of vertical reinforcement
        /// </summary>
        /// <param name="location">the location of vertical rebar</param>
        /// <param name="rebarNumber">the spacing value of the rebar</param>
        /// <returns>the got geometry information</returns>
        public RebarGeometry GetVerticalRebar(VerticalRebarLocation location, int rebarNumber)
        {
            // sort the points of the swept profile
            XYZHeightComparer comparer = new XYZHeightComparer();

            m_points.Sort(comparer);

            // Get the offset and reinforcement length
            double offset      = ColumnRebarData.VerticalOffset;
            double rebarLength = m_columnHeight + 3; //the length of reinforcement

            // Get the start point of the vertical reinforcement curve
            Autodesk.Revit.DB.XYZ startPoint = m_drivingLine.GetEndPoint(0);

            List <Autodesk.Revit.DB.XYZ> movedPoints = OffsetPoints(offset);

            movedPoints.Sort(comparer);

            Autodesk.Revit.DB.XYZ normal = new Autodesk.Revit.DB.XYZ(); // the normal parameter
            double rebarOffset           = 0;                           // rebar offset, equal to rebarNumber* spacing

            // get the normal, start point and reinforcement vertical offset
            switch (location)
            {
            case VerticalRebarLocation.East:   //vertical reinforcement in east
                normal      = new Autodesk.Revit.DB.XYZ(0, 1, 0);
                rebarOffset = m_columnWidth - 2 * offset;
                startPoint  = movedPoints[1];
                break;

            case VerticalRebarLocation.North: //vertical reinforcement in north
                normal      = new Autodesk.Revit.DB.XYZ(-1, 0, 0);
                rebarOffset = m_columnLength - 2 * offset;
                startPoint  = movedPoints[3];
                break;

            case VerticalRebarLocation.West: //vertical reinforcement in west
                normal      = new Autodesk.Revit.DB.XYZ(0, -1, 0);
                rebarOffset = m_columnWidth - 2 * offset;
                startPoint  = movedPoints[2];
                break;

            case VerticalRebarLocation.South: //vertical reinforcement in south
                normal      = new Autodesk.Revit.DB.XYZ(1, 0, 0);
                rebarOffset = m_columnLength - 2 * offset;
                startPoint  = movedPoints[0];
                break;

            default:
                break;
            }

            double spacing = rebarOffset / rebarNumber; //spacing value of the reinforcement

            Autodesk.Revit.DB.XYZ endPoint = GeomUtil.OffsetPoint(startPoint, m_drivingVector, rebarLength);

            IList <Curve> curves = new List <Curve>();  //profile of the reinforcement

            curves.Add(Line.CreateBound(startPoint, endPoint));

            // return the reinforcement geometry information
            return(new RebarGeometry(normal, curves, rebarNumber, spacing));
        }