From e0503983f1d6c0e0de79051c11960befe985d232 Mon Sep 17 00:00:00 2001 From: Yeicor <4929005+Yeicor@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:47:22 +0200 Subject: [PATCH] Ability to explode models and minor improvements --- README.md | 9 ++-- frontend/App.vue | 12 +++-- frontend/misc/settings.ts | 2 +- frontend/models/Model.vue | 105 +++++++++++++++++++++++++++++++++++--- yacv_server/cad.py | 2 +- 5 files changed, 115 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2ce07d3..189778a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ in a web browser. - All [GLTF 2.0](https://www.khronos.org/gltf/) features (textures, PBR materials, animations...). - All [model-viewer](https://modelviewer.dev/) features (smooth controls, augmented reality...). - Load multiple models at once, load external models and even images as quads. -- Control clipping planes and transparency of each model. +- Control clipping planes, transparency, edge/vertex sizes and explode each model. - View and interact with topological entities: faces, edges, vertices and locations. - Select any entity and measure bounding box size and distances. - Hot reloading while editing the CAD model (using the `yacv-server` package). @@ -23,9 +23,9 @@ in a web browser. The [example](example) is a fully working project that shows how to use the viewer. You can play with the latest -demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb) +demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.glb&preload=location.glb) (or -[without animation](https://yeicor-3d.github.io/yet-another-cad-viewer/?autoplay=false&preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)). +[without animation](https://yeicor-3d.github.io/yet-another-cad-viewer/?autoplay=false&preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.glb&preload=location.glb)). ![Demo](assets/screenshot.png) @@ -36,3 +36,6 @@ demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=logo.glb Uses the same backend and frontend behind the scenes. - [build123d-docker](https://github.com/derhuerst/build123d-docker/pkgs/container/build123d) provides docker images for Yet Another CAD Viewer and other projects, with automatic updates. +- [OCP.wasm](https://github.com/yeicor/OCP.wasm/) ports OCP (OpenCASCADE for Python) and supporting libraries to + WebAssembly, enabling full in-browser CAD model generation and manipulation. This powers the build123d playground + provided by this viewer. \ No newline at end of file diff --git a/frontend/App.vue b/frontend/App.vue index a2d560f..81775ac 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -109,6 +109,12 @@ async function loadModelManual() { if (modelUrl) await networkMgr.load(modelUrl); } +function loadDemoModels() { + for (let name of ['fox.glb', 'img.glb', 'location.glb', 'logo.glb', 'logo_hl.glb', 'logo_hl_tex.glb']) { + networkMgr.load(`https://yeicor-3d.github.io/yet-another-cad-viewer/${name}`) + } +} + // Detect dropped .glb files and load them manually document.body.addEventListener("dragover", e => { e.preventDefault(); // Allow drop @@ -124,7 +130,6 @@ document.body.addEventListener("drop", async e => { await networkMgr.load(file); } }); - + + + +