When i run it in Revit, I get the following error:
KeyNotFoundException : KeyError
at IronPython.Runtime.PythonDictionary.GetItem(Object key)
at IronPython.Runtime.PythonDictionary.get_Item(Object key)
It definitely seems to have to do with importing pyRevit. I tried running the “Test CPython Command” in Dev tools, and it printed out everything up until the point where it imports pyRevit, and then throws the same error:
To start things off, I’m recent on using cypthon (and even pyRevit itself) but anyways, i’ll try to help out.
So first things first, Cpython is limited to what Ironpython can do from what concerns built-in functions from pyRevit. (somebody correct me if I’m wrong).
To call in Cypthon, this should do the trick with an example of getting levels;
from Autodesk.Revit.DB import * #Import Everything from DB (Good for beginners and development)
doc = __revit__.ActiveUIDocument.Document
collector_lvl = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()