2

With the revitpythonshell 2020 I try to import the class ExporterIFCUtils

from Autodesk.Revit.DB.IFC import ExporterIFCUtils

and get the error:

"Exception : IronPython.Runtime.Exceptions.ImportException: Cannot import name ExporterIFCUtils"

Cfun
  • 8,442
  • 4
  • 30
  • 62
StefanAnd
  • 21
  • 2

1 Answers1

1

@StefanAnd you'll need to add a reference to the RevitAPIIFC.dll first:

>>> clr.AddReference("RevitAPIIFC")

>>> from Autodesk.Revit.DB.IFC import ExporterIFC
>>> ExporterIFC
<type 'ExporterIFC'>
>>> 

It's a bit weird, since it looks like you're importing from a module, but it's a .NET "namespace". These can span multiple assemblies as in the case here, so first referencing the RevitAPIIFC.dll will populate the namespace with the types you expect. Sadly, the Revit API documentation doesn't actually seem to provide the assembly names. At least, I couldn't find them...

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200