mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-20 06:27:04 +01:00
Compare commits
3 Commits
v0.2.0-alp
...
v0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
753648e522 | ||
|
|
986db75b24 | ||
|
|
962eea2b27 |
26
README.md
26
README.md
@@ -18,29 +18,11 @@ in a web browser.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The [example](example) is a fully working project that demonstrates how to use the viewer.
|
The [example](example) is a fully working project that shows how to use the viewer.
|
||||||
|
|
||||||
### Hot reloading
|
You can play with the latest
|
||||||
|
demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=base.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)
|
||||||
To see the live updates you will need to run the [yacv_server](yacv_server) and
|
|
||||||
open [the viewer](https://yeicor-3d.github.io/yet-another-cad-viewer/) with
|
|
||||||
the `preload=ws://<host>:32323/` query parameter (by default it already tries localhost).
|
|
||||||
|
|
||||||
Note that [yacv_server](yacv_server) also hosts the frontend at `http://localhost:32323/` if you have no access to the
|
|
||||||
internet.
|
|
||||||
|
|
||||||
### Static deployment
|
|
||||||
|
|
||||||
To deploy the viewer and models as a static website you can simply copy the latest build directory to your server.
|
|
||||||
To load models use the `preload=...` query parameter in the URL.
|
|
||||||
It can be set multiple times to load multiple models.
|
|
||||||
|
|
||||||
Note that you can simply reuse the [main deployment](https://yeicor-3d.github.io/yet-another-cad-viewer/) and host only
|
|
||||||
your own models (linking them from the viewer with the `preload` query parameter).
|
|
||||||
|
|
||||||
To see a working example of a static deployment you can check out
|
|
||||||
the [demo](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=base.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)
|
|
||||||
(or
|
(or
|
||||||
the [demo without animation](https://yeicor-3d.github.io/yet-another-cad-viewer/?autoplay=false&preload=base.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=base.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)).
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -523,8 +523,8 @@ Apache License
|
|||||||
The following npm packages may be included in this product:
|
The following npm packages may be included in this product:
|
||||||
|
|
||||||
- b4a@1.6.6
|
- b4a@1.6.6
|
||||||
- bare-events@2.2.0
|
- bare-events@2.2.1
|
||||||
- bare-fs@2.1.5
|
- bare-fs@2.2.1
|
||||||
- bare-os@2.2.0
|
- bare-os@2.2.0
|
||||||
- bare-path@2.1.0
|
- bare-path@2.1.0
|
||||||
|
|
||||||
@@ -1430,7 +1430,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- @lit-labs/ssr-dom-shim@1.1.2
|
- @lit-labs/ssr-dom-shim@1.2.0
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -1556,7 +1556,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- @babel/parser@7.23.9
|
- @babel/parser@7.24.0
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -1736,7 +1736,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- node-abi@3.54.0
|
- node-abi@3.56.0
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -1826,7 +1826,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- @monogrid/gainmap-js@3.0.1
|
- @monogrid/gainmap-js@3.0.3
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -2378,7 +2378,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- prebuild-install@7.1.1
|
- prebuild-install@7.1.2
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -2408,7 +2408,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
The following npm package may be included in this product:
|
The following npm package may be included in this product:
|
||||||
|
|
||||||
- vuetify@3.5.3
|
- vuetify@3.5.7
|
||||||
|
|
||||||
This package contains the following license and notice below:
|
This package contains the following license and notice below:
|
||||||
|
|
||||||
@@ -2498,16 +2498,16 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
The following npm packages may be included in this product:
|
The following npm packages may be included in this product:
|
||||||
|
|
||||||
- @vue/compiler-core@3.4.16
|
- @vue/compiler-core@3.4.21
|
||||||
- @vue/compiler-dom@3.4.16
|
- @vue/compiler-dom@3.4.21
|
||||||
- @vue/compiler-sfc@3.4.16
|
- @vue/compiler-sfc@3.4.21
|
||||||
- @vue/compiler-ssr@3.4.16
|
- @vue/compiler-ssr@3.4.21
|
||||||
- @vue/reactivity@3.4.16
|
- @vue/reactivity@3.4.21
|
||||||
- @vue/runtime-core@3.4.16
|
- @vue/runtime-core@3.4.21
|
||||||
- @vue/runtime-dom@3.4.16
|
- @vue/runtime-dom@3.4.21
|
||||||
- @vue/server-renderer@3.4.16
|
- @vue/server-renderer@3.4.21
|
||||||
- @vue/shared@3.4.16
|
- @vue/shared@3.4.21
|
||||||
- vue@3.4.16
|
- vue@3.4.21
|
||||||
|
|
||||||
These packages each contain the following license and notice below:
|
These packages each contain the following license and notice below:
|
||||||
|
|
||||||
@@ -2538,7 +2538,7 @@ THE SOFTWARE.
|
|||||||
The following npm packages may be included in this product:
|
The following npm packages may be included in this product:
|
||||||
|
|
||||||
- fast-fifo@1.3.2
|
- fast-fifo@1.3.2
|
||||||
- streamx@2.16.0
|
- streamx@2.16.1
|
||||||
|
|
||||||
These packages each contain the following license and notice below:
|
These packages each contain the following license and notice below:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yet-another-cad-viewer",
|
"name": "yet-another-cad-viewer",
|
||||||
"version": "0.1.0",
|
"version": "0.3.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Yeicor <4929005+Yeicor@users.noreply.github.com>",
|
"author": "Yeicor <4929005+Yeicor@users.noreply.github.com>",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "yacv-server"
|
name = "yacv-server"
|
||||||
version = "0.1.0" # TODO: Update automatically by CI on release (also for package.json!)
|
version = "0.3.0" # TODO: Update automatically by CI on release (also for package.json!)
|
||||||
description = "Yet Another CAD Viewer (server)"
|
description = "Yet Another CAD Viewer (server)"
|
||||||
authors = ["Yeicor <4929005+Yeicor@users.noreply.github.com>"]
|
authors = ["Yeicor <4929005+Yeicor@users.noreply.github.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import time
|
|||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
from server import Server
|
from yacv_server.server import Server
|
||||||
|
|
||||||
server = Server()
|
server = Server()
|
||||||
"""The server instance. This is the main entry point to serve CAD objects and other data to the frontend."""
|
"""The server instance. This is the main entry point to serve CAD objects and other data to the frontend."""
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from typing import Optional, Union, List, Tuple
|
|||||||
from OCP.TopLoc import TopLoc_Location
|
from OCP.TopLoc import TopLoc_Location
|
||||||
from OCP.TopoDS import TopoDS_Shape
|
from OCP.TopoDS import TopoDS_Shape
|
||||||
|
|
||||||
from gltf import GLTFMgr
|
from yacv_server.gltf import GLTFMgr
|
||||||
|
|
||||||
CADLike = Union[TopoDS_Shape, TopLoc_Location] # Faces, Edges, Vertices and Locations for now
|
CADLike = Union[TopoDS_Shape, TopLoc_Location] # Faces, Edges, Vertices and Locations for now
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import asyncio
|
|||||||
from typing import List, TypeVar, \
|
from typing import List, TypeVar, \
|
||||||
Generic, AsyncGenerator
|
Generic, AsyncGenerator
|
||||||
|
|
||||||
from mylogger import logger
|
from yacv_server.mylogger import logger
|
||||||
|
|
||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ from aiohttp_sse import sse_response
|
|||||||
from build123d import Shape, Axis, Location, Vector
|
from build123d import Shape, Axis, Location, Vector
|
||||||
from dataclasses_json import dataclass_json
|
from dataclasses_json import dataclass_json
|
||||||
|
|
||||||
from cad import get_shape, grab_all_cad, image_to_gltf
|
from yacv_server.cad import get_shape, grab_all_cad, image_to_gltf
|
||||||
from mylogger import logger
|
from yacv_server.mylogger import logger
|
||||||
from pubsub import BufferedPubSub
|
from yacv_server.pubsub import BufferedPubSub
|
||||||
from tessellate import _hashcode, tessellate
|
from yacv_server.tessellate import _hashcode, tessellate
|
||||||
|
|
||||||
# Find the frontend folder (optional, but recommended)
|
# Find the frontend folder (optional, but recommended)
|
||||||
FILE_DIR = os.path.dirname(__file__)
|
FILE_DIR = os.path.dirname(__file__)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ from OCP.TopoDS import TopoDS_Face, TopoDS_Edge, TopoDS_Shape, TopoDS_Vertex
|
|||||||
from build123d import Shape, Vertex, Face, Location
|
from build123d import Shape, Vertex, Face, Location
|
||||||
from pygltflib import GLTF2
|
from pygltflib import GLTF2
|
||||||
|
|
||||||
import mylogger
|
from yacv_server.mylogger import logger
|
||||||
from cad import CADLike
|
from yacv_server.cad import CADLike
|
||||||
from gltf import GLTFMgr
|
from yacv_server.gltf import GLTFMgr
|
||||||
|
|
||||||
|
|
||||||
def tessellate(
|
def tessellate(
|
||||||
@@ -68,7 +68,7 @@ def _tessellate_face(
|
|||||||
face.mesh(tolerance, angular_tolerance)
|
face.mesh(tolerance, angular_tolerance)
|
||||||
poly = BRep_Tool.Triangulation_s(face.wrapped, TopLoc_Location())
|
poly = BRep_Tool.Triangulation_s(face.wrapped, TopLoc_Location())
|
||||||
if poly is None:
|
if poly is None:
|
||||||
mylogger.logger.warn("No triangulation found for face")
|
logger.warn("No triangulation found for face")
|
||||||
return GLTF2()
|
return GLTF2()
|
||||||
tri_mesh = face.tessellate(tolerance, angular_tolerance)
|
tri_mesh = face.tessellate(tolerance, angular_tolerance)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user