Revit API:明细表 ViewSchedule

Revit的明细表是一种自动更新的表格视图,用于展示项目中图元属性信息。明细表可按需创建,并能根据模型修改自动调整。通过ViewSchedule接口,可以读取和修改明细表内容,包括设置列的样式,如背景色。此外,明细表支持导出到其他软件,如电子表格程序。在Revit中,明细表是View的子类,属于TableView,提供多种创建方法,如创建材料清单、修订日程等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Revit 明细表定义

明细表官方解释
明细表以表格形式显示信息,这些信息是从项目中的图元属性中提取的。明细表可以列出要编制明细表的图元类型的每个实例,或根据明细表的成组标准将多个实例压缩到一行中。
在这里插入图片描述

可以在设计过程中的任何时候创建明细表。如果对模型的修改会影响明细表,则明细表将自动更新以反映这些修改。可以将明细表添加到图纸中。
可以将明细表导出到其他软件程序中,如电子表格程序。

明细表更新
修改模型时,所有明细表都会自动更新。例如,如果移动一面墙,则房间明细表中的平方英尺也会相应更新。
修改模型中建筑构件的属性时,相关明细表会自动更新。
例如,可以在模型中选择一扇门并修改其制造商属性。门明细表将反应制造商属性的变化。

明细表是 Revit 的一种视图

从继承层次可以看到明细表是 View 的子类。
在这里插入图片描述

TableView

如果想要读取明细表的内容,可以用 ViewSchedule 父类 TableView 的接口。

namespace Autodesk.Revit.DB
{
    public class TableView : View
    {
        public int MaximumRowHeight { get; }
        public int MaximumColumnWidth { get; }
        public int MinimumRowHeight { get; }
        public int MinimumColumnWidth { get; }
        public int MaximumGridWidth { get; }
        public ElementId TargetId { get; set; }
        public static IList<ElementId> GetAvailableParameters(Document cda, ElementId categoryId);
        public IList<ElementId> GetAvailableParameterCategories(SectionType sectionType, int row);
        public string GetCalculatedValueName(SectionType sectionType, int row, int column);
        public string GetCalculatedValueText(SectionType sectionType, int row, int column);
        public string GetCellText(SectionType sectionType, int row, int column);
        public bool IsValidSectionType(SectionType sectionType);
    }
}

ViewSchedule

创建

The ViewSchedule class represents schedules and other schedule-like views, including single-category and multi-category schedules, key schedules, material takeoffs, view lists, sheet lists, keynote legends, revision schedules, and note blocks.

// ViewSchedule 相关创建接口
// Creates a keynote legend.
public static ViewSchedule CreateKeynoteLegend(Document document);
// Create a key schedule.
public static ViewSchedule CreateKeySchedule(Document document, ElementId categoryId);
// Creates a material takeoff.
public static ViewSchedule CreateMaterialTakeoff(Document document, ElementId categoryId);
// Creates a note block.
public static ViewSchedule CreateNoteBlock(Document document, ElementId familyId);
// Creates a revision schedule.
public static ViewSchedule CreateRevisionSchedule(Document document);
// Creates a regular schedule that can relate to a specific area scheme.
public static ViewSchedule CreateSchedule(Document document, ElementId categoryId, ElementId areaSchemeId);
// Creates a regular schedule.
public static ViewSchedule CreateSchedule(Document document, ElementId categoryId);
// Creates a sheet list.
public static ViewSchedule CreateSheetList(Document document);
// Creates a view list.
public static ViewSchedule CreateViewList(Document document);

定义

// ViewSchedule
public ScheduleDefinition Definition { get; }

下图中字段、过滤器、排序/成组、格式、外观的定义都在 ScheduleDefinition
在这里插入图片描述

修改明细表列的背景色

下面的例子是设置明细表背景色,逻辑上字体类型颜色等都可以设置。

// 获取某一列的样式
ScheduleField field = definition.GetField(id);
TableCellStyle style = field.GetStyle();
TableCellStyleOverrideOptions options = style.GetCellStyleOverrideOptions();

// Override 背景色
options.BackgroundColor = true;
style.SetCellStyleOverrideOptions(options);

// 设置背景色
style.BackgroundColor = highlight;
field.SetStyle(style);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

安意诚Matrix

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值