Revit API得到类别Category设置类别可见性
start
url:http://greatverve.cnblogs.com/p/category-setVisibility.html
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmd : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(doc, "http://revit.5d6d.com");
try
{
ts.Start();
//找到类型的方法,这里找到文字注释类型
Categories cates = doc.Settings.Categories;
Category cate = cates.get_Item(BuiltInCategory.OST_TextNotes);
//设置类型可见性
doc.ActiveView.setVisibility(cate, false);
ts.Commit();
}
catch (Exception ex)
{
//WinFormTools.MsgBox(ex.ToString());
}
return Result.Succeeded;
}
}
[Regeneration(RegenerationOption.Manual)]
public class cmd : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(doc, "http://revit.5d6d.com");
try
{
ts.Start();
//找到类型的方法,这里找到文字注释类型
Categories cates = doc.Settings.Categories;
Category cate = cates.get_Item(BuiltInCategory.OST_TextNotes);
//设置类型可见性
doc.ActiveView.setVisibility(cate, false);
ts.Commit();
}
catch (Exception ex)
{
//WinFormTools.MsgBox(ex.ToString());
}
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。