如何编程隐藏Revit 中的组Group?
来源:互联网 发布:青岛飞拉利和淘宝比 编辑:程序博客网 时间:2024/05/17 00:19
我在ADNDevBlog中写了一篇英文博客, 由于比较语言简单,直接在这里黏贴出来分享给大家。
我们无法直接用HideElements() 函数来隐藏一个组Group对象。但是可以分别隐藏组中的对象,达到对这个组进行隐藏的目的。
Through Revit UI command, we can hide group by picking it and click the hide command like other elements. Howerver I cannot hide group via API.
Here is the DevelopSharp code I used.
public void hidegroup()
{
Document doc = this.ActiveUIDocument.Document;
Selection sel = this.ActiveUIDocument.Selection;
Reference ref1 = sel.PickObject(ObjectType.Element,"Please pick a group");
Element elem = doc.GetElement(ref1);
IList<ElementId> lists = new List<ElementId>();
lists.Add(elem.Id);
Transaction trans = new Transaction(doc);
trans.Start("hidegroup");
doc.ActiveView.HideElements(lists);
trans.Commit ();
}
Launch the command, pick any group, error occurs. The error message is :
Revit failed to execute hidegroup.
A problem has been detected.
Then how can we hide a group? Any tricks?
Solution
Groups cannot be hidden or overridde like ordinary elements. In order to hide a group, we need to hide the element set in that group by HideElements() method. The good aspect is that we can hide part of a group.
Here is the code to hide the whole group.
public void hidegroup()
{
Document doc = this.ActiveUIDocument.Document;Selection sel = this.ActiveUIDocument.Selection;
Reference ref1 = sel.PickObject(ObjectType.Element,"Please pick a group");
Element elem = doc.GetElement(ref1);
IList<ElementId> lists = new List<ElementId>();
Group g = elem as Group;
IList<ElementId> ids = g.GetMemberIds();
Transaction trans = new Transaction(doc);
trans.Start("hidegroup");
this.ActiveUIDocument.ActiveView.HideElements(ids);
trans.Commit ();
}
转载请复制以下信息:
原文链接: http://blog.csdn.net/joexiongjin/article/details/17915301
作者: 叶雄进
- 如何编程隐藏Revit 中的组Group?
- Revit中如何编程旋转一个对象
- Revit编程如何提取轴线信息
- 编程如何修改Revit族类型名称
- 编程如何读取Revit墙高
- revit隐藏线
- 如何编程访问(读,写)Revit项目信息
- 如何编程创建Revit里面的视图过滤器对象
- Revit中如何编程实现窗口缩放视图
- Revit编程如何获取内置参数对应的中文字符串?
- 如何编程访问和修改Revit项目的单位信息
- 编程获取Revit视图中的所有实例对象数量
- Revit中的dynamo编程——code block
- 如何开始Revit二次开发
- 如何开始Revit二次开发
- Revit API 进阶之隐藏dll讲解.
- 在Revit中,如何编程创建新类型(如窗户或墙)
- 在Revit 2013里 如何编程创建(东西南北四个方向)的立面图
- system库函数调用
- linux 网络编程【五】 非阻塞通信epoll
- lambda的一些用法
- Chromium的连接管理
- UIWindow的一点儿思考
- 如何编程隐藏Revit 中的组Group?
- 最小堆
- 定制WinEdt 快捷键
- 深入浅出话VC++(3)——VC++实现绘图操作
- 36计教您如何提高PHP代码质量(二) 转自csdn
- PHP_AJAX_VOTE
- 换行符在Linux和Windows下的区别以及将Linux和windows下的文件的互转的Linux命令:unix2dos, dos2unix
- 排序--直接插入排序思想及代码实现
- 我和权威的故事-王垠