
The first step is to create a viewer for your IFC model and set up an input table where you can define which parameters to add to which element types. For this tutorial, we will add carbon emission factors to slabs, walls, columns, and beams.
To test the result of the prompt, download this model and save it on your computer, so you can upload it in your app later.
Below you can run the prompt to directly build this app:
Now we'll use the input table to actually add the parameters to your IFC elements. The app will create property sets for each element class and show you the updated model.
1Now use the input table to create a dedicated property set on each element for its IFC class. 2 3Generate a new IFC view that showcases the updated model. When reading the IFC file, load it in binary and decode it to text before processing. 4 5Also, when using `ifcopenshell.api` for property sets, first create the pset with `add_pset` (which returns the pset object), then separately add properties to it using `edit_pset` with that pset object — do not pass properties directly to `add_pset`. 6 7Use `to_string()` instead of `write()` when exporting to avoid BytesIO error
A useful built-in feature of the IFC viewer is that you can simply click the download icon to get the updated IFC with the new properties, so there’s no need to create an extra download component.
With the parameters now in place, let's create a visual dashboard that shows the carbon emissions for each building level. You'll be able to select different floors and see the breakdown by element type.
1Now, building on the previous step, use the updated model to create a dashboard in a single PlotlyView.
2
3First, filter the model by `IFCBUILDINGSTOREY`. For each level, create a pie chart showing the total carbon emissions for that level (multiplying the `EmissionFactor` by the `GrossVolume` of each element). Add a dropdown menu to the Plotly chart that allows you to select and display a single building storey at a time.
4
5IMPORTANT: Use exactly these IFC class names and capitalization: `IfcSlab`, `IfcColumn`, `IfcWall`, `IfcBeam`and Reuse these exact strings everywhere you refer to the IFC classes in the code (including calls to `by_type` and comparisons with `element.is_a()`).
The app you just built is a starting point. You can extend it with more prompts to add features that fit your workflow:
In just a few minutes we built a viewer, added custom parameters, and created a dashboard to visualize IFC models. You can modify these prompts to add different properties like fire ratings, construction phases, or cost data. The same approach works for other tasks too, whether you need to compare IFC versions, run clash detection, or split models by discipline. Instead of writing scripts from scratch each time, you can describe what you need and have a working tool ready to go.
Subscribe to our newsletter and get the latest industry insights