GetFloorGeom() public method

get necessary data when create AreaReinforcement on a horizontal floor
public GetFloorGeom ( Floor floor, System.Reference &refer, CurveArray &curves ) : bool
floor Floor floor on which to create AreaReinforcemen
refer System.Reference reference of the horizontal face on the floor
curves CurveArray curves compose the horizontal face of the floor
return bool
        /// <summary>
        /// initialize member data, judge simple precondition
        /// </summary>
        private Floor InitFloor(ref Reference refer, ref IList <Curve> curves)
        {
            ElementSet elems = new ElementSet();

            foreach (ElementId elementId in m_currentDoc.Selection.GetElementIds())
            {
                elems.Insert(m_currentDoc.Document.GetElement(elementId));
            }
            //selected 0 or more than 1 element
            if (elems.Size != 1)
            {
                string msg = "Please select exactly one slab.";
                ApplicationException appEx = new ApplicationException(msg);
                throw appEx;
            }
            Floor floor = null;

            foreach (object o in elems)
            {
                //selected one floor
                floor = o as Floor;
                if (null == floor)
                {
                    string msg = "Please select exactly one slab.";
                    ApplicationException appEx = new ApplicationException(msg);
                    throw appEx;
                }
            }
            //check the shape is rectangular and get its edges
            GeomHelper helper = new GeomHelper();

            if (!helper.GetFloorGeom(floor, ref refer, ref curves))
            {
                ApplicationException appEx = new
                                             ApplicationException(
                    "Your selection is not a structural rectangular horizontal slab.");
                throw appEx;
            }

            return(floor);
        }
Example #2
0
        /// <summary>
        /// initialize member data, judge simple precondition
        /// </summary>
        private Floor InitFloor(ref Reference refer, ref CurveArray curves)
        {
            ElementSet elems = m_currentDoc.Selection.Elements;
            //selected 0 or more than 1 element
            if (elems.Size != 1)
            {
                string msg = "Please select exactly one slab.";
                ApplicationException appEx = new ApplicationException(msg);
                throw appEx;
            }
            Floor floor = null;
            foreach (object o in elems)
            {
                //selected one floor
                floor = o as Floor;
                if (null == floor)
                {
                    string msg = "Please select exactly one slab.";
                    ApplicationException appEx = new ApplicationException(msg);
                    throw appEx;
                }
            }
            //check the shape is rectangular and get its edges
            GeomHelper helper = new GeomHelper();
            if (!helper.GetFloorGeom(floor, ref refer, ref curves))
            {
                ApplicationException appEx = new
                    ApplicationException(
                    "Your selection is not a structural rectangular horizontal slab.");
                throw appEx;
            }

            return floor;
        }