provide utility method to get geometry data for creating AreaReinforcement on wall or floor
コード例 #1
0
ファイル: CreateComplexAreaRein.cs プロジェクト: AMEE/revit
        /// <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;
        }