Specifying color of a single IfcFace

We need to export a model to IFC2x3 (and IFC4) that specifies a different color for every IfcFace of an IfcFacetedBREP. I’ve tried doing it like this (below), but I can’t find a single IFC viewer that will import these colors. Is there a better way to create such colorful BREP solids?

#183688=IFCFACETEDBREP(#183687);
. #183687=IFCCLOSEDSHELL((#379103…);
. . #379103=IFCFACE((#379102));
. . . #379102=IFCFACEOUTERBOUND(#379101,.T.);
. . . . #379101=IFCPOLYLOOP((#329731,#329732,#329733,#329734));
. . . . . #329731=IFCCARTESIANPOINT((28.9,-46.3,136.8));
. . . . . #329732=IFCCARTESIANPOINT((27.4,-50.5,111.1));
. . . . . #329733=IFCCARTESIANPOINT((26.8,-52.3,111.4));
. . . . . #329734=IFCCARTESIANPOINT((28.8,-46.7,136.9));
. . . #379108=IFCSTYLEDITEM(#379103,(#379107),$);
. . . . #379107=IFCPRESENTATIONSTYLEASSIGNMENT((#379106));
. . . . . #379106=IFCSURFACESTYLE(‘Color’,.BOTH.,(#379105));
. . . . . . #379105=IFCSURFACESTYLERENDERING(#379104,$,$,$,$,$,$,$,.MATT.);
. . . . . . . #379104=IFCCOLOURRGB($,0.6,0.7,0.8);

1 Like

For what it’s worth we do it exactly as you described IfcFaceIfcStyledItem. Except for SurfaceStyleShading instead of Rendering and without IfcPresentationStyleAssignment in IFC4 (deprecated).

Looks like at least FZKViewer imports them correctly.


colors.ifc (21.5 KB)

I can confirm. It’s valid, but not supported universally. In IFC4 you can also experiment with IfcIndexedColourMap applied to a tesselated faceset, but I’m not sure if support for that is any better (for what it’s worth, IfcOpenShell has implemented support for neither IfcIndexedColourMap nor individually styled faces).

If the application of colours is more important than topology, you can export them as a set of open shells.