Exemplo n.º 1
0
        /// <summary>
        /// Get the hook orient of the top reinforcement
        /// </summary>
        /// <param name="geomInfo">the rebar geometry support information</param>
        /// <param name="location">the location of top rebar</param>
        /// <returns>the hook orient of the top hook</returns>
        private RebarHookOrientation GetTopHookOrient(RebarGeometry geomInfo, TopRebarLocation location)
        {
            // Top center rebar doesn't need hook.
            if (TopRebarLocation.Center == location)
            {
                throw new Exception("Center top reinforcement doesn't have any hook.");
            }

            // Get the hook direction, reinforcement normal and reinforcement line
            Autodesk.Revit.DB.XYZ hookVec = m_geometry.GetDownDirection();
            Autodesk.Revit.DB.XYZ normal  = geomInfo.Normal;
            Line rebarLine = geomInfo.Curves[0] as Line;

            // get the top start hook orient
            if (TopRebarLocation.Start == location)
            {
                Autodesk.Revit.DB.XYZ curveVec = GeomUtil.SubXYZ(rebarLine.GetEndPoint(0), rebarLine.GetEndPoint(1));
                return(GeomUtil.GetHookOrient(curveVec, normal, hookVec));
            }
            else // get the top end hook orient
            {
                Autodesk.Revit.DB.XYZ curveVec = GeomUtil.SubXYZ(rebarLine.GetEndPoint(0), rebarLine.GetEndPoint(1));
                return(GeomUtil.GetHookOrient(curveVec, normal, hookVec));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create the reinforcement at the top of beam, according to the top 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>
        private RebarContainerItem FillTopItem(RebarContainer cont, TopRebarLocation location)
        {
            //get the geometry information of the reinforcement
            RebarGeometry geomInfo = m_geometry.GetTopRebar(location);

            RebarHookType        startHookType = null;                       //the start hook type of the reinforcement
            RebarHookType        endHookType   = null;                       // the end hook type of the reinforcement
            RebarBarType         rebarType     = null;                       // the reinforcement type
            RebarHookOrientation startOrient   = RebarHookOrientation.Right; // the start hook orient
            RebarHookOrientation endOrient     = RebarHookOrientation.Left;  // the end hook orient

            // decide the reinforcement type, hook type and hook orient according to location
            switch (location)
            {
            case TopRebarLocation.Start:
                startHookType = m_topHookType;                        // start hook type
                rebarType     = m_topEndType;                         // reinforcement type
                startOrient   = GetTopHookOrient(geomInfo, location); // start hook orient
                break;

            case TopRebarLocation.Center:
                rebarType = m_topCenterType;   // reinforcement type
                break;

            case TopRebarLocation.End:
                endHookType = m_topHookType;                        // end hook type
                rebarType   = m_topEndType;                         // reinforcement type
                endOrient   = GetTopHookOrient(geomInfo, location); // end hook orient
                break;
            }

            // create the container item
            return(PlaceContainerItem(cont, rebarType, startHookType, endHookType, geomInfo, startOrient, endOrient));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create the transverse reinforcement, according to the location of transverse bars
        /// </summary>
        /// <param name="location">location of rebar which need to be created</param>
        /// <returns>the created container item, 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();

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

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

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

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

            // create the container item
            return(PlaceContainerItem(cont, m_transverseType, m_transverseHookType, m_transverseHookType, geomInfo, startHook, endHook));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Create the reinforcement at the bottom of beam
        /// </summary>
        /// <returns>true if the creation is successful, otherwise false</returns>
        public bool FillBottomItems(RebarContainer cont)
        {
            // get the geometry information of the bottom reinforcement
            RebarGeometry geomInfo = m_geometry.GetBottomRebar();

            // create the container item
            RebarContainerItem item = PlaceContainerItem(cont, m_bottomType, null, null, geomInfo, RebarHookOrientation.Left, RebarHookOrientation.Left);

            return(null != item);
        }
Exemplo n.º 6
0
        /// <summary>
        /// A wrap function which used to create the reinforcement.
        /// </summary>
        /// <param name="rebarType">The element of RebarBarType</param>
        /// <param name="startHook">The element of start RebarHookType</param>
        /// <param name="endHook">The element of end RebarHookType</param>
        /// <param name="geomInfo">The goemetry information of the rebar</param>
        /// <param name="startOrient">An Integer defines the orientation of the start hook</param>
        /// <param name="endOrient">An Integer defines the orientation of the end hook</param>
        /// <returns></returns>
        protected RebarContainerItem PlaceContainerItem(RebarContainer cont, RebarBarType rebarType, RebarHookType startHook, RebarHookType endHook,
                                                        RebarGeometry geomInfo, RebarHookOrientation startOrient, RebarHookOrientation endOrient)
        {
            Autodesk.Revit.DB.XYZ normal = geomInfo.Normal; // the direction of reinforcement distribution
            IList <Curve>         curves = geomInfo.Curves; // the shape of the reinforcement curves

            RebarContainerItem item = cont.AppendItemFromCurves(RebarStyle.Standard, rebarType, startHook, endHook, normal, curves, startOrient, endOrient, false, true);

            if (2 < geomInfo.RebarNumber && 0 < geomInfo.RebarSpacing)
            {
                item.SetLayoutAsNumberWithSpacing(geomInfo.RebarNumber, geomInfo.RebarSpacing, true, true, true);
            }

            return(item);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Create the vertical reinforcement according the 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 FillVerticalItem(RebarContainer cont, VerticalRebarLocation location)
        {
            //calculate the reinforcement number in different location
            int rebarNubmer = m_verticalRebarNumber / 4;

            switch (location)
            {
            case VerticalRebarLocation.East:    // the east vertical reinforcement
                if (0 < m_verticalRebarNumber % 4)
                {
                    rebarNubmer++;
                }
                break;

            case VerticalRebarLocation.North:   // the north vertical reinforcement
                if (2 < m_verticalRebarNumber % 4)
                {
                    rebarNubmer++;
                }
                break;

            case VerticalRebarLocation.West:    // the west vertical reinforcement
                if (1 < m_verticalRebarNumber % 4)
                {
                    rebarNubmer++;
                }
                break;

            case VerticalRebarLocation.South:   // the south vertical reinforcement
                break;
            }

            // get the geometry information for reinforcement creation
            RebarGeometry geomInfo = m_geometry.GetVerticalRebar(location, rebarNubmer);

            // create the container item
            return(PlaceContainerItem(cont, m_verticalType, null, null, geomInfo, RebarHookOrientation.Right, RebarHookOrientation.Right));
        }