青岛公司建设网站,深圳网站建设的服务,人网站建站,游戏制作培训前言
这个例子介绍 Revit 的配电盘明细表#xff0c;PanelSchedule。Revit 的电器专业在国内用的并不是十分广泛#xff0c;但从功能上来说还是比较完整的。
内容
这个例子里有三个命令#xff1a;
PanelScheduleExport - 导出配电盘明细表InstanceViewCreation - 创建配…前言
这个例子介绍 Revit 的配电盘明细表PanelSchedule。Revit 的电器专业在国内用的并不是十分广泛但从功能上来说还是比较完整的。
内容
这个例子里有三个命令
PanelScheduleExport - 导出配电盘明细表InstanceViewCreation - 创建配电盘明细表SheetImport - 在图纸中导入配电盘明细表
PanelScheduleExport
用于导出的配电盘明细表 导出到 Excel 主要用到的 Revit API 通过 GetSectionData 可以获取配电盘明细表里各个分区的内容
// public class PanelScheduleView : TableView
public TableSectionData GetSectionData(SectionType sectionType);一个配电盘明细表可以有的分区类型 头Header、体Body、总结Symmary、尾Footer
namespace Autodesk.Revit.DB
{public enum SectionType{None -1,Header 0,Body 1,Summary 2,Footer 3}
}从 TableSectionData 可以获取对应的行列
TableSectionData sectionData psView.GetSectionData(sectionType);
nRows sectionData.NumberOfRows;
nCols sectionData.NumberOfColumns;通过 GetCellText 可以获取对应的配电盘明细表的内容
// public class TableView : View
public string GetCellText(SectionType sectionType, int row, int column);InstanceViewCreation
选中一个配电盘 Panel通过 CreateInstanceView 创建一个配电盘明细表
// public class PanelScheduleView : TableView
public static PanelScheduleView CreateInstanceView(Document ADoc, ElementId panelId);SheetImport
通过 PanelScheduleSheetInstance::Create 在图纸上放置配电盘明细表
// public class PanelScheduleSheetInstance : Element
public static PanelScheduleSheetInstance Create(Document ADoc, ElementId scheduleId, View DBView);为了将多个明细表放在同一行计算了各个表的起始位置
XYZ nextOrigin new XYZ(0.0, 0.0, 0.0);
foreach (Element element in psViews)
{PanelScheduleView psView element as PanelScheduleView;if (psView.IsPanelScheduleTemplate()){// ignore the PanelScheduleView instance which is a template.continue;}PanelScheduleSheetInstance onSheet PanelScheduleSheetInstance.Create(doc, psView.Id, sheet);onSheet.Origin nextOrigin;BoundingBoxXYZ bbox onSheet.get_BoundingBox(doc.ActiveView);double width bbox.Max.X - bbox.Min.X;nextOrigin new XYZ(onSheet.Origin.X width, onSheet.Origin.Y, onSheet.Origin.Z);
}