Facet Products
This is a simple sample program for the IFC Faceting library. It creates meshes for all of the geometry in a file, and then traverses each IfcProduct, finds the IfcRepresentation associated with it, then prints some details.
The example uses the Duplex_Electrical_20121207.ifc file shown below, but you can easily change it to take any file from the command line. This data comes from the BuildingSmart collection of sample data.
The program calls rosemesh_worker_render_design() to schedule all geometry for faceting. The faceting uses multiple threads as a background task. This program waits for everything to be completed, but a more advanced program might do something else while the faceting is progressing.
Next, the program traverses the IfcProduct structure and examines each associated IfcRepresentation item. Each representation item is tested with ifcmesh_find_shell() function to see if it has meshed IFC geometry. Mesh and placement details are printed.
The PRINT_ALL_TRIANGLES global flag controls whether the program prints summary data or coordinates and normals for all triangles. The placement transform associated with the product is used to transform the coordiates to the final destination in space.
![](facet_products.png)