GetValidTypes fails in CPython3

Hi all,

I’m using python to get all valid floor and ceiling types in a project using the GetValidTypes method. This works fine in Iron Python 2.7 in Revit 2022 and Revit 2024, but fails for CPython3 in both versions. The code is pretty basic and is attached.

I get a TypeError warning.

here’s the code for testing

import clr
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager

doc =  DocumentManager.Instance.CurrentDBDocument

collector = FilteredElementCollector(doc).OfClass(ViewPlan).ToElements()

planTypes = (collector[0]).GetValidTypes()

OUT = planTypes

While I’m able to use IronPython currently, I would like to see this resolved moving forwards.

Thanks,

Kevin

:face_with_head_bandage:

I’m pinging the Dynamo for Revit development team on this one… Should not be this difficult. In the meantime consider switching to IronPython3 as I think that may circumvent the issue but I can’t confirm just yet.

1 Like

Hi @Kevin_Fielding1 - Thanks for passing this on.

We have a high integrity commitment to upgrade the PythonNET Bridge project on our Roadmap, planned to start in the not to distant future. This will go a long way to bringing parity between what is possible in the worlds of IronPython and CPython.

Do note they will never be fully the same as they are fundamentally different, but we’re going to target addressing a lot of the common errors and frustrations that sit within CPython.

2 Likes