Start transaction not working with Revit 2014
You're right, it's not being used correctly. The Transaction needs to take place inside the Idling event. The button click handler and Idling event handler should look something like this in Revit : void revitApp_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
{
UIApplication uiapp = sender as UIApplication; UIDocument uidoc = uiapp.ActiveUIDocument; ElementSet elems = uidoc.Selection.Elements; if (elems != null)
{
label1.Text = elems.Size.ToString() + " items selected.";
}
else
{
label1.Text = "No elements selected.";
} if (shouldRun)
{
using (Transaction trans = new Transaction(uidoc.Document, "Hide elements"))
{
trans.Start();
uidoc.Document.ActiveView.HideElements((from Element el in elems select el.Id).ToList());
uidoc.RefreshActiveView();
trans.Commit();
} shouldRun = false;
}
} private void button1_Click(object sender, EventArgs e)
{
shouldRun = true;
}
Start transaction not working with Revit 2014的更多相关文章
- Top 10 Revit Architecture 2014 books
Revit Architecture, along with ArchiCAD, is most used BIM software in architectural design. Although ...
- Revit 2015 API 的全部变化和新功能
这里从SDK的文章中摘录出全部的API变化.主要是希望用户用搜索引擎时能找到相关信息: Major changes and renovations to the Revit API APIchange ...
- Revit二次开发——非模态窗口的事件处理
一.起因 自己在写revit二开时,有一个Winform窗体按钮点击事件需要 触发调用事务进行处理,结果出现“异常“Starting a transaction from an external ...
- 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二次开发示例: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二次开发示例:DisableCommand
Revit API 不支持调用Revit内部命令,但可以用RevitCommandId重写它们(包含任意选项卡,菜单和右键命令).使用RevitCommandId.LookupCommandId()可 ...
随机推荐
- 使用n g r o k将本地主机URL暴露给互联网
在本地开发对接第三方服务的时候,对方有的时候会要求我们提供一个线上的URL地址.例如微信登录 1.下载ngrok https://ngrok.com/download 顺便注册一个账号(使用GitHu ...
- ProtoBuf序列化和反序列化方法
最近公司需要将以前的协议全都改成ProtoBuf生成的协议,再将结构体打包和解包过程终于到一些问题 ,无法使用Marshal.SizeOf计算结构体大小,最后找了一下ProtoBuf的文档,可以用它自 ...
- window10下Docker安装
首先window版本必须是10,如果是win7那么安装方法有所不同,win10是官方支持安装的.笔者安装的是Community社区版,版本信息如下: 1.去docker官网下载win10安装包: ht ...
- Android UI/UX 工具
Zeplin 用于界面图片自动导出. 图标 : https://material.io/icons/
- ElasticSearch的基本认识和基本操作
1.1. ElasticSearch(简称ES) ES即为了解决原生Lucene使用的不足,优化Lucene的调用方式,并实现了高可用的分布式集群的搜索方案,其第一个版本于2010年2月出现在Git ...
- nginx 场景业务汇总 (中)
本文链接:http://www.cnblogs.com/zhenghongxin/p/8906225.html,如果可以,请阅读上篇 <nginx场景业务汇总(初)> (十三)负载均衡 轮 ...
- [JavaScript] 时间戳格式化为yyyy-MM-dd日期
function formateDate(timestamp){ var date = new Date(timestamp); var y = 1900+date.getYear(); var m ...
- 【bzoj4712】洪水 动态dp
不难发现此题是一道动态$dp$题 考虑此题没有修改怎么做,令$f[i]$表示让以$i$为根的子树被覆盖的最小花费,不难推出$f[i]=min(\sum_{j∈son[i]} f[j],val[i])$ ...
- Storm实现数字累加Demo
import java.util.Map; import backtype.storm.Config; import backtype.storm.LocalCluster; import backt ...
- 转载 linux umount 时出现device is busy 的处理方法--fuser
http://www.cnblogs.com/spicy/p/6894333.html (原文链接) 当任何目录有 mount, 然后有程序使用/挂在那个目录上的话, 就没有办法 umount 掉, ...