--- name: revit-schedule-quantities description: Turn Revit schedules (exported as CSV through a Revit MCP server's export tool, or by the user) into a clean quantity table by work item, with units normalised, sources traceable and anomalies flagged, ready for unit-price analysis or a bill of quantities. Use when the user asks for quantities from Revit, "cantidades desde Revit", "metrados de las tablas de planificación", a BOQ from schedules, or to connect Revit to a budget. --- # Revit schedules to quantities ## Inputs - One or more schedules as CSV (walls, floors, structural framing, columns, doors, windows, rooms...). With the official Revit MCP Server, the Export View tool exports a schedule view to CSV; otherwise the user exports from Revit (View > Export > Reports > Schedule). - The cost structure to map to (the user's budget chapters / work breakdown, e.g. their APU list or MasterFormat/Uniformat codes they already use). ## Procedure 1. Read each CSV. Detect header rows, totals rows and grouping rows (Revit exports them as text); keep only element rows. 2. Normalise units: strip unit suffixes ("m²", "m³", "mm"), convert to m, m², m³ and record the original unit. Never mix units in one column. 3. Map each row to a work item with explicit rules (e.g. "Wall type contains 'Bloque 12' -> Mampostería bloque 12 cm, unit m², quantity = Area"). Show the mapping table to the user before totalling. 4. Totals per work item and per level/zone if the schedule has a level column. 5. Flag: rows with zero or blank quantities, types not mapped, suspicious ratios (e.g. wall area / floor area outside the range the user gives), duplicated element ids. 6. Hand off to `apu-builder` (prices) or export a BOQ CSV. ## Output - Mapping table (type -> work item -> unit -> source column). - Quantities table with source schedule and element count per item. - Flags list. ## Never - Never add waste factors to quantities silently; waste belongs in the APU, stated. - Never fill a missing quantity with an estimate; list it. - Revit "Area" for walls depends on the schedule's settings and openings; say which field was used.