This script extracts the width, length, and height of each IfcColumn by generating its mesh using IfcOpenShell.geom. Instead of relying on IFC parameters such as XDim, YDim, or ZDim, it computes dimensions directly from the bounding box derived from the column’s geometry. To ensure consistent processing, all raw IFC geometries are unified into a mesh representation. This standardization resolves inconsistencies across different geometric formats, such as extrusions, sweeps, and mesh-based models.
As a result, the script remains effective even when explicit dimensions are missing or when the column’s shape cannot be obtained from predefined IFC properties.
- Loads the IFC file and enables world-coordinate geometry extraction.
- Iterates through all IfcColumn elements in the model.
-
Creates a mesh geometry using ifcopenshell.geom.create_shape().
-
Extracts all vertex coordinates of the mesh.
-
Computes the minimum and maximum XYZ values.
-
Calculates a geometric bounding box as:
- width → the smaller side of the column
- length → the larger side of the column
- height → the Z extent
(Note: if you are dealing with circular columns, you can replace the width variable to diameter since it has the same process as tested)
-
Converts all values from meters (m) to millimeters (mm).
(Note: ifcopenshell.geom always outputs geometry in meters regardless of IFC project units.) -
Prints the extracted dimensions.
-
Saves the results into a CSV file named columns_output.csv with columns:
["GlobalId", "Width_mm", "Length_mm", "Height_mm"].