Revit二次开发示例:HelloRevit
本示例实现Revit和Revit打开的文件的相关信息。
- #region Namespaces
- using System;
- 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 HelloRevit
- {
- [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)
- {
- Application app = commandData.Application.Application;
- Document activeDoc = commandData.Application.ActiveUIDocument.Document;
- TaskDialog mainDialog = new TaskDialog("Hello, Revit!");
- mainDialog.MainInstruction = "Hello, Revit!";
- mainDialog.MainContent=
- "This sample shows how a basic ExternalCommand can be added to the Revit user interface."
- + " It uses a Revit task dialog to communicate information to the interactive user.\n"
- + "The command links below open additional task dialogs with more information.";
- mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,
- "View information about the Revit installation");
- mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2,
- "View information about the active document");
- mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
- mainDialog.DefaultButton = TaskDialogResult.Close;
- mainDialog.FooterText=
- "<a href=\"http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 \">"
- + "Click here for the Revit API Developer Center</a>";
- TaskDialogResult tResult = mainDialog.Show();
- if (TaskDialogResult.CommandLink1 == tResult)
- {
- TaskDialog dialog_CommandLink1 = new TaskDialog("Revit Build Informaiton");
- dialog_CommandLink1.MainInstruction =
- "Revit Version Name is: " + app.VersionName + "\n"
- + "Revit Version Number is: " + app.VersionNumber + "\n"
- + "Revit Version Build is: " + app.VersionBuild;
- dialog_CommandLink1.Show();
- }
- else if (TaskDialogResult.CommandLink2 == tResult)
- {
- TaskDialog.Show("Active Document Information",
- "Active document: " + activeDoc.Title + "\n"
- + "Active view name: " + activeDoc.ActiveView.Name);
- }
- return Result.Succeeded;
- }
- }
- }
Revit二次开发示例:HelloRevit的更多相关文章
- 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二次开发示例:DesignOptions
本例只要演示Revit的类过滤器的用法,在对话框中显示DesignOption元素. #region Namespaces using System; using System.Collections ...
- Revit二次开发示例:DeleteObject
在本例中,通过命令可以删除选中的元素. 需要注意的是要在代码中加入Transaction,否则的话会出现Modifying is forbidden because the document has ...
随机推荐
- table表头标题th浮动提示-MyTable.js
/* $(document).ready(function () { var maxH = ($(window).height() - $("#divParent").positi ...
- 在Linux上使用的10种云备份方案
导读 不久前,为用户提供一种备份远程机器上数据的简易方法还很稀奇.现在,我们已觉得这理所当然.Dropbox及其他公司简化了这项任务.苹果.谷歌和微软都提供各自的数据备份方法. 在Linux上,情况有 ...
- Stanford机器学习---第八讲. 支持向量机SVM
原文: http://blog.csdn.net/abcjennifer/article/details/7849812 本栏目(Machine learning)包括单参数的线性回归.多参数的线性回 ...
- opencv中,c和c++版本区别体验
参考:http://www.cnblogs.com/tornadomeet/archive/2012/04/29/2476277.html
- 取出type="button" 和type="text" 里面的值显示在页面
<script type="text/JavaScript> function changeLink() { document.getElementById("nod ...
- dom 中事件
阻止表单提交: function aa(){ return false; } function bb(event){ event.preventDefault(); } 事件不再派发: <!DO ...
- Android clickable 和 focusable
setClickable(),好像是控制按钮是否可以被点击和点击之后触发监听器事件.setFocusable();控制键盘是否可以获得这个按钮的焦点.(我按实体键盘上方向键,button被选中) 今天 ...
- MySQL 全文搜索支持, mysql 5.6.4支持Innodb的全文检索和类memcache的nosql支持
背景:搞个个人博客的全文搜索得用like啥的,现在mysql版本号已经大于5.6.4了也就支持了innodb的全文搜索了,刚查了下目前版本号都到MySQL Community Server 5.6.1 ...
- js监听密码输入框type
1.密码输入框 <input class="oaInput oaText" type="text" placeholder="请输入用户名&qu ...
- 【python】异常处理
转自:http://www.cnblogs.com/IPrograming/p/Python_error_handler.html 1. 抛出异常和自定义异常 Python用异常对象(exceptio ...