/// <summary>
        /// On the interior 4 curves, set the override flag
        /// and flip the hooks on the top 2 layers to "up"
        /// </summary>
        /// <param name="areaRein"></param>
        private void ChangeAreaReinCurves(AreaReinforcement areaRein)
        {
            //interior 4 curves are listed in the back of the curves,
            //this order is decided when we create it
            IList <ElementId> curveIds = areaRein.GetCurveElementIds();

            for (int i = 4; i < 8; i++)
            {
                AreaReinforcementCurve areaReinCurve =
                    m_doc.GetElement(curveIds[i]) as AreaReinforcementCurve;
                //remove hooks, set the hook the top 2 layers to 'up'
                ParameterUtil.SetParaInt(areaReinCurve,
                                         BuiltInParameter.REBAR_SYSTEM_OVERRIDE, -1);
                ParameterUtil.SetParaInt(areaReinCurve,
                                         BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_TOP_DIR_1,
                                         (int)HookOrientation.Up);
                ParameterUtil.SetParaInt(areaReinCurve,
                                         BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_TOP_DIR_2,
                                         (int)HookOrientation.Up);
            }
        }
Beispiel #2
0
        /// <summary>
        /// check whether the selected is expected, prepare necessary data
        /// </summary>
        /// <param name="selected">selected elements</param>
        /// <returns>whether the selected AreaReinforcement is expected</returns>
        private bool PreData(ElementSet selected)
        {
            //selected is not only one AreaReinforcement
            if (selected.Size != 1)
            {
                return(false);
            }
            foreach (Object o in selected)
            {
                m_areaRein = o as AreaReinforcement;
                if (null == m_areaRein)
                {
                    return(false);
                }
            }

            //whether the selected AreaReinforcement is rectangular
            CurveArray curves = new CurveArray();

            m_areaReinCurves = new List <AreaReinforcementCurve>();
            IList <ElementId> curveIds = m_areaRein.GetCurveElementIds();

            foreach (ElementId o in curveIds)
            {
                AreaReinforcementCurve areaCurve = m_doc.GetElement(o) as AreaReinforcementCurve;
                if (null == areaCurve)
                {
                    ApplicationException appEx = new ApplicationException
                                                     ("There is unexpected error with selected AreaReinforcement.");
                    throw appEx;
                }
                m_areaReinCurves.Add(areaCurve);
                curves.Append(areaCurve.Curve);
            }
            bool flag = GeomUtil.IsRectangular(curves);

            return(flag);
        }