/// <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);
        }
Example #2
0
        /// <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;
        }