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
コード例 #1
0
        /// <summary>
        /// create simple AreaReinforcement on horizontal floor
        /// </summary>
        /// <param name="floor"></param>
        /// <returns>is successful</returns>
        private bool CreateAreaReinOnFloor(Floor floor)
        {
            GeomHelper    helper = new GeomHelper();
            Reference     refer  = null;
            IList <Curve> curves = new List <Curve>();

            //check whether floor is horizontal rectangular
            //and prepare necessary to create AreaReinforcement
            if (!helper.GetFloorGeom(floor, ref refer, ref curves))
            {
                ApplicationException appEx = new ApplicationException(
                    "Your selection is not a horizontal rectangular slab.");
                throw appEx;
            }

            AreaReinDataOnFloor      dataOnFloor = new AreaReinDataOnFloor();
            CreateSimpleAreaReinForm createForm  =
                new CreateSimpleAreaReinForm(dataOnFloor);

            //allow use select parameters to create
            if (createForm.ShowDialog() == DialogResult.OK)
            {
                //define the Major Direction of AreaReinforcement,
                //we get direction of first Line on the Floor as the Major Direction
                Line firstLine = (Line)(curves[0]);
                Autodesk.Revit.DB.XYZ majorDirection = new Autodesk.Revit.DB.XYZ(
                    firstLine.GetEndPoint(1).X - firstLine.GetEndPoint(0).X,
                    firstLine.GetEndPoint(1).Y - firstLine.GetEndPoint(0).Y,
                    firstLine.GetEndPoint(1).Z - firstLine.GetEndPoint(0).Z);

                //Create AreaReinforcement
                ElementId         areaReinforcementTypeId = AreaReinforcementType.CreateDefaultAreaReinforcementType(m_revit.Application.ActiveUIDocument.Document);
                ElementId         rebarBarTypeId          = RebarBarType.CreateDefaultRebarBarType(m_revit.Application.ActiveUIDocument.Document);
                ElementId         rebarHookTypeId         = RebarHookType.CreateDefaultRebarHookType(m_revit.Application.ActiveUIDocument.Document);
                AreaReinforcement areaRein = AreaReinforcement.Create(m_revit.Application.ActiveUIDocument.Document, floor, curves, majorDirection, areaReinforcementTypeId, rebarBarTypeId, rebarHookTypeId);

                //set AreaReinforcement and it's AreaReinforcementCurves parameters
                dataOnFloor.FillIn(areaRein);
                return(true);
            }
            return(false);
        }
コード例 #2
0
        /// <summary>
        /// create simple AreaReinforcement on horizontal floor
        /// </summary>
        /// <param name="floor"></param>
        /// <returns>is successful</returns>
        private bool CreateAreaReinOnFloor(Floor floor)
        {
            GeomHelper helper = new GeomHelper();
            Reference  refer  = null;
            CurveArray curves = null;

            //check whether floor is horizontal rectangular
            //and prepare necessary to create AreaReinforcement
            if (!helper.GetFloorGeom(floor, ref refer, ref curves))
            {
                ApplicationException appEx = new ApplicationException(
                    "Your selection is not a horizontal rectangular slab.");
                throw appEx;
            }

            AreaReinDataOnFloor      dataOnFloor = new AreaReinDataOnFloor();
            CreateSimpleAreaReinForm createForm  =
                new CreateSimpleAreaReinForm(dataOnFloor);

            //allow use select parameters to create
            if (createForm.ShowDialog() == DialogResult.OK)
            {
                //define the Major Direction of AreaReinforcement,
                //we get direction of first Line on the Floor as the Major Direction
                Line firstLine = (Line)(curves.get_Item(0));
                Autodesk.Revit.DB.XYZ majorDirection = new Autodesk.Revit.DB.XYZ(
                    firstLine.get_EndPoint(1).X - firstLine.get_EndPoint(0).X,
                    firstLine.get_EndPoint(1).Y - firstLine.get_EndPoint(0).Y,
                    firstLine.get_EndPoint(1).Z - firstLine.get_EndPoint(0).Z);

                //crete AreaReinforcement by NewAreaReinforcement function
                DocCreator        creator  = m_revit.Application.ActiveUIDocument.Document.Create;
                AreaReinforcement areaRein = creator.NewAreaReinforcement(floor, curves, majorDirection);

                //set AreaReinforcement and it's AreaReinforcementCurves parameters
                dataOnFloor.FillIn(areaRein);
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: CreateSimpleAreaRein.cs プロジェクト: AMEE/revit
        /// <summary>
        /// create simple AreaReinforcement on horizontal floor
        /// </summary>
        /// <param name="floor"></param>
        /// <returns>is successful</returns>
        private bool CreateAreaReinOnFloor(Floor floor)
        {
            GeomHelper helper = new GeomHelper();
            Reference refer = null;
            CurveArray curves = null;

            //check whether floor is horizontal rectangular
            //and prepare necessary to create AreaReinforcement
            if (!helper.GetFloorGeom(floor, ref refer, ref curves))
            {
                ApplicationException appEx = new ApplicationException(
                    "Your selection is not a horizontal rectangular slab.");
                throw appEx;
            }

            AreaReinDataOnFloor dataOnFloor = new AreaReinDataOnFloor();
            CreateSimpleAreaReinForm createForm =
                new CreateSimpleAreaReinForm(dataOnFloor);

            //allow use select parameters to create
            if (createForm.ShowDialog() == DialogResult.OK)
            {
                //define the Major Direction of AreaReinforcement,
                //we get direction of first Line on the Floor as the Major Direction
                Line firstLine = (Line)(curves.get_Item(0));
                Autodesk.Revit.DB.XYZ majorDirection = new Autodesk.Revit.DB.XYZ (
                    firstLine.get_EndPoint(1).X - firstLine.get_EndPoint(0).X,
                    firstLine.get_EndPoint(1).Y - firstLine.get_EndPoint(0).Y,
                    firstLine.get_EndPoint(1).Z - firstLine.get_EndPoint(0).Z);

                //crete AreaReinforcement by NewAreaReinforcement function
                DocCreator creator = m_revit.Application.ActiveUIDocument.Document.Create;
                AreaReinforcement areaRein = creator.NewAreaReinforcement(floor, curves, majorDirection);

                //set AreaReinforcement and it's AreaReinforcementCurves parameters
                dataOnFloor.FillIn(areaRein);
                return true;
            }
            return false;
        }