zoukankan      html  css  js  c++  java
  • Revit API取得全部元素


    //取得全部元素
    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    public class cmdGetAll : IExternalCommand
    {
        public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
        {
            UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
            //全部元素
            FilteredElementCollector collectorAll = new FilteredElementCollector(uiDoc.Document);
            collectorAll.WherePasses(new LogicalOrFilter(new ElementIsElementTypeFilter(false), new ElementIsElementTypeFilter(true)));
            TaskDialog.Show("全部", collectorAll.Count().ToString());
            //IsElement
            FilteredElementCollector collectorIs = new FilteredElementCollector(uiDoc.Document);
            collectorIs.WherePasses(new ElementIsElementTypeFilter(true));
            TaskDialog.Show("IsElement", collectorIs.Count().ToString());
            //IsNotElement
            FilteredElementCollector collectorIsNot = new FilteredElementCollector(uiDoc.Document);
            collectorIsNot.WherePasses(new ElementIsElementTypeFilter(false));
            TaskDialog.Show("IsNotElement", collectorIsNot.Count().ToString());

            //数量
            int ductAll = 0;
            int ductIs = 0;
            int ductIsNot = 0;
            foreach (Element el in collectorAll)
            {
                if (el is Duct)
                    ductAll += 1;
            }
            foreach (Element el in collectorIs)
            {
                if (el is Duct)
                    ductIs += 1;
            }
            foreach (Element el in collectorIsNot)
            {
                if (el is Duct)
                    ductIsNot += 1;
            }
            TaskDialog.Show("duct", ductAll + "," + ductIs + "," + ductIsNot);

            return Result.Succeeded;
        }
    }
    url:http://greatverve.cnblogs.com/p/get-all-element.html
  • 相关阅读:
    redmineBUG系统
    MySQL错误代码
    一篇文章全面了解监控知识体系
    K2 blackpearl 流程开发(一)
    HTTP 协议详解
    http协议学习系列
    浅谈HTTP中Get与Post的区别
    iOS应用程序生命周期(前后台切换,应用的各种状态)详解
    深入浅出 iOS 之生命周期
    iOS-利用AFNetworking(AFN 1.x)-实现文件上传
  • 原文地址:https://www.cnblogs.com/greatverve/p/get-all-element.html
Copyright © 2011-2022 走看看