Revit API收集器:无法强制转换值:空格到目标类型:

2021-10-17 17:21:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我不明白为什么我的代码适用于其他revit类别:

# -*- coding: utf-8 -*-
import rpw
from rpw import revit, db, ui, DB, UI

dd1 = rpw.db.Collector(of_category='Spaces') 

产生此错误:

IronPython Traceback:
Traceback (most recent call last):
 File "C:\Users\USTL02870\Dropbox\WSP Project local folders\PyRevit custom extensions folder\BTS-NY-BETA.extension\BTS-NY-BETA.tab\Beta Tools.panel\test1.pushbutton\beta1_script.py", line 16, in 
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\collector.py", line 445, in __init__
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\collector.py", line 464, in _collect
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\collector.py", line 78, in apply
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\collector.py", line 190, in process_value
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\utils\coerce.py", line 149, in to_category
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\builtins.py", line 134, in fuzzy_get
 File "C:\Users\USTL02870\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\db\builtins.py", line 107, in get
rpw.exceptions.RpwCoerceError: Could not cast value:spaces to target_type: