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);