Skip to content

Extend ifc.py — extended IFC export helper#3147

Merged
jmcouffin merged 4 commits intopyrevitlabs:developfrom
Wurschdhaud:feature-ifc-lib
Mar 2, 2026
Merged

Extend ifc.py — extended IFC export helper#3147
jmcouffin merged 4 commits intopyrevitlabs:developfrom
Wurschdhaud:feature-ifc-lib

Conversation

@Wurschdhaud
Copy link
Contributor

Description

The existing ifc.py lib only bootstraps the Ifc.Net CLR assembly (schema/geometry types). It provides no support for driving Revit's own IFC export pipeline. This PR extends ifc.py, with a thin wrapper around Autodesk.Revit.DB.IFCExportOptions that fills that gap.

What's new

  • load_config(path) — parses a Revit-exported IFC configuration JSON file
  • build_export_options(config, overrides) — maps JSON keys onto IFCExportOptions properties and AddOption calls, handles nested keys (ProjectAddress, ClassificationSettings), and includes a workaround for the Revit tessellation decimal-separator bug (.,)
  • IFCExporter(doc).export(...) — one-call export with optional config file, runtime overrides, view filter, and console logging
  • script.py — developer-tab test script with folder/config picker and output panel logging

Why the tessellation workaround is in the lib

Revit's IFC exporter plugin reads TessellationLevelOfDetail from AddOption and parses it with the system locale, which expects a comma as the decimal separator on non-English Windows installs (and inconsistently on EN installs too). Normalising it here keeps every call site clean.

Testing

Tested against Revit 2024, IronPython 2.7, with the attached IFC_config_sample.json. Run ExportIFC from the Developer tab against any open document to verify.


Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

@devloai
Copy link
Contributor

devloai bot commented Feb 28, 2026

Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends pyrevitlib/pyrevit/interop/ifc.py from a simple Ifc.Net bootstrapper into a helper library that can parse Revit-exported IFC JSON configs, build Autodesk.Revit.DB.IFCExportOptions, and drive Revit’s IFC export via a small IFCExporter wrapper.

Changes:

  • Added load_config() to parse Revit IFC export configuration JSON.
  • Added build_export_options() to map config/overrides into IFCExportOptions (including tessellation decimal-separator workaround) and optional view filtering.
  • Added IFCExporter(doc).export(...) to perform a one-call IFC export with optional config/overrides.

Wurschdhaud and others added 3 commits February 28, 2026 21:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jmcouffin jmcouffin merged commit 7ab3336 into pyrevitlabs:develop Mar 2, 2026
@Wurschdhaud Wurschdhaud deleted the feature-ifc-lib branch March 2, 2026 08:49
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1027-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1126-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1139-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1233-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1244-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1357-wip

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1403-wip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants