/// <summary>
        /// Create a new Point BoundaryConditions Element.
        /// All the parameter default as Fixed.
        /// </summary>
        /// <param name="hostElement">
        /// structural element which provide the analytical line end reference
        /// </param>
        /// <returns> the created Point BoundaryConditions Element</returns>
        private Autodesk.Revit.DB.BoundaryConditions CreatePointBC(Autodesk.Revit.DB.Element hostElement)
        {
            if (!(hostElement is FamilyInstance))
            {
                return(null);
            }

            FamilyInstance  familyInstance  = hostElement as FamilyInstance;
            AnalyticalModel analyticalModel = familyInstance.GetAnalyticalModel();
            Reference       endReference    = null;

            Curve refCurve = analyticalModel.GetCurve();

            if (null != refCurve)
            {
                endReference = analyticalModel.GetReference(new AnalyticalModelSelector(refCurve, AnalyticalCurveSelector.EndPoint));
            }
            else
            {
                return(null);
            }

            Autodesk.Revit.Creation.Document createDoc = hostElement.Document.Create;

            // invoke Document.NewPointBoundaryConditions Method
            Autodesk.Revit.DB.BoundaryConditions createdBC =
                createDoc.NewPointBoundaryConditions(endReference, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            return(createdBC);
        }
        /// <summary>
        /// According to the selected element create corresponding Boundary Conditions.
        /// Add it into m_bCsDictionary.
        /// </summary>
        public bool CreateBoundaryConditions()
        {
            CreateBCHandler createBCH = null;

            // judge the type of the HostElement
            if (m_hostElement is FamilyInstance)
            {
                FamilyInstance familyInstance = m_hostElement as FamilyInstance;
                StructuralType structuralType = familyInstance.StructuralType;

                if (structuralType == StructuralType.Beam)
                {
                    // create Line BC for beam
                    createBCH = new CreateBCHandler(CreateLineBC);
                }
                else if (structuralType == StructuralType.Brace ||
                         structuralType == StructuralType.Column ||
                         structuralType == StructuralType.Footing)
                {
                    // create point BC for Column/brace
                    createBCH = new CreateBCHandler(CreatePointBC);
                }
            }
            else if (m_hostElement is Wall)
            {
                // create line BC for wall
                createBCH = new CreateBCHandler(CreateLineBC);
            }
            else if (m_hostElement is Floor)
            {
                // create area BC for Floor
                createBCH = new CreateBCHandler(CreateAreaBC);
            }
            else if (m_hostElement is ContFooting)
            {
                // create line BC for WallFoundation
                createBCH = new CreateBCHandler(CreateLineBC);
            }

            // begin create
            Autodesk.Revit.DB.BoundaryConditions NewBC = null;
            try
            {
                NewBC = createBCH(m_hostElement);
                if (null == NewBC)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            // add the created Boundary Conditions into m_bCsDictionary
            m_bCsDictionary.Add(NewBC.Id.IntegerValue, NewBC);
            return(true);
        }
        /// <summary>
        /// Create a new Area BoundaryConditions Element.
        /// All the parameter default as Fixed.
        /// </summary>
        /// <param name="hostElement">structural element which provide the hostElementId</param>
        /// <returns>the created Point BoundaryConditions Element</returns>
        private Autodesk.Revit.DB.BoundaryConditions CreateAreaBC(Autodesk.Revit.DB.Element hostElement)
        {
            Autodesk.Revit.Creation.Document createDoc = hostElement.Document.Create;

            // invoke Document.NewAreaBoundaryConditions Method
            Autodesk.Revit.DB.BoundaryConditions createdBC =
                createDoc.NewAreaBoundaryConditions(hostElement.GetAnalyticalModel(), 0, 0, 0, 0, 0, 0);

            return(createdBC);
        }
Exemple #4
0
 /// <summary>
 /// constructor  
 /// </summary>
 /// <param name="bC">
 /// the boundary conditions of which the information will displayed in the UI grid
 /// </param>
 public BCProperties(Autodesk.Revit.DB.BoundaryConditions bC)
 {
     m_bC = bC;
 }
Exemple #5
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="bC">
 /// the boundary conditions of which the information will displayed in the UI grid
 /// </param>
 public BCProperties(Autodesk.Revit.DB.BoundaryConditions bC)
 {
     m_bC = bC;
 }