Compare commits

..

114 Commits

Author SHA1 Message Date
Yeicor
437e8eb4ad Automatically update version to 0.9.6 2025-07-05 07:16:27 +00:00
renovate[bot]
7051a71710 Update dependency @vitejs/plugin-vue-jsx to v5.0.1 2025-07-05 00:59:09 +00:00
Yeicor
28282f4b06 Merge pull request #239 from andyross/naming
Clean up object naming
2025-07-05 00:04:06 +02:00
Andy Ross
7f43367459 Clean up object naming
Honor the upstream names for objects if they've been given them, use
the automatic variable magic as a fallback.  And in the case of truly
anonymous objects, give them a name based on their type (e.g. "Box3")
vs. "_unknown_var99".
2025-07-02 09:27:13 -07:00
renovate[bot]
ba64f70300 Update dependency pillow to v11.3.0 [SECURITY] 2025-07-01 22:06:50 +00:00
renovate[bot]
05963d58f2 Lock file maintenance 2025-06-29 21:58:54 +00:00
renovate[bot]
405c061f93 Lock file maintenance 2025-06-29 01:30:58 +00:00
renovate[bot]
e0a00b2d32 Update dependency vite to v7 2025-06-28 20:29:48 +00:00
renovate[bot]
90f4611ee8 Update dependency @vitejs/plugin-vue-jsx to v5 2025-06-28 18:37:55 +00:00
renovate[bot]
ee954622bb Update dependency @vitejs/plugin-vue to v6 2025-06-28 13:39:22 +00:00
renovate[bot]
f5be0618ad Update dependency @types/node to v22.15.34 2025-06-28 09:03:59 +00:00
renovate[bot]
f92701a969 Update dependency vuetify to v3.8.11 2025-06-28 04:42:57 +00:00
renovate[bot]
949f92a28f Update dependency @types/node to v22.15.33 2025-06-28 02:07:47 +00:00
renovate[bot]
7618581ef5 Lock file maintenance 2025-06-22 09:44:45 +00:00
renovate[bot]
5460d19fdb Lock file maintenance 2025-06-21 14:16:04 +00:00
renovate[bot]
f84292e4b7 Update dependency terser to v5.43.1 2025-06-21 10:13:19 +00:00
renovate[bot]
b597223228 Update dependency vuetify to v3.8.10 2025-06-21 04:48:58 +00:00
renovate[bot]
8ec9a3f507 Update dependency three-mesh-bvh to v0.9.1 2025-06-21 01:37:52 +00:00
renovate[bot]
0ec339283e Lock file maintenance 2025-06-16 12:02:55 +00:00
renovate[bot]
1d50dc20ba Update dependency terser to v5.42.0 2025-06-15 20:56:20 +00:00
renovate[bot]
35331746b1 Update dependency vuetify to v3.8.9 2025-06-15 17:46:57 +00:00
renovate[bot]
287f76c0ad Update dependency @types/node to v22.15.31 2025-06-15 14:48:23 +00:00
renovate[bot]
dadb2b7a39 Update dependency @tsconfig/node20 to v20.1.6 2025-06-15 11:56:58 +00:00
renovate[bot]
722432dfb0 Lock file maintenance 2025-06-08 16:34:10 +00:00
renovate[bot]
a9184b224f Lock file maintenance 2025-06-07 17:27:11 +00:00
renovate[bot]
3c732d7c85 Update dependency terser to v5.41.0 2025-06-07 13:48:03 +00:00
renovate[bot]
d8fa1f1e0b Update dependency @types/three to ^0.177.0 2025-06-07 08:40:50 +00:00
renovate[bot]
1b03699677 Update dependency vuetify to v3.8.8 2025-06-07 04:49:12 +00:00
renovate[bot]
7f6f777b47 Update dependency @types/node to v22.15.30 2025-06-07 00:40:47 +00:00
renovate[bot]
68fb3b1a67 Lock file maintenance 2025-06-01 08:53:04 +00:00
renovate[bot]
cd4a1d523b Lock file maintenance 2025-06-01 04:45:33 +00:00
renovate[bot]
84cd6ba710 Lock file maintenance 2025-06-01 01:05:35 +00:00
renovate[bot]
aa8492cd3d Lock file maintenance 2025-05-31 21:08:55 +00:00
renovate[bot]
6f8710bd7a Update dependency three to ^0.177.0 2025-05-31 17:45:00 +00:00
renovate[bot]
8b175b369a Update dependency terser to v5.40.0 2025-05-31 14:09:50 +00:00
renovate[bot]
0be05967ca Update dependency vuetify to v3.8.7 2025-05-31 09:13:12 +00:00
renovate[bot]
51f6165290 Update dependency vue to v3.5.16 2025-05-31 04:56:00 +00:00
renovate[bot]
f147c83604 Update dependency @types/node to v22.15.29 2025-05-31 00:48:49 +00:00
renovate[bot]
881de107c7 Lock file maintenance 2025-05-25 19:26:03 +00:00
renovate[bot]
6b533dfbe1 Update dependency npm-run-all2 to v8.0.4 2025-05-25 15:25:46 +00:00
renovate[bot]
2e3fb8beae Lock file maintenance 2025-05-24 19:19:40 +00:00
renovate[bot]
e8baf5cd52 Update dependency @vitejs/plugin-vue-jsx to v4.2.0 2025-05-24 13:50:12 +00:00
renovate[bot]
6c0289208f Update dependency vuetify to v3.8.6 2025-05-24 11:00:05 +00:00
renovate[bot]
496f90fb56 Update dependency npm-run-all2 to v8.0.3 2025-05-24 06:08:42 +00:00
renovate[bot]
696333e105 Update dependency @types/node to v22.15.21 2025-05-24 03:30:06 +00:00
renovate[bot]
099a7aa972 Lock file maintenance 2025-05-18 15:26:20 +00:00
renovate[bot]
b2aa568eb2 Lock file maintenance 2025-05-18 11:10:45 +00:00
renovate[bot]
e685c8adcf Update dependency commander to v14 2025-05-18 06:30:04 +00:00
renovate[bot]
19ddb670db Lock file maintenance 2025-05-17 23:07:27 +00:00
renovate[bot]
8f1cd3e203 Update dependency vuetify to v3.8.5 2025-05-17 19:18:05 +00:00
renovate[bot]
6b0fcd743f Update dependency vue to v3.5.14 2025-05-17 13:59:18 +00:00
renovate[bot]
1d275936a4 Update dependency terser to v5.39.2 2025-05-17 11:10:42 +00:00
renovate[bot]
f7c28a42c0 Update dependency npm-run-all2 to v8.0.2 2025-05-17 05:50:02 +00:00
renovate[bot]
fa54829328 Update dependency @types/node to v22.15.18 2025-05-17 02:18:37 +00:00
Yeicor
c8a7a3ac67 Update renovate.json5 2025-05-11 09:34:23 +02:00
renovate[bot]
791b2608c5 Lock file maintenance 2025-05-10 18:45:50 +00:00
renovate[bot]
ba8e40bc48 Update dependency vuetify to v3.8.4 2025-05-10 15:03:16 +00:00
renovate[bot]
712626e791 Update dependency vite to v6.3.5 2025-05-10 10:47:05 +00:00
renovate[bot]
734387a866 Update dependency @vitejs/plugin-vue to v5.2.4 2025-05-10 06:32:18 +00:00
renovate[bot]
0988db9269 Update dependency @types/node to v22.15.17 2025-05-10 01:34:50 +00:00
renovate[bot]
97d620b982 Lock file maintenance 2025-05-03 14:02:12 +00:00
renovate[bot]
857d0a602f Update dependency npm-run-all2 to v8 2025-05-03 10:09:57 +00:00
renovate[bot]
23f8aa8bdd Update dependency vuetify to v3.8.3 2025-05-03 05:39:05 +00:00
renovate[bot]
03a04bd3fd Update dependency @types/node to v22.15.3 2025-05-03 01:40:48 +00:00
renovate[bot]
57f91d046f Update dependency vite to v6.3.4 [SECURITY] 2025-04-30 20:14:19 +00:00
renovate[bot]
758bc9b874 Lock file maintenance 2025-04-28 05:52:59 +00:00
renovate[bot]
490a86796c Update dependency vite to v6.3.3 2025-04-27 05:53:47 +00:00
renovate[bot]
f44270d913 Update dependency three to ^0.176.0 2025-04-27 02:37:02 +00:00
renovate[bot]
4eed1b063e Update dependency pillow to v11.2.1 2025-04-26 22:55:41 +00:00
renovate[bot]
e3fe562d53 Update dependency @types/node to v22.15.2 2025-04-26 19:12:05 +00:00
renovate[bot]
84ba81a5e5 Update dependency @google/model-viewer to v4.1.0 2025-04-26 13:27:19 +00:00
renovate[bot]
d469f5da40 Update dependency vuetify to v3.8.2 2025-04-26 11:03:12 +00:00
renovate[bot]
98e8de75dd Update dependency vue-tsc to v2.2.10 2025-04-26 07:42:53 +00:00
renovate[bot]
e8d7985dba Update dependency pygltflib to v1.16.4 2025-04-26 01:32:54 +00:00
Yeicor
6aa680bf43 Automatically update version to 0.9.5 2025-04-20 10:53:32 +00:00
Yeicor
b629f07f5e Fix broken gltf exports and minor cleanup 2025-04-20 12:47:23 +02:00
renovate[bot]
9e4f571808 Update dependency vite to v6.2.6 [SECURITY] 2025-04-11 16:50:03 +00:00
renovate[bot]
eaad9f3774 Lock file maintenance 2025-04-05 18:12:03 +00:00
renovate[bot]
79f6359af1 Update dependency vuetify to v3.8.0 2025-04-05 10:28:54 +00:00
renovate[bot]
ca5e9e03ab Update dependency @types/node to v22.14.0 2025-04-05 06:44:09 +00:00
renovate[bot]
2ebdee2d42 Update dependency typescript to v5.8.3 2025-04-05 01:49:44 +00:00
renovate[bot]
c1773fb156 Update dependency vite to v6.2.5 [SECURITY] 2025-04-04 18:54:21 +00:00
renovate[bot]
e05cc70f3a Update dependency vite to v6.2.4 [SECURITY] 2025-03-31 19:41:40 +00:00
renovate[bot]
7d97ed5e93 Lock file maintenance 2025-03-29 18:54:49 +00:00
renovate[bot]
823ee5462f Update dependency three to ^0.175.0 2025-03-29 13:57:09 +00:00
renovate[bot]
64aebb5cf7 Update dependency vuetify to v3.7.19 2025-03-29 10:03:57 +00:00
renovate[bot]
979713bb48 Update dependency @types/node to v22.13.14 2025-03-29 06:13:03 +00:00
renovate[bot]
3b8efd628c Update dependency @tsconfig/node20 to v20.1.5 2025-03-29 02:27:01 +00:00
renovate[bot]
f91033ef3d Update dependency vite to v6.2.3 [SECURITY] 2025-03-25 18:56:53 +00:00
renovate[bot]
0f881a6de5 Lock file maintenance 2025-03-23 05:55:58 +00:00
renovate[bot]
fe919f539e Update dependency vuetify to v3.7.18 2025-03-22 13:49:32 +00:00
renovate[bot]
0b2efb006c Update dependency @vitejs/plugin-vue-jsx to v4.1.2 2025-03-22 09:28:10 +00:00
renovate[bot]
7584af683e Update dependency @vitejs/plugin-vue to v5.2.3 2025-03-22 06:17:04 +00:00
renovate[bot]
64358469ae Update dependency @types/node to v22.13.11 2025-03-22 01:25:57 +00:00
renovate[bot]
28ad995982 Lock file maintenance 2025-03-15 17:52:21 +00:00
renovate[bot]
3efb47fef1 Update dependency generate-license-file to v4 2025-03-15 13:16:46 +00:00
renovate[bot]
1ca655f2f4 Update dependency generate-license-file to v3.8.1 2025-03-15 10:08:32 +00:00
renovate[bot]
4fd6fc6e23 Update dependency vuetify to v3.7.16 2025-03-15 06:52:16 +00:00
renovate[bot]
b6d21e7ef1 Update dependency vite to v6.2.2 2025-03-15 01:50:55 +00:00
renovate[bot]
fb484b61da Lock file maintenance 2025-03-09 21:23:52 +00:00
renovate[bot]
1ebfa3dd3f Update dependency vuetify to v3.7.15 2025-03-08 14:27:32 +00:00
renovate[bot]
35bfb8679a Update dependency vue-tsc to v2.2.8 2025-03-08 10:54:52 +00:00
renovate[bot]
dce407ca2b Update dependency vite to v6.2.1 2025-03-08 06:46:23 +00:00
renovate[bot]
f9e90bee25 Update dependency @types/node to v22.13.9 2025-03-08 02:33:41 +00:00
renovate[bot]
ea44096200 Lock file maintenance (#232)
* Lock file maintenance

* Update Models.vue

* Update Models.vue

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yeicor <4929005+Yeicor@users.noreply.github.com>
2025-03-02 09:43:49 +01:00
renovate[bot]
f3d19911c7 Update dependency vite to v6.2.0 2025-03-01 18:52:39 +00:00
renovate[bot]
2214a4812c Update dependency typescript to ~5.8.0 2025-03-01 13:41:42 +00:00
renovate[bot]
8b08afc1ea Update dependency three to ^0.174.0 2025-03-01 10:27:05 +00:00
renovate[bot]
4d77723fe6 Update dependency vuetify to v3.7.14 2025-03-01 06:29:08 +00:00
renovate[bot]
bd0364fcea Update dependency @types/node to v22.13.7 2025-03-01 02:09:53 +00:00
renovate[bot]
3b466c0291 Lock file maintenance 2025-02-23 14:27:42 +00:00
renovate[bot]
ade6faa6a3 Update dependency vuetify to v3.7.13 2025-02-22 10:36:17 +00:00
renovate[bot]
c88959cc11 Update dependency vite to v6.1.1 2025-02-22 06:43:26 +00:00
renovate[bot]
1e7fe81a60 Update dependency @types/node to v22.13.5 2025-02-22 02:04:41 +00:00
13 changed files with 1401 additions and 1328 deletions

View File

@@ -6,13 +6,9 @@
], ],
"automerge": true, "automerge": true,
"automergeType": "branch", "automergeType": "branch",
"schedule": [ "schedule": [ "* * * * 0,6" ],
"before 3am on Saturday"
],
"lockFileMaintenance": { "lockFileMaintenance": {
"enabled": true, "enabled": true,
"schedule": [ "schedule": [ "* * * * 0,6" ]
"before 3am on Saturday"
]
} }
} }

View File

@@ -981,7 +981,7 @@ third-party archives.
The following npm package may be included in this product: The following npm package may be included in this product:
- typescript@5.7.2 - typescript@5.8.3
This package contains the following license: This package contains the following license:
@@ -1121,7 +1121,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.2.1 - @lit-labs/ssr-dom-shim@1.3.0
This package contains the following license: This package contains the following license:
@@ -1247,7 +1247,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.26.3 - @babel/parser@7.27.0
This package contains the following license: This package contains the following license:
@@ -1420,7 +1420,7 @@ The following npm packages may be included in this product:
- @babel/helper-string-parser@7.25.9 - @babel/helper-string-parser@7.25.9
- @babel/helper-validator-identifier@7.25.9 - @babel/helper-validator-identifier@7.25.9
- @babel/types@7.26.3 - @babel/types@7.27.0
These packages each contain the following license: These packages each contain the following license:
@@ -1451,7 +1451,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:
- three-mesh-bvh@0.8.3 - three-mesh-bvh@0.9.0
This package contains the following license: This package contains the following license:
@@ -1601,7 +1601,7 @@ The MIT license applies to all non-font and non-icon files.
The following npm package may be included in this product: The following npm package may be included in this product:
- semver@7.6.3 - semver@7.7.1
This package contains the following license: This package contains the following license:
@@ -1685,13 +1685,13 @@ THE SOFTWARE.
The following npm package may be included in this product: The following npm package may be included in this product:
- three@0.171.0 - three@0.175.0
This package contains the following license: This package contains the following license:
The MIT License The MIT License
Copyright © 2010-2024 three.js authors Copyright © 2010-2025 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1775,7 +1775,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.7.6 - vuetify@3.8.0
This package contains the following license: This package contains the following license:
@@ -1844,7 +1844,7 @@ THE SOFTWARE.
The following npm package may be included in this product: The following npm package may be included in this product:
- ktx-parse@0.7.1 - ktx-parse@1.0.0
This package contains the following license: This package contains the following license:
@@ -1906,9 +1906,9 @@ SOFTWARE.
The following npm packages may be included in this product: The following npm packages may be included in this product:
- @gltf-transform/core@4.1.1 - @gltf-transform/core@4.1.3
- @gltf-transform/extensions@4.1.1 - @gltf-transform/extensions@4.1.3
- @gltf-transform/functions@4.1.1 - @gltf-transform/functions@4.1.3
These packages each contain the following license: These packages each contain the following license:
@@ -1968,7 +1968,7 @@ THE SOFTWARE.
The following npm package may be included in this product: The following npm package may be included in this product:
- postcss@8.4.49 - postcss@8.5.3
This package contains the following license: This package contains the following license:
@@ -1997,7 +1997,7 @@ CONNECTION 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:
- nanoid@3.3.8 - nanoid@3.3.11
This package contains the following license: This package contains the following license:

View File

@@ -11,7 +11,7 @@ const emit = defineEmits<{ remove: [string] }>()
let {sceneDocument} = inject<{ sceneDocument: Ref<Document> }>('sceneDocument')!!; let {sceneDocument} = inject<{ sceneDocument: Ref<Document> }>('sceneDocument')!!;
let expandedNames = ref<Array<string>>([]); const expandedNames = ref<Array<string>>([]);
function meshesList(sceneDocument: Document): Array<Array<Mesh>> { function meshesList(sceneDocument: Document): Array<Array<Mesh>> {
// Grouped by shared name // Grouped by shared name
@@ -44,7 +44,7 @@ defineExpose({findModel})
<template> <template>
<v-expansion-panels v-for="meshes in meshesList(sceneDocument)" :key="meshName(meshes[0])" <v-expansion-panels v-for="meshes in meshesList(sceneDocument)" :key="meshName(meshes[0])"
v-model="expandedNames" multiple> v-model="expandedNames as any" multiple>
<model :meshes="meshes" :viewer="props.viewer" @remove="onRemove(meshes[0])"/> <model :meshes="meshes" :viewer="props.viewer" @remove="onRemove(meshes[0])"/>
</v-expansion-panels> </v-expansion-panels>
</template> </template>
@@ -61,4 +61,4 @@ defineExpose({findModel})
.v-overlay--active > .v-overlay__content { .v-overlay--active > .v-overlay__content {
display: block !important; /* HACK: Fix buggy tooltips not showing? */ display: block !important; /* HACK: Fix buggy tooltips not showing? */
} }
</style> </style>

View File

@@ -1,6 +1,6 @@
{ {
"name": "yet-another-cad-viewer", "name": "yet-another-cad-viewer",
"version": "0.9.4", "version": "0.9.6",
"description": "", "description": "",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
@@ -22,7 +22,7 @@
"@jamescoyle/vue-icon": "^0.1.2", "@jamescoyle/vue-icon": "^0.1.2",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
"@mdi/svg": "^7.4.47", "@mdi/svg": "^7.4.47",
"three": "^0.173.0", "three": "^0.177.0",
"three-mesh-bvh": "^0.9.0", "three-mesh-bvh": "^0.9.0",
"three-orientation-gizmo": "https://github.com/jrj2211/three-orientation-gizmo", "three-orientation-gizmo": "https://github.com/jrj2211/three-orientation-gizmo",
"vue": "^3.5.13", "vue": "^3.5.13",
@@ -31,17 +31,17 @@
"devDependencies": { "devDependencies": {
"@tsconfig/node20": "^20.1.4", "@tsconfig/node20": "^20.1.4",
"@types/node": "^22.9.3", "@types/node": "^22.9.3",
"@types/three": "^0.173.0", "@types/three": "^0.177.0",
"@vitejs/plugin-vue": "^5.2.0", "@vitejs/plugin-vue": "^6.0.0",
"@vitejs/plugin-vue-jsx": "^4.1.0", "@vitejs/plugin-vue-jsx": "^5.0.0",
"@vue/tsconfig": "^0.7.0", "@vue/tsconfig": "^0.7.0",
"buffer": "^5.5.0||^6.0.0", "buffer": "^5.5.0||^6.0.0",
"commander": "^13.0.0", "commander": "^14.0.0",
"generate-license-file": "^3.6.0", "generate-license-file": "^4.0.0",
"npm-run-all2": "^7.0.1", "npm-run-all2": "^8.0.0",
"terser": "^5.36.0", "terser": "^5.36.0",
"typescript": "~5.7.0", "typescript": "~5.8.0",
"vite": "^6.0.0", "vite": "^7.0.0",
"vue-tsc": "^2.1.10" "vue-tsc": "^2.1.10"
} }
} }

832
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "yacv-server" name = "yacv-server"
version = "0.9.4" version = "0.9.6"
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"

View File

@@ -10,7 +10,7 @@ from OCP.TopExp import TopExp
from OCP.TopLoc import TopLoc_Location from OCP.TopLoc import TopLoc_Location
from OCP.TopTools import TopTools_IndexedMapOfShape from OCP.TopTools import TopTools_IndexedMapOfShape
from OCP.TopoDS import TopoDS_Shape from OCP.TopoDS import TopoDS_Shape
from build123d import Compound, Shape, Color from build123d import Compound, Color
from yacv_server.gltf import GLTFMgr from yacv_server.gltf import GLTFMgr
@@ -78,7 +78,7 @@ def get_shape(obj: CADLike, error: bool = True) -> Optional[CADCoreLike]:
# Sorting is required to improve hashcode consistency # Sorting is required to improve hashcode consistency
shapes_raw_filtered_sorted = sorted(shapes_raw_filtered, key=lambda x: _hashcode(x)) shapes_raw_filtered_sorted = sorted(shapes_raw_filtered, key=lambda x: _hashcode(x))
# Build a single compound shape # Build a single compound shape
shapes_bd = [Shape(shape) for shape in shapes_raw_filtered_sorted if shape is not None] shapes_bd = [Compound(shape) for shape in shapes_raw_filtered_sorted if shape is not None]
return get_shape(Compound(shapes_bd), error) return get_shape(Compound(shapes_bd), error)
except TypeError: except TypeError:
pass pass
@@ -121,11 +121,11 @@ def image_to_gltf(source: str | bytes, center: any, width: Optional[float] = Non
hasher = hashlib.md5() hasher = hashlib.md5()
hasher.update(source) hasher.update(source)
name = 'image_' + hasher.hexdigest() name = 'image_' + hasher.hexdigest()
format: str _format: str
if save_mime == 'image/jpeg': if save_mime == 'image/jpeg':
format = 'JPEG' _format = 'JPEG'
elif save_mime == 'image/png': elif save_mime == 'image/png':
format = 'PNG' _format = 'PNG'
else: else:
raise ValueError(f'Unsupported save MIME type (for GLTF files): {save_mime}') raise ValueError(f'Unsupported save MIME type (for GLTF files): {save_mime}')
@@ -154,7 +154,7 @@ def image_to_gltf(source: str | bytes, center: any, width: Optional[float] = Non
img = img.resize((new_width, new_height)) img = img.resize((new_width, new_height))
# Save the image to a buffer # Save the image to a buffer
img.save(img_buf, format=format) img.save(img_buf, format=_format)
img_buf = img_buf.getvalue() img_buf = img_buf.getvalue()
# Convert coordinates system as a last step (gltf is Y-up instead of Z-up) # Convert coordinates system as a last step (gltf is Y-up instead of Z-up)

View File

@@ -169,6 +169,7 @@ class GLTFMgr:
self.gltf.images = [Image(bufferView=len(buffers_list), mimeType=self.image[1])] self.gltf.images = [Image(bufferView=len(buffers_list), mimeType=self.image[1])]
self.gltf.textures = [Texture(source=0, sampler=0)] self.gltf.textures = [Texture(source=0, sampler=0)]
self.gltf.samplers = [Sampler(magFilter=NEAREST)] self.gltf.samplers = [Sampler(magFilter=NEAREST)]
# noinspection PyPep8Naming
self.gltf.materials[0].pbrMetallicRoughness.baseColorTexture = TextureInfo(index=0) self.gltf.materials[0].pbrMetallicRoughness.baseColorTexture = TextureInfo(index=0)
buffers_list.append((Accessor(), BufferView(), self.image[0])) buffers_list.append((Accessor(), BufferView(), self.image[0]))

View File

@@ -138,3 +138,4 @@ class HTTPHandler(SimpleHTTPRequestHandler):
self.send_header('E-Tag', f'"{_hash}"') self.send_header('E-Tag', f'"{_hash}"')
self.end_headers() self.end_headers()
self.wfile.write(exported_glb) self.wfile.write(exported_glb)
return None

View File

@@ -1,8 +1,6 @@
import queue import queue
import queue
import threading import threading
from typing import List, TypeVar, \ from typing import List, TypeVar, Generic, Generator
Generic, Generator
from yacv_server.mylogger import logger from yacv_server.mylogger import logger
@@ -58,7 +56,7 @@ class BufferedPubSub(Generic[T]):
def subscribe(self, include_buffered: bool = True, include_future: bool = True, yield_timeout: float = 0.0) -> \ def subscribe(self, include_buffered: bool = True, include_future: bool = True, yield_timeout: float = 0.0) -> \
Generator[T, None, None]: Generator[T, None, None]:
"""Subscribes to events as an generator that yields events and automatically unsubscribes""" """Subscribes to events as a generator that yields events and automatically unsubscribes"""
q = self._subscribe(include_buffered, include_future) q = self._subscribe(include_buffered, include_future)
try: try:
while True: while True:

View File

@@ -5,7 +5,7 @@ from OCP.BRepAdaptor import BRepAdaptor_Curve
from OCP.GCPnts import GCPnts_TangentialDeflection from OCP.GCPnts import GCPnts_TangentialDeflection
from OCP.TopLoc import TopLoc_Location from OCP.TopLoc import TopLoc_Location
from OCP.TopoDS import TopoDS_Face, TopoDS_Edge, TopoDS_Shape, TopoDS_Vertex from OCP.TopoDS import TopoDS_Face, TopoDS_Edge, TopoDS_Shape, TopoDS_Vertex
from build123d import Shape, Vertex, Face, Location from build123d import Vertex, Face, Location, Compound
from pygltflib import GLTF2 from pygltflib import GLTF2
from yacv_server.cad import CADCoreLike, ColorTuple from yacv_server.cad import CADCoreLike, ColorTuple
@@ -33,7 +33,7 @@ def tessellate(
mgr.add_location(Location(cad_like)) mgr.add_location(Location(cad_like))
elif isinstance(cad_like, TopoDS_Shape): elif isinstance(cad_like, TopoDS_Shape):
shape = Shape(cad_like) shape = Compound(cad_like)
# Perform tessellation tasks # Perform tessellation tasks
edge_to_faces: Dict[str, List[TopoDS_Face]] = {} edge_to_faces: Dict[str, List[TopoDS_Face]] = {}
@@ -59,6 +59,9 @@ def tessellate(
for vertex in shape.vertices(): for vertex in shape.vertices():
_tessellate_vertex(mgr, vertex.wrapped, vertex_to_faces.get(vertex.wrapped, []), obj_color) _tessellate_vertex(mgr, vertex.wrapped, vertex_to_faces.get(vertex.wrapped, []), obj_color)
else:
raise TypeError(f"Unsupported type: {type(cad_like)}: {cad_like}")
return mgr.build() return mgr.build()
@@ -69,9 +72,10 @@ def _tessellate_face(
angular_tolerance: float = 0.1, angular_tolerance: float = 0.1,
color: Optional[ColorTuple] = None, color: Optional[ColorTuple] = None,
): ):
face = Shape(ocp_face) face = Compound(ocp_face)
# face.mesh(tolerance, angular_tolerance) # face.mesh(tolerance, angular_tolerance)
tri_mesh = face.tessellate(tolerance, angular_tolerance) tri_mesh = face.tessellate(tolerance, angular_tolerance)
# noinspection PyArgumentList
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:
logger.warn("No triangulation found for face") logger.warn("No triangulation found for face")
@@ -86,6 +90,7 @@ def _tessellate_face(
vertices = tri_mesh[0] vertices = tri_mesh[0]
indices = tri_mesh[1] indices = tri_mesh[1]
mgr.add_face(vertices, indices, uv, color) mgr.add_face(vertices, indices, uv, color)
return None
def _push_point(v: Tuple[float, float, float], faces: List[TopoDS_Face]) -> Tuple[float, float, float]: def _push_point(v: Tuple[float, float, float], faces: List[TopoDS_Face]) -> Tuple[float, float, float]:

View File

@@ -9,18 +9,18 @@ import threading
import time import time
from dataclasses import dataclass from dataclasses import dataclass
from http.server import ThreadingHTTPServer from http.server import ThreadingHTTPServer
from io import BytesIO
from threading import Thread from threading import Thread
from typing import Optional, Dict, Union, Callable, List, Tuple from typing import Optional, Dict, Union, Callable, 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
# noinspection PyProtectedMember
from build123d import Shape, Axis, Location, Vector, Color
from dataclasses_json import dataclass_json
from PIL import Image from PIL import Image
from io import BytesIO # noinspection PyProtectedMember
from build123d import Shape, Axis, Location, Vector
from dataclasses_json import dataclass_json
from yacv_server.cad import _hashcode, ColorTuple, get_color from yacv_server.cad import _hashcode, get_color
from yacv_server.cad import get_shape, grab_all_cad, CADCoreLike, CADLike from yacv_server.cad import get_shape, grab_all_cad, CADCoreLike, CADLike
from yacv_server.gltf import get_version from yacv_server.gltf import get_version
from yacv_server.myhttp import HTTPHandler from yacv_server.myhttp import HTTPHandler
@@ -95,7 +95,7 @@ class YACV:
"""Default texture to use for model faces, in (data, mimetype) format. """Default texture to use for model faces, in (data, mimetype) format.
If left as None, a default checkerboard texture will be used. If left as None, a default checkerboard texture will be used.
It can be set with the YACV_BASE_TEXTURE=<uri> and overriden by `show(..., texture="<uri>")`. It can be set with the YACV_BASE_TEXTURE=<uri> and overridden by `show(..., texture="<uri>")`.
The <uri> can be file:<path> or data:<mime>;base64,<data> where <mime> is the mime type and The <uri> can be file:<path> or data:<mime>;base64,<data> where <mime> is the mime type and
<data> is the base64 encoded image.""" <data> is the base64 encoded image."""
@@ -331,6 +331,7 @@ class YACV:
try: try:
return next(subscription), event.hash return next(subscription), event.hash
finally: finally:
# noinspection PyInconsistentReturns
subscription.close() subscription.close()
def export_all(self, folder: str, def export_all(self, folder: str,
@@ -381,19 +382,30 @@ def _preprocess_cad(obj: CADLike, **kwargs) -> CADCoreLike:
return obj return obj
_find_var_name_count = 0 _obj_name_counts = {}
def _find_var_name(obj: any, avoid_levels: int = 2) -> str: def _find_var_name(obj: any, avoid_levels: int = 2) -> str:
"""A hacky way to get a stable name for an object that may change over time""" """A hacky way to get a stable name for an object that may change over time"""
global _find_var_name_count
# Build123d objects have a "label" property, CadQuery Assembly's have "name"
for f in ('label', 'name'):
if hasattr(obj, f):
v = getattr(obj, f)
if v != '':
return v;
# Otherwise walk up our stack to see if there's a local variable that points to it
obj_shape = get_shape(obj, error=False) or obj obj_shape = get_shape(obj, error=False) or obj
for frame in inspect.stack()[avoid_levels:]: for frame in inspect.stack()[avoid_levels:]:
for key, value in frame.frame.f_locals.items(): for key, value in frame.frame.f_locals.items():
if get_shape(value, error=False) is obj_shape: if get_shape(value, error=False) is obj_shape:
return key return key
_find_var_name_count += 1
return 'unknown_var_' + str(_find_var_name_count) # Last resort, name it for its type with a disambiguating number
global _obj_name_counts
t = obj.__class__.__name__
_obj_name_counts[t] = 1 if t not in _obj_name_counts else _obj_name_counts[t] + 1
return t + str(_obj_name_counts[t])
def sizeof_fmt(num, suffix="B"): def sizeof_fmt(num, suffix="B"):

1766
yarn.lock

File diff suppressed because it is too large Load Diff