@omrips/viewstl 2.0.0-rc.2 → 2.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -14
- package/build/v2/README.md +4 -0
- package/build/v2/node/analysis-worker.js +3833 -0
- package/build/v2/node/index.cjs +382 -0
- package/build/v2/node/index.d.cts +122 -0
- package/build/v2/node/index.d.ts +122 -0
- package/build/v2/node/index.js +352 -0
- package/build/v2/stl_viewer.min.js +1 -1
- package/build/v2/viewstl.cjs +1 -1
- package/build/v2/viewstl.js +1 -1
- package/build/v2/viewstl.min.js +1 -1
- package/docs/v2-compatibility.md +1 -1
- package/docs/v2-usage.md +108 -3
- package/docs/v2-verification.md +51 -0
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
Embed a viewer in your website, open local 3D files, inspect models and save the result. ViewSTL v2 uses its own renderer, with no Three.js runtime required. File parsing and geometry analysis run in workers, with memory limits and cancellation support.
|
|
6
6
|
|
|
7
|
-
[Try the preview](https://preview.viewstl.com/) · [v2 usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
7
|
+
[Try the preview](https://preview.viewstl.com/) · [v2 usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md) · [Legacy plugin documentation](https://www.viewstl.com/plugin/)
|
|
8
8
|
|
|
9
|
-
> **Preview release: 2.0.0-rc.
|
|
9
|
+
> **Preview release: 2.0.0-rc.4.** v2 is a new implementation, with documented differences from v1. Existing versions remain available at their original paths. Read the migration notes before updating an existing integration.
|
|
10
10
|
|
|
11
11
|
## Quick start
|
|
12
12
|
|
|
13
|
-
Install with `npm install @omrips/viewstl@2.0.0-rc.
|
|
13
|
+
Install with `npm install @omrips/viewstl@2.0.0-rc.4`, then copy the complete `node_modules/@omrips/viewstl/build/v2/` folder to `/viewstl-v2/` on your website.
|
|
14
14
|
|
|
15
15
|
Paste these three lines into your page's `<body>`:
|
|
16
16
|
|
|
@@ -22,6 +22,20 @@ Paste these three lines into your page's `<body>`:
|
|
|
22
22
|
|
|
23
23
|
Replace `model.stl` with your model's path and open the page over HTTP(S). That's it. You can also drag local files onto the viewer.
|
|
24
24
|
|
|
25
|
+
## Server-only example (Node.js)
|
|
26
|
+
|
|
27
|
+
Requires Node.js 20+. Install `npm install @omrips/viewstl@2.0.0-rc.4`, then save this as `analyze.mjs` beside your `part.stl` file:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { analyzeFile } from '@omrips/viewstl/node';
|
|
31
|
+
const report = await analyzeFile('part.stl', { units: 'mm' });
|
|
32
|
+
console.log(JSON.stringify(report, null, 2));
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run `node analyze.mjs`. It prints a JSON report with dimensions, surface area, validated volume and mesh checks. This runs entirely in Node.js; workers and CAD assets load directly from the installed package.
|
|
36
|
+
|
|
37
|
+
STL, OBJ, 3MF, STEP and IGES are supported. For STL/OBJ, set `units` to your model's actual scale; 3MF/STEP/IGES use their file units. See [server API and limits](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md#nodejs-model-analysis) for buffers, batch processing and cancellation.
|
|
38
|
+
|
|
25
39
|
## What v2 can do
|
|
26
40
|
|
|
27
41
|
- **Open models:** binary and ASCII STL, OBJ, 3MF, STEP/STP and IGES/IGS.
|
|
@@ -30,6 +44,7 @@ Replace `model.stl` with your model's path and open the page over HTTP(S). That'
|
|
|
30
44
|
- **Save locally:** PNG images and mesh exports in binary STL, OBJ, 3MF, STEP and IGES.
|
|
31
45
|
- **Save and restore scenes:** VSB packages the scene and meshes; VSJ stores scene settings and references to model files.
|
|
32
46
|
- **Check meshes for 3D printing:** topology checks, detailed intersection and volume analysis, issue highlights and optional FDM estimates.
|
|
47
|
+
- **Analyze on a server:** a Node.js API reuses the same parsers and mesh checks in background workers, with bounded concurrency and cancellation.
|
|
33
48
|
- **Embed in your own interface:** use the `StlViewer` API, or bind your own markup to the optional `mountViewstlApp` controller.
|
|
34
49
|
|
|
35
50
|
## Usage
|
|
@@ -78,12 +93,12 @@ Replace `/models/part.stl` with a model URL you serve. To open a local file inst
|
|
|
78
93
|
|
|
79
94
|
### npm and bundlers
|
|
80
95
|
|
|
81
|
-
> **Release candidate:** `2.0.0-rc.
|
|
96
|
+
> **Release candidate:** `2.0.0-rc.4` includes the Node.js model-analysis API and a runnable server-only example. Pin the version below for a repeatable installation.
|
|
82
97
|
|
|
83
98
|
Install the package in your application:
|
|
84
99
|
|
|
85
100
|
```sh
|
|
86
|
-
npm install @omrips/viewstl@2.0.0-rc.
|
|
101
|
+
npm install @omrips/viewstl@2.0.0-rc.4
|
|
87
102
|
```
|
|
88
103
|
|
|
89
104
|
Copy the **complete `node_modules/@omrips/viewstl/build/v2/` directory** to your application's static assets. For an application that serves `public/` at its root, use `public/viewstl-v2/`. Keep the worker, `chunks/`, `cad/` and notices together; repeat this copy when updating the package.
|
|
@@ -108,7 +123,7 @@ const viewer = new StlViewer(document.getElementById('viewer'), {
|
|
|
108
123
|
|
|
109
124
|
Set `worker_url` to the URL where your application serves the copied worker, and replace `/models/part.stl` with your model URL. The bundler handles the viewer import; the static directory supplies its worker and optional parser assets. Creating a viewer requires a browser DOM and WebGL 2.
|
|
110
125
|
|
|
111
|
-
The distribution includes TypeScript declarations and a CommonJS entry point. The static-assets setup above is verified with Vite 8.3.4 and Webpack 5.112.0. See [usage and packaging](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
126
|
+
The distribution includes TypeScript declarations and a CommonJS entry point. The static-assets setup above is verified with Vite 8.3.4 and Webpack 5.112.0. See [usage and packaging](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md) for worker factories, callbacks and more examples.
|
|
112
127
|
|
|
113
128
|
## Formats and saving
|
|
114
129
|
|
|
@@ -125,13 +140,15 @@ The distribution includes TypeScript declarations and a CommonJS entry point. Th
|
|
|
125
140
|
|
|
126
141
|
STL, OBJ, 3MF, STEP and IGES export model geometry. **VSB and VSJ save the scene**, including its models, transforms and viewing settings. VSJ requires access to its referenced model files; VSB carries its mesh data inside the archive.
|
|
127
142
|
|
|
128
|
-
STEP/IGES exports describe the loaded triangle mesh. They do not reconstruct original CAD solids, curves, feature history or assemblies. OBJ import does not load external materials or textures, and 3MF support does not cover every extension. See the [format and export details](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
143
|
+
STEP/IGES exports describe the loaded triangle mesh. They do not reconstruct original CAD solids, curves, feature history or assemblies. OBJ import does not load external materials or textures, and 3MF support does not cover every extension. See the [format and export details](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md#rendering-and-file-processing).
|
|
129
144
|
|
|
130
145
|
## Local files and URL imports
|
|
131
146
|
|
|
132
|
-
|
|
147
|
+
In the browser, local file contents are processed on the user's device. Rendering, mesh checks, model exports and scene saving do not require an upload or a conversion service. Archive and CAD support load additional assets only when needed.
|
|
148
|
+
|
|
149
|
+
The optional Node.js API processes files on the machine running Node. If your application accepts uploads for server analysis, those files leave the user's device. The package itself provides no upload endpoint and does not send model data anywhere.
|
|
133
150
|
|
|
134
|
-
Direct URL imports require the remote server to allow browser access through CORS. A host application can configure its own streaming relay for other public URLs. **The relay is a separate server service**, not part of the plugin's JavaScript bundle. The preview website uses such a relay; URL imports pass through that server. See [URL import configuration](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
151
|
+
Direct URL imports require the remote server to allow browser access through CORS. A host application can configure its own streaming relay for other public URLs. **The relay is a separate server service**, not part of the plugin's JavaScript bundle. The preview website uses such a relay; URL imports pass through that server. See [URL import configuration](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md#optional-streaming-url-imports).
|
|
135
152
|
|
|
136
153
|
## Existing users and previous versions
|
|
137
154
|
|
|
@@ -142,11 +159,11 @@ Direct URL imports require the remote server to allow browser access through COR
|
|
|
142
159
|
| Source | Existing files in `src/` | `src/v2/` |
|
|
143
160
|
| Browser script | `build/stl_viewer.min.js` | `build/v2/viewstl.min.js` |
|
|
144
161
|
| Renderer | Three.js | Native WebGL 2 |
|
|
145
|
-
| Documentation | [viewstl.com/plugin](https://www.viewstl.com/plugin/) | [Package usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
162
|
+
| Documentation | [viewstl.com/plugin](https://www.viewstl.com/plugin/) | [Package usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md) |
|
|
146
163
|
|
|
147
|
-
The familiar `StlViewer` constructor and many public methods are retained. Integrations that access Three.js camera, scene, renderer or model internals need migration. v2 requires WebGL 2 and does not include the legacy WebGL 1 or Canvas fallback. See [API differences and migration notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
164
|
+
The familiar `StlViewer` constructor and many public methods are retained. Integrations that access Three.js camera, scene, renderer or model internals need migration. v2 requires WebGL 2 and does not include the legacy WebGL 1 or Canvas fallback. See [API differences and migration notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-usage.md#existing-api-and-intentional-differences).
|
|
148
165
|
|
|
149
|
-
Existing tags and release history are retained. The [legacy archive notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
166
|
+
Existing tags and release history are retained. The [legacy archive notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/legacy/README.md) also describe the separate local v1.14 snapshot and its provenance.
|
|
150
167
|
|
|
151
168
|
The documentation link remains **https://www.viewstl.com/plugin/**. It currently documents the legacy plugin; v2 guidance is included in this package while the website documentation is prepared.
|
|
152
169
|
|
|
@@ -155,7 +172,7 @@ The documentation link remains **https://www.viewstl.com/plugin/**. It currently
|
|
|
155
172
|
- A browser with WebGL 2 and module-worker support; WebAssembly is required for STEP/IGES import.
|
|
156
173
|
- Model capacity depends on geometry complexity and available browser/GPU memory. Configured limits reject files that exceed the budget.
|
|
157
174
|
- Print checks describe the loaded mesh. FDM results are estimates, and checks do not guarantee a successful print. Models are checked separately; assembly overlaps are not evaluated.
|
|
158
|
-
- The preview has automated and desktop Chromium/Edge coverage. Firefox, Safari and physical mobile-device validation remain pending. See [verification and known limits](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
175
|
+
- The preview has automated and desktop Chromium/Edge coverage. Firefox, Safari and physical mobile-device validation remain pending. See [verification and known limits](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/docs/v2-verification.md).
|
|
159
176
|
|
|
160
177
|
## Development
|
|
161
178
|
|
|
@@ -174,4 +191,4 @@ Open `http://127.0.0.1:8772/examples/v2/` for the local demo. The build writes t
|
|
|
174
191
|
|
|
175
192
|
## License
|
|
176
193
|
|
|
177
|
-
ViewSTL is available under the [MIT license](https://unpkg.com/@omrips/viewstl@2.0.0-rc.
|
|
194
|
+
ViewSTL is available under the [MIT license](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/LICENSE). Optional archive and CAD dependencies have their own licenses and notices; see [third-party notices](https://unpkg.com/@omrips/viewstl@2.0.0-rc.4/THIRD-PARTY-NOTICES.txt).
|
package/build/v2/README.md
CHANGED
|
@@ -9,3 +9,7 @@ The existing `../stl_viewer.min.js` and its companion files remain the
|
|
|
9
9
|
legacy distribution. A v2 build must never overwrite those files.
|
|
10
10
|
|
|
11
11
|
See [the compatibility requirements](../../docs/v2-compatibility.md).
|
|
12
|
+
|
|
13
|
+
`node/` contains the separate server analysis entry points and worker, exported
|
|
14
|
+
as `@omrips/viewstl/node`. These resolve `cad/` inside the npm package; Node users
|
|
15
|
+
do not need to copy assets to a website.
|