4.1 KiB
Input Formats and Conversion Branches
Contents
- Supported inputs
- DWG conversion selection
- XREF and cached-block handling
- 3DSOLID/MESH branch
- PDF boundary
- Dependencies and portability
Supported Inputs
Use this skill directly for architectural DWG/DXF drawing folders and DXF files produced by the bundled WASM bridge. Preserve source folders and write conversions under work/.
For multi-discipline sets, model from 建筑 by default. Pull 结构 later for columns/beams only when the requested showcase needs them. Never feed architecture, structure, MEP, and site drawings into one extraction config.
DWG Conversion Selection
Run cad_showcase.py inspect or cad_dxf_report.py with an explicit converter policy:
--converter auto: use libredwg first and retry failed/zero-entity conversions with ODA.--converter libredwg: require libredwg and do not change converter silently.--converter oda: use ODA for every DWG. Choose this for known 3DSOLID/ACIS drawings and TArch files known to break libredwg.
Tool discovery is environment variable, PATH, then platform defaults:
- Blender:
BLENDER-> PATH -> macOS/Windows install defaults. - ODA:
ODA_CONVERTER-> PATH -> macOS/Windows install defaults.
ODA requires existing absolute input/output directories. On macOS the command shape is ODAFileConverter <abs_in_dir> <abs_out_dir> ACAD2004 DXF 0 1 "*.dwg"; create both directories first. Bad arguments are often reported only through a GUI dialog, with empty stderr, and the process may return exit 0 while producing nothing. Treat “exit 0 + no DXF” as failure, check the screen for a blocked dialog, and keep the script's ASCII staging plus produced-file verification.
If native converters are unavailable, use the tested WASM bridge:
npm install --prefix work/vendor-js @mlightcad/libredwg-web
node scripts/dwg_dump_json.mjs input.dwg work/dump.json \
--module-dir work/vendor-js/node_modules
python3 scripts/dwgjson_to_dxf.py --json work/dump.json --out work/dxf_raw/input.dxf
The bridge carries LINE/POLYLINE/ARC/CIRCLE/ELLIPSE/SPLINE/TEXT/INSERT and block definitions. It drops HATCH/DIMENSION/ATTRIB; record that limitation and do not infer hatch-only columns or attribute-held axis labels from the result.
XREF and Cached Blocks
cached_xref_content: the file contains INSERT stubs plus cached block definitions. Expand blocks in detect/derive; do not ask for a re-export.likely_xref_shell: the referenced geometry is absent. Ask the user to bind/insert XREFs and re-export DXF.has_xref_definitions: verify that no essential external content is missing before modeling.
Never treat an unresolved XREF shell as a completed floor.
3DSOLID/MESH Branch
Force ODA before inspecting known solid models because libredwg can keep annotations while silently dropping ACIS data. Then run:
python3 scripts/extract_3d_solids.py \
--dxf work/dxf_sanitized/model.dxf \
--out-glb outputs/model/solids.glb \
--out-obj outputs/model/solids.obj \
--report outputs/model/solids_report.json
The extractor supports DXF MESH and flat polygonal ACIS faces. It counts cone/sphere/spline/torus/cylinder/swept/revolution surface records as unsupported. If curved records dominate, request OBJ/STL/STEP exported by AutoCAD, BricsCAD, or another full CAD kernel. Label partial output honestly.
PDF Boundary
This skill does not natively reconstruct CAD geometry from PDF. For PDF-only input:
- ask for DWG/DXF when precision matters;
- or use a separate PDF/vector/OCR workflow with explicit scale calibration before invoking this skill;
- never treat raster tracing as CAD-equivalent geometry without dimensional evidence.
Do not advertise PDF support merely because a floor plan is visible in a PDF.
Dependencies and Portability
Install deterministic dependency sets in the project environment:
python3 -m pip install -r requirements-core.txt
python3 -m pip install -r requirements-delivery.txt
Use cad_showcase.py doctor before a full run. On Windows set PYTHONUTF8=1 and enable long paths for deep Chinese file names. Keep optional Blender/IfcOpenShell branches separate from the core Python path.