コード例 #1
0
        /// <summary>
        /// Batch creation of Areas
        /// </summary>
        /// <returns>If batch creation succeeds, return true; otherwise, return false</returns>
        private bool CreateAreas()
        {
            try
            {
                if (null == m_viewPlan)
                {
                    return(false);
                }

                List <AreaCreationData> areaCreationDatas = new List <AreaCreationData>();
                //Create AreaCreateDatas for Areas' batch creation
                for (int i = 1; i < 11; i++)
                {
                    Autodesk.Revit.DB.UV point            = new Autodesk.Revit.DB.UV(i * -10, 100);
                    Autodesk.Revit.DB.UV tagPoint         = new Autodesk.Revit.DB.UV(i * -10, 100);
                    AreaCreationData     areaCreationData = new AreaCreationData(m_viewPlan, point);
                    if (null != areaCreationData)
                    {
                        areaCreationData.TagPoint = tagPoint;
                        areaCreationDatas.Add(areaCreationData);
                    }
                }

                // Create Areas
                if (0 == areaCreationDatas.Count)
                {
                    return(false);
                }
                m_doc.Create.NewAreas(areaCreationDatas);
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: ElementsBatchCreation.cs プロジェクト: AMEE/revit
        /// <summary>
        /// Batch creation of Areas
        /// </summary>
        /// <returns>If batch creation succeeds, return true; otherwise, return false</returns>
        private bool CreateAreas()
        {
            try
            {
                if (null == m_viewPlan)
                {
                    return false;
                }

                List<AreaCreationData> areaCreationDatas = new List<AreaCreationData>();
                //Create AreaCreateDatas for Areas' batch creation
                for (int i = 1; i < 11; i++)
                {
                    Autodesk.Revit.DB.UV point = new Autodesk.Revit.DB.UV (i * -10, 100);
                    Autodesk.Revit.DB.UV tagPoint = new Autodesk.Revit.DB.UV (i * -10, 100);
                    AreaCreationData areaCreationData = new AreaCreationData(m_viewPlan, point);
                    if (null != areaCreationData)
                    {
                        areaCreationData.TagPoint = tagPoint;
                        areaCreationDatas.Add(areaCreationData);
                    }
                }

                // Create Areas
                if (0 == areaCreationDatas.Count)
                {
                    return false;
                }
                m_doc.Create.NewAreas(areaCreationDatas);
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }