【发布时间】:2016-12-26 23:09:45
【问题描述】:
我正在为 Revit 2016 编写 IronPython 脚本。对于初学者,我正在尝试访问活动 Revit 计划中的值(作为文本),并将它们加载到变量中。这对于非计算值来说足够好。
但是,我的一些日程安排字段是计算的。这是一个示例时间表(这里的所有值都是计算出来的):
Revit API 显示了 2 个方法,称为 TableView.GetCalculatedValueName() 和 TableView.GetCalculatedValueText(),我想使用它们,但似乎不像宣传的那样工作。
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
schedule = doc.ActiveView
tableData = schedule.GetTableData()
print(tableData)
tableName = schedule.GetCellText(SectionType.Header,0,0)
qty = schedule.GetCalculatedValueText(SectionType.Body,4,1)
calcValName = schedule.GetCalculatedValueName(SectionType.Body,4,1)
print(tableName)
print("Calculated Qty is: " + qty)
print("Calculated Value Name is: " + calcValName)
运行此代码(在 Revit 中)会产生以下输出:
88-06134-01
Calculated Qty is:
Calculated Value Name is:
我想指出,使用 TableView.GetCellText() 实际上适用于计算值,但我真正想在这里使用的是 GetCalculatedValueName()。
【问题讨论】:
-
您能否提供一个最小的可重现案例?只有一个或两个单元格以及嵌入式 Python 宏的最小 Revit 模型?参考文献thebuildingcoder.typepad.com/blog/about-the-author.html#1b
-
你有没有得到这个工作?前一阵子,但没有人接受任何答案...
标签: python ironpython revit-api revitpythonshell