Revit API得到类别Category设置类别可见性

start
[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;
    }
}
url:http://greatverve.cnblogs.com/p/category-setVisibility.html
posted @ 2014-03-09 17:32  大气象  阅读(2934)  评论(0编辑  收藏  举报
http://www.tianqiweiqi.com