Esempio n. 1
0
        }//execute

        //外部事件方法建立
        //当前视图假标高刷新
        public void FakeElev_Refresh_activeview(UIApplication uiapp)
        {
            UIDocument uidoc        = uiapp.ActiveUIDocument;
            Document   doc          = uidoc.Document;
            Selection  sel          = uiapp.ActiveUIDocument.Selection;
            ElementId  activeviewId = doc.ActiveView.Id;
            //获取视图ID列表
            ICollection <ElementId> ele_viewsectionIds = (new FilteredElementCollector(doc)).OfClass(typeof(ViewSection)).WhereElementIsNotElementType().ToElementIds();

            if (ele_viewsectionIds.Contains(activeviewId))
            {
                LevelPickFilter levelpickfilter  = new LevelPickFilter();
                Level           level            = doc.GetElement(sel.PickObject(ObjectType.Element, levelpickfilter, "请选择零零标高")) as Level;
                double          selevelelevation = level.Elevation;//请选择零零标高

                using (Transaction modifyParaElevation = new Transaction(doc))
                {
                    modifyParaElevation.Start("modifyParaElevation");
                    //遍历视图列表
                    modifyElevationFake(doc, doc.ActiveView.Id, selevelelevation);//对单个视图id内的 假标高 族实例 进行数据修改
                    modifyParaElevation.Commit();
                }
            }
            else
            {
                TaskDialog.Show("Revit2020", "请选择 立面 或者 剖面 视图");
            }
        }
Esempio n. 2
0
        //所有立面、剖面假标高刷新
        public void FakeElev_Refresh_allviews(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;
            Selection  sel   = uiapp.ActiveUIDocument.Selection;

            LevelPickFilter levelpickfilter  = new LevelPickFilter();
            Level           level            = doc.GetElement(sel.PickObject(ObjectType.Element, levelpickfilter, "请选择零零标高")) as Level;
            double          selevelelevation = level.Elevation;//请选择零零标高

            //获取视图ID列表
            ICollection <ElementId> ele_viewsectionIds = (new FilteredElementCollector(doc)).OfClass(typeof(ViewSection)).WhereElementIsNotElementType().ToElementIds();

            using (Transaction modifyParaElevation = new Transaction(doc))
            {
                modifyParaElevation.Start("modifyParaElevation");
                //遍历视图列表
                foreach (ElementId elementId in ele_viewsectionIds)
                {
                    modifyElevationFake(doc, elementId, selevelelevation);//对单个视图id内的 假标高 族实例 进行数据修改
                }
                modifyParaElevation.Commit();
            }
        }