# occt-shape-viewer **Repository Path**: daoos_admin/occt-shape-viewer ## Basic Information - **Project Name**: occt-shape-viewer - **Description**: step模型比较 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-23 - **Last Updated**: 2026-04-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenCascade Visualizer Browser-based CAD shape viewer using [opencascade.js](https://github.com/nicholasgasior/opencascade.js) (WASM) and [Three.js](https://threejs.org/). Loads STEP (.step/.stp) and BREP (.brep/.brp) files entirely client-side — no server required. ## Features - **STEP/BREP file loading** — drag-and-drop or file picker - **Full topology tree** — Compound → Solid → Shell → Face → Wire → Edge → Vertex - **3D visualization** — per-face mesh rendering with orbit controls - **Click selection** — click in 3D or tree to highlight shapes and view properties - **Large model support** — models with 200+ faces use merged geometry (single draw call) with vertex-color highlighting - **Properties panel** — displays area, length, volume, coordinates per shape type ## Tech Stack - **OpenCascade.js** v1.1.1 — OCCT 7.4 compiled to WebAssembly (~63MB) - **Three.js** v0.183 — 3D rendering - **Vite** v7.3 — dev server & bundler - **TypeScript** — vanilla, no framework ## Getting Started ```bash npm install npm run dev ``` Open http://localhost:5173/ and drop a STEP or BREP file onto the viewport. ## Project Structure ``` src/ occ-loader.ts — WASM module loader step-reader.ts — STEP/BREP file reader (Emscripten VFS) topo-explorer.ts — TopoDS_Iterator-based topology tree builder mesh-builder.ts — OCCT → Three.js mesh conversion (per-face & merged) viewer.ts — Three.js viewport, controls, raycasting, highlighting topo-tree.ts — Topology tree panel UI properties-panel.ts — Shape property display main.ts — Application entry point style.css — Dark theme styling ``` ## Architecture Notes - STEP files are written to the Emscripten virtual filesystem as `Uint8Array`, then read by OCCT's `STEPControl_Reader` using bare filenames (no leading slash) - All WASM C++ objects are tracked via `ShapeRegistry` and explicitly `.delete()`d to prevent memory leaks - Shapes from `TopoDS_Iterator` must be downcast (`oc.TopoDS.Face_1()`, etc.) before passing to `BRep_Tool` methods - Models exceeding 200 faces are rendered as a single merged `BufferGeometry` with vertex colors for per-face highlighting ## License MIT