2. revitAPI基础-----类别category
2021-01-15 08:12
标签:实例 space led read 子类 set 表示 category ESS 在revitAPI中,Element及其子类都拥有一个category属性用于表示类别,整体调用方式为document.settings.Categories,也可以用BuiltInCategory找出指定的类别 从模型中取到想要的类别: using System; 同时对于element实例,category是其一个属性,因此可以通过element获取其category属性 2. revitAPI基础-----类别category 标签:实例 space led read 子类 set 表示 category ESS 原文地址:https://www.cnblogs.com/3118460692wwx/p/12243088.html
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
namespace category
{
[Autodesk.Revit.Attributes.Transaction(TransactionMode.Manual)]
public class Class1 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//throw new NotImplementedException();
try
{
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document document = uidoc.Document;
Categories categories = document.Settings.Categories;//得到了全部的类别
Category category = categories.get_Item(BuiltInCategory.OST_Columns);//得到了柱子类别
TaskDialog.Show("提示","图中共有"+categories.Size+"种类别");
return Result.Succeeded;
}
catch (Exception)
{
return Result.Failed;
}
}
}
}
下一篇:AcWing 794.高精度除法
文章标题:2. revitAPI基础-----类别category
文章链接:http://soscw.com/index.php/essay/42170.html