Files
cad-building-showcase/SKILL.md
zhengwr 6ace84ffba Campus pipeline hardening: backend parity, wall union, mullion grids, Draco tooling
Sandbox round (Linux):
- detect_sheet_frames.py: multi-frame sheet splitter (column AND row layouts),
  grid-vote per-floor offsets, section-elevation harvesting for storey heights
- dwg_dump_json.mjs + dwgjson_to_dxf.py: WASM libredwg DWG->DXF fallback
  (blocks/INSERT preserved, ATTRIB->TEXT so axis labels survive)
- assemble_campus.py: manifest-driven campus assembly with mandatory
  neighbour-gap gate (overlap = exit 3, 0.1-0.3m flagged as expansion joints)
- site_context_from_dump.py: site-context floors (ground/roads/parking/
  fence/trees/context massings) from site-plan dumps
- write_offline_viewer.py + assets/offline-viewer-libs/: fully-offline
  single-file viewer (vendored three r147 + pako, gzip-embedded GLB)
- audit: clip-scoped coverage figures; report: multi_frame_sheet warning;
  audit gate floors_aligned catches the diagonal-staircase failure mode

Mac round:
- build_blender_showcase.py now honors slab_bounds_fallback and prefers
  footprint polygons for generated roofs (bounds rects made roof plates jut
  past the facade and buried campuses under full-extent slabs); contract now
  matches spec_to_glb.py exactly
- merge_wall_solids (default off) in BOTH backends: shapely union in
  spec_to_glb.py, native delaunay_2d_cdt union in Blender; endpoint-shared
  wall ends pre-extended w/2 so L-corners close seamlessly (flat caps leave
  a notch a union alone cannot fill) while openings stay flat
- glazing_mullions (default off): curtain-wall panel grid (verticals every
  glazing_panel_w + floor-line transoms) as pseudo wall segments in the
  <floor>__walls node; glass pane kept
- build_showcase_variants.py keeps source_file=="site" floors intact in all
  variants (roads/trees live on filtered categories)
- web template: instanced low-poly trees from metadata site_trees,
  grade-level shadow catcher (was at basement depth), data-URI favicon
- tools/compress.mjs deps pinned (package.json); 15MB campus GLB -> 0.57MB
- tests: 24 -> 52 checks (wall union, mullions, byte-identical defaults)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 17:44:41 +08:00

29 KiB

name, description
name description
cad-building-showcase Agent-led workflow for generating and auditing architectural 3D web showcase models from CAD drawing folders. Use when Codex is given DWG/DXF/PDF CAD plans, XREF folders, floor plans, building drawings, or asks like "用 CAD 图纸生成 3D 建筑演示模型", "把所有 CAD 图纸做成 Web 展示模型", "DWG/DXF 转 Blender/GLB", "建筑平面图生成完整建筑展示模型", or asks whether CAD-derived output can replace BIM. This skill is specifically for cases where an Agent must inspect CAD reports, decide layer/floor/block rules, run scripts, audit coverage, and iterate; not for blind one-shot script conversion.

CAD Building Showcase

Outcome

Create a usable architectural demonstration model through Agent judgment plus deterministic scripts. Do not treat this as blind CAD conversion. The target deliverables are:

  • CAD read report: converted/sanitized DXF inventory, layer counts, entity counts, drawing bounds, likely units.
  • Agent extraction config: explicit layer mapping, floor split/alignment, unit scale, curve and filtering rules.
  • building_spec.json: normalized floor-by-floor geometry in meters.
  • Extraction audit: coverage, unclassified layers, high-risk entity types, block/INSERT signals, and Agent questions.
  • 2D overlay review: SVG overlays comparing source CAD vectors with extracted model geometry.
  • Blender scene: .blend, .glb, and preview .png.
  • Web showcase: static Three.js viewer with floor/component toggles, floor explode, section height, camera presets, screenshot, and GLB download.
  • Lightweight variants: produce at least overview, standard, and detail GLB variants when the user asks for Web/digital-twin presentation. The Web viewer should default to the standard variant and expose download links for all variants.
  • Notes file: source drawings, assumptions, extraction limits, and verification results.

If the user asks to replace BIM, branch explicitly to IFC/BIM validation. Treat Web showcase and BIM replacement as separate products.

Agent Decision Loop

The Agent owns interpretation. Scripts are tools for evidence and repeatable execution.

  1. Inspect first, do not model blind.

    • Run cad_dxf_report.py.
    • Read top layers, entity types, bounding boxes, units, and high-risk entities.
    • Form hypotheses: which drawings are floor plans, which layers are walls/glazing/roof/columns/beams/railings/doors/detail lines/grid, whether blocks or hatches matter, and how floors align.
  2. Write an explicit extraction config.

    • Decide layer mappings, floor splits, offsets, origin strategy, curve chord length, and category-specific line-length filters.
    • Use references/pipeline.md, references/building_spec_schema.md, and references/a208_case_notes.md as calibration.
  3. Extract, audit, and review overlays before accepting.

    • Run derive_showcase_spec.py.
    • Run audit_showcase_extraction.py.
    • Run draw_coverage_overlay.py.
    • Inspect unclassified layers, high-risk INSERT/HATCH counts, and overlay SVGs. If major geometry is red/unclassified or missing, adjust config or parsing strategy and repeat.
  4. Generate and verify the 3D/Web model only after the extraction passes review.

    • Run Blender/GLB generation and Web template assembly.
    • Verify preview image, Web controls, console logs, and mobile layout.
  5. Report confidence and limits.

    • State whether the output is Web showcase, LOD-like massing, IFC/BIM proof, or not sufficient.
    • Include what was not modeled and what evidence supports that judgment.

One-Shot Definition of Done

The pipeline is designed so a first pass either succeeds or STOPS at a loud gate. Do not hand over a model unless every line below has evidence (a report line, a gate status, or an image):

  1. Read report clean: every Warnings entry resolved. multi_frame_sheet -> ran detect_sheet_frames.py and used its clip/offset config; likely_xref_shell -> user re-exported with XREFs bound.
  2. Frame alignment proven: detect report shows grid-aligned, votes x>=3 y>=3 per floor (any WEAK grid match floor was verified on its overlay SVG).
  3. Audit exit code 0, and gates floors_aligned / glazing_captured / no_annotation_layers_classified all PASS. Never pass --no-strict-gates to proceed.
  4. No WARNING topless_group from derive (roof handled via caps or roof_specs), and no WARNING mesh_from_polygons from the GLB build (else slabs/roofs silently vanished — install mapbox_earcut).
  5. Visual check done by the Agent, not assumed: verify_showcase.py previews plus one rendered iso/plan image actually LOOKED AT (floors stacked, roof present, no slab fins beyond facade — default cap_buffer 1.3 is for colonnades, use ~0.1 otherwise).
  6. Campus placement (if 总图/定位图 exists): building envelope dims match the site rect 1:1 (e.g. 面积核算 frame), rotation taken from the rect edge angle, 180° flip disambiguated by an asymmetric feature (machine rooms / basement / entrance), and a top-view overlay image confirms the building inside its site rect. Neighbour gaps measured numerically: no overlaps, 贴建 joints 0.15-0.3 m with corroborating evidence, buildings inside 红线.
  7. tests/test_extraction_pipeline.py passes after ANY script change.

Command Workflow

  1. Prepare the CAD folder.

    • Work from a folder under the current workspace when possible. On macOS, avoid direct reads from Downloads if TCC blocks access; ask the user to move/copy the CAD folder into the workspace.
    • Preserve the original CAD folder. Put converted/intermediate files in work/.
    • If DWG files are present, prefer libredwg dwg2dxf for batch conversion. Use ODA/QCAD/FreeCAD only as fallback — EXCEPT for drawings containing 3DSOLID/ACIS entities: libredwg silently drops ACIS data (R2013+ stores it in the ACDSDATA section), so 3D-solid DWGs must go through ODA File Converter (/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter <abs_in_dir> <abs_out_dir> ACAD2004 DXF 0 1 "*.dwg"). ODA reports bad arguments via GUI dialogs, not stderr: both directories must exist as absolute paths, and a silent exit-0 with no output means a dialog is blocking on screen.
    • No native converter available (Linux sandbox, no ODA/libredwg)? Use the WASM fallback: npm install @mlightcad/libredwg-web, then node scripts/dwg_dump_json.mjs in.dwg dump.json --module-dir <node_modules> and python3 scripts/dwgjson_to_dxf.py --json dump.json --out work/dxf_raw/file.dxf. This carries LINE/PLINE/ARC/CIRCLE/ELLIPSE/SPLINE/TEXT/INSERT + full block definitions (enough for the extraction pipeline), but drops HATCH/DIMENSION/ATTRIB — do not use it to judge hatch-only column fills or attribute-held axis numbers.
    • Multi-discipline sets (建筑/结构/给排水/电气/暖通 subfolders): model from 建筑 (architecture) only by default; pull 结构 later just for columns/beams if the showcase needs structure. Never feed all disciplines into one extraction pass.

    3D-solid DWG branch: if the read report shows 3DSOLID/MESH as the main types (typically also flagged near_empty for plan purposes), the floor-plan extrusion pipeline does not apply. Convert via ODA, then tessellate with ezdxf.acis (load_dxf → mesh_from_body, which returns a list of meshes). Only polyhedral/flat ACIS faces tessellate; count curved records (cone-surface, spline-surface, ...) in the SAT text and report them as not extractable. Export captured meshes + MESH entities to OBJ/GLB (OBJ is Z-up: import into Blender with up_axis='Z'). If curved skin dominates, tell the user to export OBJ/STL/STEP from a full CAD kernel (AutoCAD/BricsCAD) instead of promising a complete model.

  2. Generate a CAD read report.

    • Run scripts/cad_dxf_report.py from this skill.
    • Install missing parser dependencies into the current project work area, not globally: python3 -m pip install --target work/vendor ezdxf
    • Inspect the Markdown/JSON report before modeling. Confirm drawings, units, bounding boxes, and the top layers for walls/glazing/roof/columns/beams/railings/doors/detail lines/floor lines/grid.
    • Resolve the report's Warnings section before modeling. likely_xref_shell / near_empty means a sheet's real geometry lives in unbound XREFs and will silently become a missing floor: ask the user to bind/insert the XREFs in CAD and re-export that DXF (do not model the shell and report the floor as done).
  3. Build the extraction config and building_spec.json.

    • Use references/pipeline.md and references/building_spec_schema.md.
    • Map CAD layers to normalized categories: walls, glazing, roof, columns, beams, railings, doors, detail_lines, floor_lines, and grid.
    • Identify one drawing per floor or split sheets that contain multiple floor plans side by side.
    • MULTI-FRAME SHEETS (the common Chinese pattern: one DWG per building holding ALL its plans + elevations + sections stacked in modelspace): run scripts/detect_sheet_frames.py on the sanitized DXF. It finds XX平面图 title texts (filtering catalog rows and title-block copies), proposes a wall-bbox-refined clip per floor frame, and computes per-floor offsets by voting-based grid-line correlation (label-free; TArch grids live on layer DOTE, not AXIS). Never model such a file as one floor (all sheets superimpose) and never stack frames without offsets (floors staircase away diagonally — the classic broken output). Read its report: WEAK grid match floors need overlay verification; elevation/section frames are listed for floor heights (z/height from DIM_ELEV 标高 texts like 8.100), not as floors.
    • Align floors by structural grid or repeated control axes. Use millimeters-to-meters scale (0.001) unless the report proves the CAD is already in meters.
    • Floor keys: floor_sort_key treats a leading B as basement (sorted below ground). Do not invent keys like B1F for "Building 1 Floor" — use per-building specs instead, and set explicit floor_order whenever keys are nonstandard.
    • When CAD linework has enough exterior/interior boundary signal, enable generated footprints for floor slabs and roof caps. Prefer footprint polygons over rectangular floor bounds for visual/digital-twin presentation.
    • Run scripts/derive_showcase_spec.py to extract line/polyline geometry into building_spec.json.
  4. Audit extraction before 3D generation.

    • Run scripts/audit_showcase_extraction.py.
    • Run scripts/draw_coverage_overlay.py.
    • The audit enforces hard gates and exits with code 3 on failure (e.g. glazing evidence exists in blocks but the spec has 0 glazing segments). A failed gate means the extraction is known-incomplete: fix the config or source export and re-run; never bypass with --no-strict-gates just to proceed.
    • The headline coverage ratio counts modelspace linework only. Read the Block-Locked Geometry By Layer section too — geometry inside INSERT blocks is reported separately and a 96% coverage can coexist with an entirely missing curtain wall.
    • CLIP-SCOPE CAVEAT: audit accounting is file-global while clip-based extraction is frame-scoped. On multi-frame sheets a healthy extraction can still show ~40% coverage and a block-locked WARN, because elevations/sections/details inflate the denominator. Judge such runs by the per-floor overlays and segment counts, not the headline ratio.
    • Review the Markdown audit and SVG overlays. Iterate config if important geometry remains unclassified or hidden in high-risk entity types.
  5. Generate Blender/GLB.

    • Use Blender CLI: /Applications/Blender.app/Contents/MacOS/Blender -b --python <skill>/scripts/build_blender_showcase.py -- --spec work/building_spec.json --out-dir outputs/<project> --name <project>
    • Use Blender MCP only after the CLI artifact exists, for inspection, scene tuning, or interactive refinement.
  6. Generate the Web showcase.

    • For digital-twin-style Web delivery, keep generated slabs visible by default and create three filtered specs/models:
      • overview: walls, glazing, roof, columns, beams, and generated slabs.
      • standard: overview plus railings and doors; use this as the default Web model.
      • detail: full extraction, including grid, floor lines, and detail lines for audit/review.
    • Run scripts/build_showcase_variants.py --build to write the filtered specs, call Blender for all three GLBs, and create variants_manifest.json.
    • Run scripts/write_web_showcase.py --variants-manifest ... to copy the template, use the standard model as model.glb, copy all variant GLBs, and add model_variants to model_metadata.json.
    • Use the single-GLB write_web_showcase.py --glb ... --metadata ... path only when the user explicitly wants a quick one-model preview.
    • Share-by-file delivery (no server, no network — mainland-China CDNs hang): scripts/write_offline_viewer.py --spec ... --glb ... --out viewer.html emits a fully self-contained HTML (three r147 UMD + pako inlined from assets/offline-viewer-libs/, GLB gzip-embedded, ACES + IBL + shadows + physical glass + instanced trees + grouped toggles + click-to-inspect, loading failures shown on screen). Smoke-test headlessly in node: decode the embedded payload and GLTFLoader().parse it.
    • Install local web deps in that output folder: npm install --prefix outputs/<project>/web three@0.181.2 lucide@0.468.0
    • Start a local server from the web output folder and give the user the URL.
  7. Verify before final delivery.

    • Open the preview PNG or render another screenshot; check that geometry is nonblank and framed.
    • Open the Web viewer in the Browser plugin on desktop and mobile widths.
    • Check console logs are clean, controls work, mobile panels do not overlap, and the GLB loads.
    • Report model precision honestly: showcase model, LOD-like massing/structural visualization, or IFC/BIM proof.
  8. Raise presentation quality when the user wants "digital-twin" polish.

    • Follow references/web_presentation_notes.md in tier order: official template + Draco + ACES/RoomEnvironment lighting + physical glass first (cheap, big win); then geometry upgrades (merged wall solids, mullion grids, road/green surfaces, instanced trees); then interaction (click-to-inspect from GLB extras, camera tours, progressive per-building loading).
    • Polish never excuses a wrong model, and enhancements derived from plan linework must not be presented as BIM-verified elements.

Multi-Building Campuses (厂区/园区 sets)

A folder like 建筑-1#厂房 / 2#厂房 / 3#辅房 / 总图 is a CAMPUS: several buildings plus a site plan — NOT floors of one building. Never map "one DWG = one floor" here.

  • Model each building separately: one detect-frames pass, one extraction config, one building_spec.json/GLB per building DWG. Small structures (机械停车坑/水池) are usually one or two frames.
  • Assemble with scripts/assemble_campus.py: record each building's transform (model anchor -> surveying anchor + campus rotation) in site_manifest.json and let the script do the merge — it also runs the mandatory neighbour-gap check automatically.
  • Units differ by sheet type: building plans are almost always millimeters (scale 0.001), while 总图 site plans are often METERS at real surveying coordinates (huge x/y like 349xxx/663xxx, texts ~2-4 units tall). The extraction config has a single global scale, so never mix a meters site plan and mm building plans in one spec.
  • Place buildings with a site manifest: from 总图/定位图 (prefer a "带轴号(可点坐标)" version if present) measure each building's anchor point and rotation, then assemble per-building GLBs in the viewer/scene with those transforms. Record the manifest (building -> position/rotation/source) in the notes file.
  • Proven placement recipe (贝昂 case): find the building's envelope rectangle in the site drawing (layer 面积核算/建筑轮廓线) — its edge lengths must equal the model's wall-envelope bbox 1:1 (here 90.2 x 42.2 m exactly), edge angle gives rotation (7.57°), the corner matching the model's (min x, min y) gives translation. Resolve the 180° flip by densest-feature voting (e.g. machine-room walls inside a known sub-rect). Then EITHER merge at spec level (transform all segments/footprints/caps into site-local meters and append a SITE context floor) and export one GLB, OR keep per-building GLBs plus transforms in the manifest. Pick a site-local origin (用地红线 min corner), never raw surveying coordinates — float32 breaks at 349 km.
  • Anchor placement on WALL evidence, never roof/eave envelopes: 屋面 outlines include canopies and asymmetric overhangs — concentric placement against one put 2# 0.45 m off (26 cm INSIDE its neighbour). Best anchors, in order: corner coordinate callouts (X=/Y= texts), wall lines, envelope rects whose edges equal the wall bbox exactly.
  • Adjacent-building gap sanity check is mandatory: compute the wall-to-wall gap in the shared-edge frame. ~0.15-0.30 m means 贴建 with an expansion joint (变形缝) — corroborate with the neighbour's roof labeled on this building's roof plan and matching floor elevations. Several metres means fire separation. A NEGATIVE gap (overlap) is always a placement bug. Cross-check the chosen position against the boundary: if a hypothesis (e.g. a 10 m fire gap) pushes the building through 用地红线, the hypothesis is wrong.
  • Site context is a deliverable, not decoration — a campus scene with only a few boundary lines reads as broken. Run scripts/site_context_from_dump.py on the 总图/定位图 dumps: it emits ready-to-merge floors for ground (用地红线 footprint slab), roads + parking stalls (lines, arcs, block-expanded 车位 INSERTs), fence (围墙 as 1.8 m railings), street trees (行道树 INSERT points as green posts, custom trees category), and low-confidence massings for context structures drawn only in the site plan (连廊/门卫/消控室, named by nearest label). It takes one plan-copy window (site sheets usually hold several scheme copies), a per-source unit scale (总图 in meters, 定位图 copies in mm), and an exclude-quad so the real building model replaces its own site outline. Buildings that have their own drawing sets get real models placed by the manifest — never fake them as massings.

TArch / 天正 t3 Export Preset (most Chinese architecture DWGs)

_t3 exports use TArch layer names that the AIA-style defaults miss. Calibrated mapping:

  • walls: ["WALL"], columns: ["COLUMN", "*COL*"], glazing: ["CURTWALL", ...], roof: ["屋面", "*屋顶*"], detail_lines: ["STAIR", "EVTR", "平面", "开口"], grid: ["DOTE", "AXIS"] — plan grids are on DOTE (dash-dot); AXIS often holds only detail-sheet stubs.
  • Doors and windows BOTH live on layer WINDOW as INSERTs, and the block geometry sits on layer 0 (inherits by insert), so layer-based block probing keeps NOTHING. Use explicit expansion plus block-name classification: "expand_blocks": ["$TCHSYS$*", "$DorLib2D$*"], "block_name_categories": {"glazing": ["$TCHSYS$WIN2D*"], "doors": ["$DorLib2D$*"]}.
  • Exclude annotation/frame layers inside clips: ["*-IDEN", "*图签*", "PUB_*", "DIM_*", "*TEXT*", "初审修改", "面积核算", "格子线", "辅注", "SEC-*", "立面", "剖面", "雨水管", "家具"] (revision clouds live on 初审修改-style layers).
  • TArch column fills may be HATCH-based; if arch plans yield suspiciously few columns, take columns/beams from the 结构 set instead of inventing them.

Modeling Rules

  • Prefer stable, layered massing over overfitted geometry. CAD floor plans often contain annotations, dimensions, hatches, XREF artifacts, and duplicated lines.
  • Use linework from walls/glazing/columns/beams/railings/doors as visual extrusions. Generate explicit roof/roof-cover geometry when roof drawings are sparse or when top-floor columns need an overhead cap. Keep generic detail layers as low plan detail unless the Agent has evidence they are vertical building elements. Do not claim parametric wall joins, rooms, MEP, quantities, or code-compliant BIM unless IFC semantics and validation are generated.
  • Keep 3D floor labels off by default. The Web UI already names floors; generated in-scene text usually clutters the building view.
  • Prefer CAD-derived footprint polygon slab meshes over rectangular bounds slabs. Generate the footprint from mapped wall/glazing/floor-line/railing/column vectors, simplify it, and cap it to a small number of high-area polygons. For digital-twin-style presentation, use a looser concave hull so floor plates read as continuous platforms instead of leaving avoidable visual voids. Treat this as a visual floor/roof plate, not a BIM-grade slab with validated openings and joins.
  • For presentation models, make slab edges visible in side views: use a display thickness around 0.35-0.40 m, render slabs double-sided in the Web viewer, and avoid very low slab opacity. Otherwise transparent glazing can make floor plates look missing even when the footprint is present.
  • Keep slab available as a toggle. Default it on for presentation/digital-twin models; default it off only for audit views where slabs obscure linework review.
  • For generated roof caps, do not blindly union lower floor footprints into the roof geometry. Use the roof floor's own footprint_from source unless there is clear CAD evidence that a canopy/overhang exists.
  • For columns that visually stand without anything above, do not rely on broad floor bounds or broad footprint alone to infer support. Require an adjacent upper floor/roof plate and nearby upper structural geometry; shorten unsupported display columns unless the Agent has evidence they are meant to be full-height freestanding elements.
  • Keep floors separable in object names and metadata. The Web viewer expects objects named <floor_key>__<category>.
  • Use neutral, readable colors and transparent slabs. Avoid a single-hue scene.
  • Document every assumption that affects geometry: layer mapping, floor heights, sheet splits, coordinate offsets, unit scale, and ignored entity types.
  • Curtain walls/glazing are frequently inside INSERT blocks (e.g. 系统嵌板/幕墙 blocks resolving to layer A-GLAZ-CURT). derive_showcase_spec.py handles this two ways: block-name expansion (GLAZING_BLOCK_PATTERNS, fragile — DWG→DXF conversion can mangle CJK names like 系统嵌板→系统嵌) and layer-based probing (classify_block_contents, default on): every INSERT — including wrapper/sheet blocks — is expanded up to expand_blocks_max_depth and sub-entities are kept only when their own layer classifies into block_content_categories (default glazing/railings/doors). Check the audit's glazing gate and block-locked section before accepting.
  • Identification/annotation layers (*-IDEN: door tags, axis numbers, area labels) are excluded from classification by default (exclude_layers), so A-DOOR-IDEN no longer counts as door geometry. If a category only ever matched an *-IDEN layer, the drawing has no real geometry for it — say so instead of modeling tags.
  • CAD draws curtain walls as sparse panel/mullion segments; derive_showcase_spec.py merges collinear glazing into continuous bands (merge_glazing, glazing_gap_tol). Only bridge gaps that contain no opaque wall on the same line.
  • Prefer capping column tops over shortening them. derive_showcase_spec.py stores floor.caps (setback overhang rings for above-ground floors, full ground/podium deck for the top basement level) which both backends extrude as slab caps; this avoids stray topless columns and odd short stubs.
  • Coordinate convention: GLB is glTF-standard Y-up; the Web viewer sets camera.up=(0,1,0), sections/explode along Y, and registers a DRACOLoader. Keep GLB up-axis and viewer up-axis in sync, otherwise the building renders lying on its side.
  • Lightweighting: export Draco-compressed GLB (Blender built-in, or tools/compress.mjs); the viewer must register DRACOLoader (it does). Sanitize degenerate faces / NaN normals before export so strict importers (Blender, online viewers) accept the file.

Bundled Resources

  • scripts/cad_dxf_report.py: batch DWG/DXF conversion, DXF sanitizing, and read report generation, including XREF-shell / near-empty sheet warnings.
  • scripts/detect_sheet_frames.py: multi-frame sheet splitter — finds plan-title frames (column AND row layouts), refines per-floor clips, grid-correlates per-floor offsets, and emits a config skeleton + report, including suggested storey elevations harvested from 剖面/立面 标高 texts.
  • scripts/assemble_campus.py: manifest-driven campus assembly — transforms per-building specs into site-local meters (prefixing floor keys, re-keying roof_specs), merges site-context floors (dropping massings covered by real models), and enforces the neighbour-gap check (overlap = exit 3; 0.1-0.3 m flagged as expansion-joint candidates).
  • scripts/dwg_dump_json.mjs + scripts/dwgjson_to_dxf.py: WASM libredwg fallback (npm @mlightcad/libredwg-web) for DWG->DXF when neither native libredwg nor ODA exists; preserves block definitions and INSERT transforms.
  • scripts/site_context_from_dump.py: campus site-context floors (ground/roads/parking/fence/trees/context massings) from 总图/定位图 dumps, with per-source unit scale, plan-copy windowing, and an exclude-quad for the really-modeled building.
  • scripts/derive_showcase_spec.py: configurable extraction from DXF line/polyline layers into a normalized building spec, with block-content probing for glazing/railings/doors locked inside INSERTs. Single-pass over expanded entities (floors share one INSERT expansion; block leaf-layer memoization skips irrelevant blocks), so multi-frame configs with many floors stay fast.
  • scripts/audit_showcase_extraction.py: coverage and risk audit with hard gates (exit 3 on failure) and block-locked geometry accounting (definition-walk with per-block-name caching, no per-INSERT explode), for Agent review before 3D generation.
  • scripts/draw_coverage_overlay.py: SVG overlays comparing source CAD vectors to extracted model geometry.
  • scripts/verify_showcase.py: Blender-free QA from building_spec.json (+ optional GLBs): per-floor segment/cap/glazing-continuity report, GLB size-budget check, and orthographic front/side/plan previews.
  • scripts/build_blender_showcase.py: Blender CLI renderer/exporter from building_spec.json to .blend, .glb, .png, and metadata. GLB is Draco-compressed by default.
  • scripts/spec_to_glb.py: Blender-free building_spec.json -> GLB exporter (trimesh). Use when Blender is unavailable; produces the same <floor>__<category> naming, Y-up, flat normals, glazing merge, and setback/basement caps.
  • tools/compress.mjs: gltf-transform Draco compressor (node tools/compress.mjs in.glb out.glb); alternative to Blender's built-in Draco, usually smaller.
  • scripts/build_showcase_variants.py: creates overview/standard/detail filtered specs, optionally builds their GLBs, and writes a manifest for Web delivery.
  • scripts/write_web_showcase.py: copies the static Web viewer template and model assets into an output folder.
  • scripts/build_ifc_poc.py: optional IFC4 semantic proof-of-concept generator from building_spec.json.
  • scripts/extract_ifc_meshes.py: extracts IFC geometry to JSON for render verification.
  • scripts/render_ifc_meshes_blender.py: renders IFC geometry in Blender and exports .blend, .glb, and .png.
  • references/pipeline.md: detailed CAD-to-model procedure and quality gates.
  • references/building_spec_schema.md: expected JSON contract between CAD extraction, Blender, and Web viewer.
  • references/agent_review.md: acceptance/iteration/BIM-claim checklist for Agent judgment.
  • references/a208_case_notes.md: proven details from the A208 DWG/DXF/Blender/Web/IFC run.
  • references/optimization_notes.md: lightweighting + completeness lessons (Draco/DRACOLoader, glTF Y-up convention, block-locked glazing, glazing continuity, column-top caps, NaN sanitation, verification).
  • references/web_presentation_notes.md: tiered visual/interaction/performance upgrade playbook for the Web showcase (template + Draco + ACES/environment lighting + physical glass; merged wall solids, mullions, site surfaces, instanced trees; click-to-inspect, tours, progressive campus loading) with honesty rules for presentation enhancements.
  • assets/web-showcase-template/: static Three.js viewer template (Y-up, registers DRACOLoader, cache-busting ?v= build token; RoomEnvironment IBL, model-sized shadow frustum + ground shadow catcher, physical-glass glazing, click-to-inspect).
  • scripts/write_offline_viewer.py + assets/offline-viewer-libs/: fully-offline single-file HTML viewer generator (vendored three r147 UMD + addons + pako; gzip-embedded GLB) for share-by-file delivery where CDNs/servers are unavailable.
  • tests/test_extraction_pipeline.py: synthetic-DXF regression test for block-locked glazing capture, *-IDEN exclusion, audit gates, and XREF-shell warnings. Run it after changing extraction/audit/report scripts.

BIM Branch

When the user asks whether the model can replace BIM:

  • Say that the Web showcase model cannot replace BIM by itself.
  • Create IFC only if the task explicitly needs BIM-like semantics.
  • Use scripts/build_ifc_poc.py with IfcOpenShell to generate and validate IFC entity counts, schema validity, geometry generation, storeys, and property sets.
  • Use scripts/extract_ifc_meshes.py and scripts/render_ifc_meshes_blender.py when the user asks to see the IFC render effect or when Blender cannot import IFC directly.
  • State the remaining BIM gaps: wall/slab joins, object classifications, openings, doors/windows, room spaces, quantities, materials, levels, georeferencing, and discipline coordination.