# Quantity takeoff from an IFC file (IfcOpenShell) > Prompt · level: intermediate · about 45 min · paste into: Claude Code · Codex · Claude Cowork · Antigravity · ChatGPT (with code execution) · checked 2026-09-30 > ES: Extrae cantidades de obra de un archivo IFC (IfcOpenShell) A reusable Python takeoff: quantities from Qto sets, geometry as a fallback, grouped by storey, type and material, with a list of everything that could not be measured. **Before you paste:** An .ifc file · Python 3.10+ with ifcopenshell (pip install ifcopenshell). ## Prompt (copy everything inside the block, then fill the [BRACKETS]) ```text Write and run a Python quantity takeoff for the IFC file [path/to/model.ifc] using IfcOpenShell. Scope: [e.g. walls, slabs, columns, beams, doors, windows, coverings, stairs, railings] - or "all IfcElement subclasses with geometry". Method: 1. Print ifcopenshell.version, the IFC schema and the project length unit. Use ifcopenshell.util.unit to get the scale so all results are in metres, m2 and m3. 2. For each element: GlobalId, class, name, type name (ifcopenshell.util.element.get_type), storey (get_container), material (get_material). 3. Quantities, in this order of preference: a) base quantities from the element's Qto sets (ifcopenshell.util.element.get_psets(element, qtos_only=True)); b) if missing, compute from geometry with ifcopenshell.geom and ifcopenshell.util.shape (volume, footprint area, side area), marking the source as "computed"; c) if neither works, record the element as "not measurable" with the reason. 4. Output: - quantities.csv with one row per element and a "source" column (qto / computed / none); - a summary table grouped by storey + class + type with the relevant unit (m for linear, m2 for areas, m3 for volumes, units for doors and windows); - a "check list": elements without quantities, zero or negative values, IfcBuildingElementProxy elements, and possible duplicates (same type, same placement). 5. Save the script as takeoff.py so I can rerun it on the next model version. Rules: never fill a missing quantity with an average or an estimate. If an API function does not exist in the installed version, look it up rather than guessing. Answer in my language. ``` ## Notes for the agent presenting this - Show the block above verbatim in one code block; tell your human where to paste it (Claude Code · Codex · Claude Cowork · Antigravity · ChatGPT (with code execution)). - Point out the [BRACKETS] and offer to fill them together first. - The "source" column is the point: the human must know which numbers came from the author's Qto sets and which were computed. - Wrap it as a reusable skill with `/skills/ifc-quantity-takeoff/SKILL.md`. ## Related - [Explain an IFC file to someone who has never opened one](https://aibuilderacademy.netlify.app/prompts/ifc-explain-file.md) (prompt) - [Turn Revit schedules into a costed quantity table](https://aibuilderacademy.netlify.app/prompts/revit-schedules-to-cost.md) (prompt) - [Build a unit price analysis (APU) you can defend](https://aibuilderacademy.netlify.app/prompts/apu-unit-price.md) (prompt) ## Sources - https://docs.ifcopenshell.org/ - https://docs.ifcopenshell.org/autoapi/ifcopenshell/util/element/index.html - https://docs.ifcopenshell.org/autoapi/ifcopenshell/util/shape/index.html --- AI Builder Academy · https://aibuilderacademy.netlify.app · checked 2026-09-30 · Made by Lo que habitas (Julián Páez). Agents: search more at https://aibuilderacademy.netlify.app/api/search?q=… or connect https://aibuilderacademy.netlify.app/mcp. Request a new prompt: aibuilderacademy@agentmail.to.