博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Revit元素抽取
阅读量:6927 次
发布时间:2019-06-27

本文共 1501 字,大约阅读时间需要 5 分钟。

由于Revit2015后改变了 selection.Elements 的方法获取元素,因此只能通过Id来获取元素

Revit2018给出的代码如下:

[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.ReadOnly)]public class Document_Selection : IExternalCommand{    public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,        ref string message, ElementSet elements)    {        try        {            // Select some elements in Revit before invoking this command            // Get the handle of current document.            UIDocument uidoc = commandData.Application.ActiveUIDocument;            // Get the element selection of current document.            Selection selection = uidoc.Selection;            ICollection
selectedIds = uidoc.Selection.GetElementIds(); if (0 == selectedIds.Count) { // If no elements selected. TaskDialog.Show("Revit","You haven't selected any elements."); } else { String info = "Ids of selected elements in the document are: "; foreach (ElementId id in selectedIds) { info += "\n\t" + id.IntegerValue; } TaskDialog.Show("Revit",info); } } catch (Exception e) { message = e.Message; return Autodesk.Revit.UI.Result.Failed; } return Autodesk.Revit.UI.Result.Succeeded; } /// }

 

转载于:https://www.cnblogs.com/aziu/p/10587839.html

你可能感兴趣的文章
批量删除2012年9月份以前的表
查看>>
FOSRestBundle功能包:异常控制器支持
查看>>
咬定青山、立根破岩
查看>>
查询优化器内核剖析第四篇:从一个实例看执行计划
查看>>
微商推广必修课::懂得人性营销让订单满天飞
查看>>
VCS双机由于ID冲突导致启动失败
查看>>
经验、知识和信息是天生免费的东西吗?
查看>>
QQ兴趣部落引流方法经验谈
查看>>
十一推荐:一部电影,一本书,一首歌
查看>>
智能硬件:突破创新的时代
查看>>
Percona5.6自身已支持杀死慢SQL
查看>>
【UNITY3D 游戏开发之八】Unity编译到iPhone运行 Collider 无法正常触发事件解决方案...
查看>>
5分钟了解MariaDB创建角色功能
查看>>
系统优化之Dojo优化策略--页面加载机制优化
查看>>
大卫谈学习
查看>>
IDC:全球安全产品与服务支出预测2017-2021
查看>>
Exchange企业实战技巧(16)发布SMTP、POP、IMAP连接信息设置
查看>>
烂泥:【解决】mysql数据库报ERROR 104错误解决
查看>>
python下载文件的几种常用方法
查看>>
运维自动化之ansible的安装与使用(包括模块与playbook使用)
查看>>