/// <summary>
        /// Create the transverse rebars, according to the location of transverse rebars
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created rebar, return null if the creation is unsuccessful</returns>
        public Rebar FillTransverseBar(TransverseRebarLocation location)
        {
            // Get the geometry information which support rebar creation
            RebarGeometry geomInfo = new RebarGeometry();

            switch (location)
            {
            case TransverseRebarLocation.Start: // start transverse rebar
            case TransverseRebarLocation.End:   // end transverse rebar
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseEndSpacing);
                break;

            case TransverseRebarLocation.Center:// center transverse rebar
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseCenterSpacing);
                break;
            }

            RebarHookOrientation startHook = RebarHookOrientation.Right;
            RebarHookOrientation endHook   = RebarHookOrientation.Left;

            if (!GeomUtil.IsInRightDir(geomInfo.Normal))
            {
                startHook = RebarHookOrientation.Left;
                endHook   = RebarHookOrientation.Right;
            }

            // create the rebar
            return(PlaceRebars(m_transverseType, m_transverseHookType, m_transverseHookType,
                               geomInfo, startHook, endHook));
        }
Beispiel #2
0
        /// <summary>
        /// Create the transverse rebars, according to the transverse rebar location
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created rebar, return null if the creation is unsuccessful</returns>
        public Rebar FillTransverseBar(TransverseRebarLocation location)
        {
            // Get the geometry information which support rebar creation
            RebarGeometry geomInfo = new RebarGeometry();
            RebarBarType  barType  = null;

            switch (location)
            {
            case TransverseRebarLocation.Start: // start transverse rebar
            case TransverseRebarLocation.End:   // end transverse rebar
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseEndSpacing);
                barType  = m_transverseEndType;
                break;

            case TransverseRebarLocation.Center:// center transverse rebar
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseCenterSpacing);
                barType  = m_transverseCenterType;
                break;

            default:
                break;
            }

            // create the rebar
            return(PlaceRebars(barType, m_transverseHookType, m_transverseHookType,
                               geomInfo, RebarHookOrientation.Right, RebarHookOrientation.Left));
        }
Beispiel #3
0
        /// <summary>
        /// Create the transverse reinforcement, according to the transverse reinforcement location
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created reinforcement, return null if the creation is unsuccessful</returns>
        public RebarContainerItem FillTransverseItem(RebarContainer cont, TransverseRebarLocation location)
        {
            // Get the geometry information which support reinforcement creation
            RebarGeometry geomInfo = new RebarGeometry();
            RebarBarType  barType  = null;

            switch (location)
            {
            case TransverseRebarLocation.Start: // start transverse reinforcement
            case TransverseRebarLocation.End:   // end transverse reinforcement
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseEndSpacing);
                barType  = m_transverseEndType;
                break;

            case TransverseRebarLocation.Center:// center transverse reinforcement
                geomInfo = m_geometry.GetTransverseRebar(location, m_transverseCenterSpacing);
                barType  = m_transverseCenterType;
                break;

            default:
                break;
            }

            // create the container item
            return(PlaceContainerItem(cont, barType, m_transverseHookType, m_transverseHookType, geomInfo, RebarHookOrientation.Left, RebarHookOrientation.Left));
        }
Beispiel #4
0
        /// <summary>
        /// Get the geometry information of the transverse rebar
        /// </summary>
        /// <param name="location">the location of transverse rebar</param>
        /// <param name="spacing">the spacing value of the rebar</param>
        /// <returns>the gotted 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 rebar
            double offset = ColumnRebarData.TransverseOffset;
            //the length of the transverse rebar
            double rebarLength = 0;

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

            //set rebar length and origin according to the location of rebar
            switch (location)
            {
                case TransverseRebarLocation.Start:     // start transverse rebar
                    rebarLength = m_columnHeight / 4;
                    break;
                case TransverseRebarLocation.Center:    // center transverse rebar
                    rebarLength = m_columnHeight / 2;
                    curveOffset = m_columnHeight / 4 + (rebarLength % spacing) / 2;
                    break;
                case TransverseRebarLocation.End:       // end transverse rebar
                    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 rebar
            int rebarNumber = (int)(rebarLength / spacing) + 1;
            // get the profile of the transverse rebar
            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 rebar
            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.get_Bound(first, second));
            curves.Add(Line.get_Bound(second, fourth));
            curves.Add(Line.get_Bound(fourth, third));
            curves.Add(Line.get_Bound(third, first));

            // return the rebar geometry information
            return new RebarGeometry(normal, curves, rebarNumber, spacing);
        }
Beispiel #5
0
        /// <summary>
        /// Get the geometry information of the transverse rebar
        /// </summary>
        /// <param name="location">the location of transverse rebar</param>
        /// <param name="spacing">the spacing value of the rebar</param>
        /// <returns>the gotted 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 rebar
            double offset = ColumnRebarData.TransverseOffset;
            //the length of the transverse rebar
            double rebarLength = 0;

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

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

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

            case TransverseRebarLocation.End:       // end transverse rebar
                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 rebar
            int rebarNumber = (int)(rebarLength / spacing) + 1;
            // get the profile of the transverse rebar
            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 rebar

            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 rebar geometry information
            return(new RebarGeometry(normal, curves, rebarNumber, spacing));
        }
Beispiel #6
0
        /// <summary>
        /// Create the transverse rebars, according to the transverse rebar location
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created rebar, return null if the creation is unsuccessful</returns>
        public Rebar FillTransverseBar(TransverseRebarLocation location)
        {
            // Get the geometry information which support rebar creation
             RebarGeometry geomInfo = new RebarGeometry();
             RebarBarType barType = null;
             switch (location)
             {
            case TransverseRebarLocation.Start: // start transverse rebar
            case TransverseRebarLocation.End:   // end transverse rebar
               geomInfo = m_geometry.GetTransverseRebar(location, m_transverseEndSpacing);
               barType = m_transverseEndType;
               break;
            case TransverseRebarLocation.Center:// center transverse rebar
               geomInfo = m_geometry.GetTransverseRebar(location, m_transverseCenterSpacing);
               barType = m_transverseCenterType;
               break;
            default:
               break;
             }

             // create the rebar
             return PlaceRebars(barType, m_transverseHookType, m_transverseHookType,
                                         geomInfo, RebarHookOrientation.Right, RebarHookOrientation.Left);
        }
Beispiel #7
0
        /// <summary>
        /// Create the transverse rebars, according to the location of transverse rebars
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created rebar, return null if the creation is unsuccessful</returns>
        public Rebar FillTransverseBar(TransverseRebarLocation location)
        {
            // Get the geometry information which support rebar creation
             RebarGeometry geomInfo = new RebarGeometry();
             switch (location)
             {
            case TransverseRebarLocation.Start: // start transverse rebar
            case TransverseRebarLocation.End:   // end transverse rebar
               geomInfo = m_geometry.GetTransverseRebar(location, m_transverseEndSpacing);
               break;
            case TransverseRebarLocation.Center:// center transverse rebar
               geomInfo = m_geometry.GetTransverseRebar(location, m_transverseCenterSpacing);
               break;
             }

             RebarHookOrientation startHook = RebarHookOrientation.Right;
             RebarHookOrientation endHook = RebarHookOrientation.Left;
             if (!GeomUtil.IsInRightDir(geomInfo.Normal))
              {
              startHook = RebarHookOrientation.Left;
              endHook = RebarHookOrientation.Right;
              }

             // create the rebar
             return PlaceRebars(m_transverseType, m_transverseHookType, m_transverseHookType,
                                         geomInfo, startHook, endHook);
        }
        /// <summary>
        /// Get the geometry information of transverse reinforcement
        /// </summary>
        /// <param name="location">indicate which part of transverse rebar</param>
        /// <param name="spacing">the spacing of the rebar</param>
        /// <returns>the gotten 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 beam surface to the reinforcement
            double offset = BeamRebarData.TransverseOffset;
            // the offset from the beam end to the transverse end
            double endOffset = BeamRebarData.TransverseEndOffset;
            // the offset between two transverses
            double betweenOffset = BeamRebarData.TransverseSpaceBetween;
            // the length of the transverse reinforcement
            double rebarLength = (m_beamLength - 2 * endOffset - 2 * betweenOffset) / 3;
            // the number of the transverse reinforcement
            int rebarNumber = (int)(rebarLength / spacing) + 1;

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

            //judge the coordinate of transverse reinforcement according to the location
            switch (location)
            {
            case TransverseRebarLocation.Start:        // start transverse reinforcement
                curveOffset = endOffset;
                break;

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

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

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

            // get the profile of the transverse reinforcement
            List <Autodesk.Revit.DB.XYZ> movedPoints = OffsetPoints(offset);

            // Translate curves points
            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>();

            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));
        }