Skip to content

Instantly share code, notes, and snippets.

View MutugiD's full-sized avatar

Mutugi MutugiD

View GitHub Profile
@MutugiD
MutugiD / ifc_recolor_to_glb.py
Last active June 23, 2026 17:37
IFC walls/slabs -> red -> GLB (ifcopenshell 0.8 + IfcConvert)
"""
ifc_recolor_to_glb.py
Load an IFC, paint every wall and slab red, write the model out, and convert it
to GLB with the official IfcConvert binary.
What it does: keeps ONLY IfcWall/IfcSlab (inheritance-aware, so *StandardCase subtypes
count), assigns a red IfcSurfaceStyle to their representation items (recursing through
IfcMappedItem), writes a temp IFC, and runs `IfcConvert --y-up --use-material-names`.
Tested: ifcopenshell 0.8.5 / IfcConvert 0.8.5 / Python 3.12 on a synthetic IFC4 fixture
and the buildingSMART PCERT Building-Architecture.ifc (IFC4) - every wall/slab verified
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.