--- name: cad-bim-file-conversion description: Convert/download CAD and BIM deliverables for user handoff, especially DXF/DWG/RVT/SKP/IFC workflows for SketchUp or architectural review. --- # CAD / BIM File Conversion Use this when the user provides a real-estate/architectural download link or asks for files to be converted between CAD/BIM formats such as DXF, DWG, RVT, IFC, SKP, PDF floorplans, or SketchUp-compatible deliverables. ## Workflow 1. **Download everything first.** - Use the browser if the link is a download center with buttons/forms. - Also inspect visible direct links; providers sometimes expose CDN URLs. - Preserve originals in a task output directory. 2. **Do not trust displayed file extensions or CDN suffixes.** - Real estate delivery platforms may show every file as `.pdf` even when the bytes are DXF, DWG, RVT, etc. - Always run `file` or equivalent magic-byte detection after download. - Rename/copy files to their real extensions before processing. 3. **Choose the conversion path by source format.** - **RVT → IFC / RVT → browser preview:** Best done with Revit/Autodesk tooling. On Linux, treat clean RVT export or full RVT tessellation as unavailable unless a converter/service is installed. If the user compares against Autodesk Viewer and expects windows, doors, families, materials, category tree, and Autodesk-like navigation, do **not** substitute DXF/IFC fallback geometry and call it equivalent. Preserve/upload the RVT as source-of-truth and route the real fidelity path through Autodesk Platform Services (APS/Forge) model translation + Autodesk Viewer, or an actual Revit export pipeline. For app integration details, use `references/aps-rvt-autodesk-viewer.md`. - **DWG → IFC:** Requires DWG-capable tooling (ODA/AutoCAD/FreeCAD stack if available). Verify geometry after conversion. - **DXF floorplan → IFC:** Can produce a usable IFC from linework with `ezdxf` + `ifcopenshell` by creating IFC4 wall/proxy geometry from polylines/lines. - **DXF/IFC linework → SketchUp import:** If the user asks for `.skp` but no real SketchUp writer is available, generate a SketchUp-importable Collada `.dae` from centered/extruded linework and optionally package it as `.kmz`; see `references/sketchup-importable-dae-kmz.md`. - **PDF floorplan → IFC:** Use only as visual/reference input unless OCR/vector extraction is explicitly needed; prefer CAD sources when present. 4. **For a Linux DXF → IFC fallback:** - Install/use Python packages `ezdxf` and `ifcopenshell` if available. - Read modelspace linework/polylines. - Detect units via `$INSUNITS`; common DXF unit code `4` is millimeters. - Center coordinates near origin to avoid huge-world-coordinate import issues. - Convert mm to m when creating IFC SI geometry. - Create an IFC4 project/site/building/storey hierarchy. - Extrude linework as thin wall geometry using `ifcopenshell.api.geometry.create_2pt_wall` or create proxy/mesh geometry when walls are inappropriate. 5. **Verify before sending.** - Re-open the generated IFC with `ifcopenshell.open`. - Report schema and object counts. - Send the converted file directly, plus a concise caveat about fidelity if the source was only DXF linework. 6. **If the task expands into a browser BIM review app:** - Use the pattern in `references/browser-bim-review-studio.md`. - Parse IFC metadata server-side and expose schema/entity counts in the project library. - Do not ship fake/count-driven 3D as if it were model geometry. If real geometry is not ready, show an honest placeholder plus source/download actions. - For a real browser preview, generate/load GLB: renderable IFC via `ifcopenshell.geom` → `trimesh` → GLB, or DXF linework via `ezdxf` extruded segments → `trimesh` → GLB. Verify the browser visibly loads real geometry before calling it done. - If the source is RVT and the user wants the Autodesk Viewer experience, the class of solution changes: implement APS/Autodesk Viewer (OAuth/token service, OSS upload, model derivative translation, URN loading) rather than improving a Three.js fallback. Three.js `OrbitControls` can improve navigation for GLB/DXF previews, but it does not recover missing Revit semantics. ## User-facing handoff style Keep the reply compact: - State that the file is done. - Attach the IFC file via `MEDIA:/absolute/path/file.ifc`. - Include one clear caveat if it is a fallback conversion rather than a native RVT/DWG export. - Mention where originals were saved only if useful. ## Pitfalls - Do not claim a clean BIM export from RVT unless Revit/Autodesk/IFC exporter actually ran and was verified. - Do not present a DXF-derived GLB, IFC fallback, or simplified mesh preview as equivalent to Autodesk Viewer opening the native RVT. If Autodesk Viewer shows windows/families/elements that the app preview lacks, acknowledge the fidelity gap immediately and switch to an APS/Revit translation plan. - Do not claim a native `.skp` unless SketchUp desktop or an actual SketchUp SDK writer ran and the output was verified. On Linux, prefer honest SketchUp-importable `.dae`/`.kmz` fallbacks. - Do not rely on the filename shown by a download portal; confirm the file type by bytes. - Avoid sending huge zip bundles unless the user asked for originals; IFC alone is usually the useful output for SketchUp. - Preserve originals so the user can later hand them to a Revit/AutoCAD operator if a higher-fidelity export is needed. ## References - `references/aryeo-cad-download-center.md` — provider quirk: Aryeo/CDN files may be served with `.pdf` URLs while containing DXF/DWG/RVT bytes, plus a proven DXF-to-IFC fallback pattern. - `references/sketchup-importable-dae-kmz.md` — fallback pattern for producing SketchUp-importable `.dae`/`.kmz` handoffs when native `.skp` export is unavailable. - `references/browser-bim-review-studio.md` — pattern for lightweight authenticated CAD/BIM upload + IFC metadata + browser preview portals, including the placeholder-vs-true-geometry caveat. - `references/aps-rvt-autodesk-viewer.md` — production pattern for RVT → Autodesk OSS/Model Derivative SVF2 → Autodesk Viewer integration in a browser app.