编程创建明细表(2013 新API用法)
来源:互联网 发布:醉八仙宠物技能数据库 编辑:程序博客网 时间:2024/06/06 02:15
转载请复制以下信息:
原文链接: http://blog.csdn.net/joexiongjin/article/details/7564984
作者: 叶雄进 , Autodesk ADN
2012.5.14
创建明细表是Revit2013的一个比较重要的API功能增强点。可以用来创建明细表,
1。指定显示那个类别的对象;
2. 可以定制一个表中有那些列,列的宽度。
3. 也可以向明细表设置过滤器,选择那些对象可以在明细表中显示出来。
4. 明细表排序和分组。
下面代码段显示了如何创建一个房间明细表。代码摘自Revit 2013 SDK 中的ScheduleCreation 例子。
顺便说句: 你可以在这个页面下载到最新的Revit 2013 SDK,包含这个例子。 随产品发布的SDK不包含这个例子。
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975
private ICollection<ViewSchedule> CreateSchedules(UIDocument uiDocument) { Document document = uiDocument.Document; Transaction t = new Transaction(document, "Create Schedules"); t.Start(); List<ViewSchedule> schedules = new List<ViewSchedule>(); //Create an empty view schedule of wall category. ViewSchedule schedule = ViewSchedule.CreateSchedule(document, new ElementId(BuiltInCategory.OST_Walls), ElementId.InvalidElementId); schedule.Name = "Wall Schedule 1"; schedules.Add(schedule); //Iterate all the schedulable field gotten from the walls view schedule. foreach (SchedulableField schedulableField in schedule.Definition.GetSchedulableFields()) { //Judge if the FieldType is ScheduleFieldType.Instance. if (schedulableField.FieldType == ScheduleFieldType.Instance) { //Get ParameterId of SchedulableField. ElementId parameterId = schedulableField.ParameterId; //If the ParameterId is id of BuiltInParameter.ALL_MODEL_MARK then ignore next operation. if (ShouldSkip(parameterId)) continue; //Add a new schedule field to the view schedule by using the SchedulableField as argument of AddField method of Autodesk.Revit.DB.ScheduleDefinition class. ScheduleField field = schedule.Definition.AddField(schedulableField); //Judge if the parameterId is a BuiltInParameter. if (Enum.IsDefined(typeof(BuiltInParameter), parameterId.IntegerValue)) { BuiltInParameter bip = (BuiltInParameter)parameterId.IntegerValue; //Get the StorageType of BuiltInParameter. StorageType st = document.get_TypeOfStorage(bip); //if StorageType is String or ElementId, set GridColumnWidth of schedule field to three times of current GridColumnWidth. //And set HorizontalAlignment property to left. if (st == StorageType.String || st == StorageType.ElementId) { field.GridColumnWidth = 3 * field.GridColumnWidth; field.HorizontalAlignment = ScheduleHorizontalAlignment.Left; } //For other StorageTypes, set HorizontalAlignment property to center. else { field.HorizontalAlignment = ScheduleHorizontalAlignment.Center; } } //Filter the view schedule by volume if (field.ParameterId == new ElementId(BuiltInParameter.HOST_VOLUME_COMPUTED)) { double volumeFilterInCubicFt = 0.8 * Math.Pow(3.2808399, 3.0); ScheduleFilter filter = new ScheduleFilter(field.FieldId, ScheduleFilterType.GreaterThan, volumeFilterInCubicFt); schedule.Definition.AddFilter(filter); } //Group and sort the view schedule by type if (field.ParameterId == new ElementId(BuiltInParameter.ELEM_TYPE_PARAM)) { ScheduleSortGroupField sortGroupField = new ScheduleSortGroupField(field.FieldId); sortGroupField.ShowHeader = true; schedule.Definition.AddSortGroupField(sortGroupField); } } } t.Commit(); uiDocument.ActiveView = schedule; return schedules; }
- 编程创建明细表(2013 新API用法)
- 明细表
- Android创建通知栏Notification(使用新API)
- UG创建图纸明细表失败的情况
- Java8 编程(一) Java8 API的新特性
- ArcGIS API for Flex (使用ArcGIS API for Flex 创建一个新的地图项目)
- 2.7--如何编程来创建一个新(空)文档?
- Java 8新特性 Stream API 编程
- 程序创建明细表并添加自定义的参数列
- 程序创建明细表并添加自定义的参数列
- Creo二次开发:创建工程图,生成球标和明细表
- ODAC 应用技巧 (三)主/明细表
- qt4MV编程:4 创建新的模式
- c++ 多线程编程之创建新线程
- Hadoop模板(新API)
- hbase java API跟新数据,创建表
- java8 新时间API用法实例(LocalDate、LocalTime、LocalDateTime)
- windows c++程序员开始用linux编程(二)创建新进程
- Android中获取字符串长度、宽度(所占像素宽度),手动设定字符串换行
- 域名解析绑定教程(dot^000^DNSpod)
- SQL 常用笔记
- 项目管理知识笔记三:关键路径和前导图的计算
- phonegap入门(二)-使用html5API存储信息到本地
- 编程创建明细表(2013 新API用法)
- Objective-C属性介绍
- 编译linux内核步骤
- 关于C/C++与汇编的混合编程
- 状态模式
- sas时间序列试验指导(含程序)
- [SQL-码农]内查询
- VS中的C#的wpf中的数据如何导入到excel表中,跪求!
- spring在web.xml中的配置