|
Revit提供了三种方法来隐藏对象,
1按照类别
2按照对象
3按过滤器
对应的对于前两种有API来做相同的工作
1. 按类别:
public void Document.setVisibility(
Category category,
bool visible
)
2. 按照对象:把需要隐藏的对象放在集合参数中即可
public void Hide(
ElementSet elemSet
)
下面是Hide的使用样例,用VSTA创建。Visual Studio 稍加修改即可,方法不变。
- [c-sharp] view plaincopy
- public void HideElement()
- {
- Application app = this.ActiveUIDocument.Application.Application;
- Document doc = this.ActiveUIDocument.Document;
-
- Transaction trans = new Transaction(doc);
- trans.Start("HideElement");
-
- Selection sel = this.ActiveUIDocument.Selection;
- Reference ref1 = sel.PickObject(ObjectType.Element, "Pick element to hide");
- Element elem = ref1.Element;
- ElementSet es = this.Application.Create.NewElementSet();
- es.Insert(elem);
- this.ActiveUIDocument.Document.ActiveView.Hide(es);
- trans.Commit();
- }
复制代码作者:叶雄进
|
|