Is there a way we can access the IFCexporter (app from Autodesk) so I can automate the process of creating IFC’s?
Right now
I create IFCExportOptions() according to the settings (json) of the IFCexporter
but this revit.doc.Export has a different output compared to creating an ifc through IFCexporter.
I think the issue is in the name of the dll. Because when I import Autodesk.IFC.Export.UI it will look in the default Autodesk library (e.g. from Autodesk.Revit.DB import FilteredElementCollector).
When inspecting the dll with dotpeek, you can clearly see the BIM.IFC.Export.UI classes.
I could not figure it out at first…
Hopefully I am stubborn enough:
import clr
clr.AddReferenceToFileAndPath(r'C:\\ProgramData\\Autodesk\\ApplicationPlugins\\IFC 2024.bundle\\Contents\\2024\\IFCExporterUIOverride.dll')
import BIM #access the referenced DLL IFCExporterUIOverride
from pyrevit import script
from pyrevit import DB, revit
doc = revit.doc
output = script.get_output()
output.close_others()
ifc_export_options = DB.IFCExportOptions() # export options for IFC from the Revit default configurator
active_view_id = doc.ActiveView.Id
ifc_export_options.FilterViewId = active_view_id
IFC_exporter_configuration_override = BIM.IFC.Export.UI.IFCExportConfiguration.CreateDefaultConfiguration()
# print(dir(BIM.IFC.Export.UI.IFCExportConfiguration)) # to figure out the members of the class
# just a sample
IFC_exporter_configuration_override.VisibleElementsOfCurrentView = True
IFC_exporter_configuration_override.Export2DElements = True
IFC_exporter_configuration_override.UpdateOptions(ifc_export_options, active_view_id)
with revit.Transaction('Export IFC'):
doc.Export("C:\\pyRevit", 'test.ifc', ifc_export_options)