Revit二次开发示例:DesignOptions
本例只要演示Revit的类过滤器的用法,在对话框中显示DesignOption元素。
#region Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
#endregion namespace DesignOptionReader
{
[Autodesk.Revit.Attributes.Transaction(TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling(JournalingMode.NoCommandData)]
public class Command : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
try
{
Application application = commandData.Application.Application;
ElementClassFilter filter = new ElementClassFilter(typeof(Autodesk.Revit.DB.DesignOption));
FilteredElementCollector collector = new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document);
collector.WherePasses(filter);
IEnumerator iter = collector.GetElementIdIterator();
Element element;
ElementSet designOptions = new ElementSet(); while (iter.MoveNext())
{
element = iter.Current as Element;
if (element.GetType().Equals(typeof(Autodesk.Revit.DB.DesignOption)))
{
designOptions.Insert(element);
}
} if (designOptions.Size > 0)
{
DesignOptionsDialog dialog = new DesignOptionsDialog(); foreach (Element elem in designOptions)
{
dialog.DesignOptionsList.Items.Add(elem.Name); }
dialog.ShowDialog();
}
else
{
TaskDialog.Show("DesignOptions","There are no design options in this document");
} }
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
} return Result.Succeeded;
}
}
}
Revit二次开发示例:DesignOptions的更多相关文章
- Revit二次开发示例:HelloRevit
本示例实现Revit和Revit打开的文件的相关信息. #region Namespaces using System; using System.Collections.Generic; using ...
- Revit二次开发示例:EventsMonitor
在该示例中,插件在Revit启动时弹出事件监控选择界面,供用户设置,也可在添加的Ribbon界面完成设置.当Revit进行相应操作时,弹出窗体会记录事件时间和名称. #region Namespace ...
- Revit二次开发示例:ErrorHandling
本示例介绍了Revit的错误处理. #region Namespaces using System; using System.Collections.Generic; using Autodes ...
- Revit二次开发示例:ChangesMonitor
在本示例中,程序监控Revit打开文件事件,并在创建的窗体中更新文件信息. #region Namespaces using System; using System.Collections.Ge ...
- Revit二次开发示例:AutoStamp
该示例中,在Revit启动时添加打印事件,在打印时向模型添加水印,打印完成后删除该水印. #region Namespaces using System; using System.Collect ...
- Revit二次开发示例:ModelessForm_ExternalEvent
使用Idling事件处理插件任务. #region Namespaces using System; using System.Collections.Generic; using Autodesk. ...
- Revit二次开发示例:Journaling
关于Revit Journal读写的例子. #region Namespaces using System; using System.Collections.Generic; using Sys ...
- Revit二次开发示例:DisableCommand
Revit API 不支持调用Revit内部命令,但可以用RevitCommandId重写它们(包含任意选项卡,菜单和右键命令).使用RevitCommandId.LookupCommandId()可 ...
- Revit二次开发示例:DeleteObject
在本例中,通过命令可以删除选中的元素. 需要注意的是要在代码中加入Transaction,否则的话会出现Modifying is forbidden because the document has ...
随机推荐
- HDU 4857 Couple doubi(找循环节)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4861 解题报告:桌子上有k个球 ,第i个球的价值wi = 1^i+2^i+...+(p-1)^i (m ...
- C#结构体和类的区别
1.不能在结构体中定义默认构造方法: 2.在结构体中的非默认构造方法中,必须对结构体中所有的字段进行初始化,否则将报错. 3.在类中声明字段的同时,可以初始化,字段的值.在结构体中不可以. 4.结构体 ...
- 【Python】Django 如何直接返回404 被 curl,wget 捕获到
代码示例: from django.http import Http404, HttpResponseNotFound #raise Http404(filename) return HttpResp ...
- React v16-alpha 从virtual dom 到 dom 源码简读
一.物料准备 1.克隆react源码, github 地址:https://github.com/facebook/react.git 2.安装gulp 3.在react源码根目录下: $npm in ...
- 4.在二元树中找出和为某一值的所有路径[FindPathsInBinaryTree]
[题目]: 输入一个整数和一棵二元树.从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径.打印出和与输入整数相等的所有路径. 例如输入整数22和如下二元树 10 ...
- sqlserver 常用语句
1.查询表中的RID RID=RowID=(fileID:pageID:slotID) SELECT sys.fn_PhysLocFormatter(%%physloc%%) AS rid,* FRO ...
- 前台js分页,自己手写逻辑
js代码如下: //设置分页 var pageSize = 10; //设置一次显示多少页 var pageLimit = 5; $(function(){ //查询所有内容 $.post(ctx + ...
- 【mysql】用navicat连接虚拟机mysql出现错误代码(10038)
来源: http://www.cnblogs.com/ohmydenzi/p/5521121.html http://blog.csdn.net/chana1101/article/details/3 ...
- C++C++中构造函数与析构函数的调用顺序
http://blog.csdn.net/xw13106209/article/details/6899370 1.参考文献 参考1: C++继承中构造函数.析构函数调用顺序及虚函数的动态绑定 参考2 ...
- 【转】Quartus II调用modelsim无缝仿真
Quartus II调用modelsim无缝仿真 ★emouse 思·睿博客文章★ 原创文章转载请注明:http://emouse.cnblogs.com 本篇文章为转载,写的不错,最近在学mode ...