@omrips/viewstl 2.0.0-rc.3 → 2.0.0-rc.5
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 +19 -170
- package/build/{v2/THIRD-PARTY-NOTICES.txt → THIRD-PARTY-NOTICES.txt} +1006 -1006
- package/build/{v2/cad → cad}/occt-import-js.source.txt +19 -19
- package/build/chunks/archive-JU75RPTU.js +1 -0
- package/build/{v2/chunks/cad-VY42CMP4.js → chunks/cad-4JYHORYZ.js} +1 -1
- package/build/{v2/chunks/chunk-JH3H3JWA.js → chunks/chunk-OP2L7L4N.js} +1 -1
- package/build/{v2/chunks/chunk-ZMK3UZZE.js → chunks/chunk-PQYEV7WH.js} +1 -1
- package/build/{v2/chunks/chunk-R3HNTB5A.js → chunks/chunk-Y6VY64LY.js} +1 -1
- package/build/{v2/chunks/export-7OP4ZGGJ.js → chunks/export-VM6OQCQJ.js} +3 -3
- package/build/{v2/chunks/export-cad-QPBT756V.js → chunks/export-cad-QXCB6UDU.js} +1 -1
- package/build/{v2/chunks/export-zip-EDCWH5PX.js → chunks/export-zip-PVXETVLK.js} +1 -1
- package/build/{v2/chunks/print-check-2PU7CSL3.js → chunks/print-check-NJ4IONC5.js} +1 -1
- package/build/{v2/chunks/scene-export-KQBS7VRJ.js → chunks/scene-export-ZIXMUNLI.js} +1 -1
- package/build/chunks/scene-reader-JGHERXR2.js +1 -0
- package/build/{v2/node → node}/analysis-worker.js +11 -11
- package/build/{v2/node → node}/index.cjs +7 -7
- package/build/{v2/node → node}/index.js +6 -6
- package/build/stl_viewer.min.js +51 -0
- package/build/{v2/viewstl.cjs → viewstl.cjs} +752 -125
- package/build/{v2/viewstl.d.cts → viewstl.d.cts} +50 -0
- package/build/{v2/viewstl.d.ts → viewstl.d.ts} +50 -0
- package/build/{v2/viewstl.js → viewstl.js} +752 -125
- package/build/viewstl.min.js +51 -0
- package/build/{v2/viewstl.worker.js → viewstl.worker.js} +1 -1
- package/docs/releases/2.0.0-rc.5.md +46 -0
- package/docs/v2-compatibility.md +5 -5
- package/docs/v2-usage.md +128 -21
- package/docs/v2-verification.md +158 -0
- package/legacy/README.md +14 -8
- package/package.json +18 -35
- package/build/v2/README.md +0 -15
- package/build/v2/chunks/archive-VGS4J4Z7.js +0 -1
- package/build/v2/chunks/scene-reader-APUJOPUR.js +0 -1
- package/build/v2/stl_viewer.min.js +0 -51
- package/build/v2/viewstl.min.js +0 -51
- /package/build/{v2/cad → cad}/occt-import-js.js +0 -0
- /package/build/{v2/cad → cad}/occt-import-js.wasm +0 -0
- /package/build/{v2/cad → cad}/prepare-cad.source.txt +0 -0
- /package/build/{v2/chunks/chunk-U33KANV7.js → chunks/chunk-IK3WL53C.js} +0 -0
- /package/build/{v2/chunks/chunk-JS56KC3I.js → chunks/chunk-W5KVLGVR.js} +0 -0
- /package/build/{v2/chunks → chunks}/chunk-ZSV4PTIA.js +0 -0
- /package/build/{v2/node → node}/index.d.cts +0 -0
- /package/build/{v2/node → node}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,191 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
> This is the maintained `@omrips/viewstl` package. The shorter `npm install viewstl` installs the same plugin. Existing `@omrips/viewstl` and `@omrips/viewstl/node` imports remain supported.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Viewstl
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Javascript STL/OBJ/3MF/STEP/IGES 3D files Viewer
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**ViewSTL v2.00 — release candidate 2.0.0-rc.5.** A new native WebGL 2 implementation; no THREE.js runtime required. Reads local files on the user's device, with model exports, animation, VSB/VSJ scene saving and mesh checks.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The new plugin is in `src/` and `build/`. Previous versions remain available in [legacy/](https://github.com/omrips/viewstl/tree/main/legacy), on the unchanged [master branch](https://github.com/omrips/viewstl/tree/master), and through their existing tags. v2 has [documented compatibility differences](docs/v2-usage.md#existing-api-and-intentional-differences).
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Paste these three lines into your page's `<body>`:
|
|
13
|
+
Download the [v2 plugin ZIP](https://github.com/omrips/viewstl/releases/download/v2.0.0-rc.5/viewstl-2.0.0-rc.5.zip) and copy its complete `build/` folder to your website. Add to your page:
|
|
16
14
|
|
|
17
15
|
```html
|
|
18
|
-
<div id="
|
|
19
|
-
<script src="/viewstl
|
|
20
|
-
<script>new StlViewer(document.getElementById(
|
|
21
|
-
```
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
## Quick start (Node.js)
|
|
26
|
-
|
|
27
|
-
For server-side model analysis, install `npm install @omrips/viewstl@2.0.0-rc.3` and run:
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import { analyzeFile } from '@omrips/viewstl/node';
|
|
31
|
-
const report = await analyzeFile('part.stl', { units: 'mm' });
|
|
16
|
+
<div id="stl_cont" style="height:500px"></div>
|
|
17
|
+
<script src="build/viewstl.min.js"></script>
|
|
18
|
+
<script>var stl_viewer=new StlViewer(document.getElementById("stl_cont"), {models:[{id:0, filename:"mystl.stl"}]});</script>
|
|
32
19
|
```
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## What v2 can do
|
|
37
|
-
|
|
38
|
-
- **Open models:** binary and ASCII STL, OBJ, 3MF, STEP/STP and IGES/IGS.
|
|
39
|
-
- **Work with scenes:** multiple models, selection, independent position, rotation and scale, colors, camera controls and an infinite grid.
|
|
40
|
-
- **Inspect geometry:** solid, smooth, edges, wireframe, X-ray and face-orientation views, section cuts, dimensions and mesh information.
|
|
41
|
-
- **Save locally:** PNG images and mesh exports in binary STL, OBJ, 3MF, STEP and IGES.
|
|
42
|
-
- **Save and restore scenes:** VSB packages the scene and meshes; VSJ stores scene settings and references to model files.
|
|
43
|
-
- **Check meshes for 3D printing:** topology checks, detailed intersection and volume analysis, issue highlights and optional FDM estimates.
|
|
44
|
-
- **Analyze on a server:** a Node.js API reuses the same parsers and mesh checks in background workers, with bounded concurrency and cancellation.
|
|
45
|
-
- **Embed in your own interface:** use the `StlViewer` API, or bind your own markup to the optional `mountViewstlApp` controller.
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
Choose a script tag, a browser ES module, or an npm package with your bundler. Each option uses the same viewer API and processes local files on the user's device.
|
|
50
|
-
|
|
51
|
-
### Script tag
|
|
52
|
-
|
|
53
|
-
Copy the **complete `build/v2/` directory** to your web server, for example as `/viewstl-v2/`. Keep its worker, `chunks/`, `cad/` and notice files together with the viewer.
|
|
54
|
-
|
|
55
|
-
```html
|
|
56
|
-
<input id="model-file" type="file" accept=".stl,.obj,.3mf,.step,.stp,.iges,.igs">
|
|
57
|
-
<div id="viewer" style="width:100%;height:500px"></div>
|
|
21
|
+
Replace `mystl.stl` with your model and serve the page over HTTP(S). Keep the worker, `chunks/` and `cad/` folders alongside the viewer. Archive/CAD dependencies are included and load only when needed; v2 does not require a separate JSZip setup.
|
|
58
22
|
|
|
59
|
-
|
|
60
|
-
<script>
|
|
61
|
-
const viewer = new StlViewer(document.getElementById('viewer'), {
|
|
62
|
-
load_error_callback: message => console.error(message)
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
document.getElementById('model-file').addEventListener('change', event => {
|
|
66
|
-
const file = event.target.files[0];
|
|
67
|
-
if (file) viewer.add_model({ local_file: file });
|
|
68
|
-
});
|
|
69
|
-
</script>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Each file selected in this example is added to the viewer. Files are read on the user's device. Serve the page over HTTP(S), and give the viewer container a nonzero height.
|
|
73
|
-
|
|
74
|
-
### ES modules
|
|
75
|
-
|
|
76
|
-
With the same `build/v2/` directory hosted on your server, use a module script:
|
|
77
|
-
|
|
78
|
-
```html
|
|
79
|
-
<div id="viewer" style="width:100%;height:500px"></div>
|
|
80
|
-
<script type="module">
|
|
81
|
-
import StlViewer from '/viewstl-v2/viewstl.js';
|
|
82
|
-
|
|
83
|
-
const viewer = new StlViewer(document.getElementById('viewer'), {
|
|
84
|
-
models: [{ id: 0, filename: '/models/part.stl' }]
|
|
85
|
-
});
|
|
86
|
-
</script>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Replace `/models/part.stl` with a model URL you serve. To open a local file instead, call `viewer.add_model({ local_file: file })` with a browser `File`, as in the script-tag example.
|
|
90
|
-
|
|
91
|
-
### npm and bundlers
|
|
92
|
-
|
|
93
|
-
> **Release candidate:** `2.0.0-rc.3` adds the Node.js model-analysis API to ViewSTL v2.00. Candidates use the `next` dist-tag; pin the version below for a repeatable installation.
|
|
94
|
-
|
|
95
|
-
Install the package in your application:
|
|
23
|
+
## npm / Node.js:
|
|
96
24
|
|
|
97
25
|
```sh
|
|
98
|
-
npm install
|
|
26
|
+
npm install viewstl
|
|
99
27
|
```
|
|
100
28
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Add a container to your page:
|
|
104
|
-
|
|
105
|
-
```html
|
|
106
|
-
<div id="viewer" style="width:100%;height:500px"></div>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Then import the viewer in your application's browser entry point, after the container exists:
|
|
29
|
+
Browser apps can import `StlViewer` from `viewstl`; see [worker setup](https://github.com/omrips/viewstl/blob/main/docs/v2-usage.md#es-modules-and-npm). Server-only analysis requires Node.js 20+:
|
|
110
30
|
|
|
111
31
|
```js
|
|
112
|
-
import
|
|
113
|
-
|
|
114
|
-
const viewer = new StlViewer(document.getElementById('viewer'), {
|
|
115
|
-
worker_url: '/viewstl-v2/viewstl.worker.js',
|
|
116
|
-
models: [{ id: 0, filename: '/models/part.stl' }],
|
|
117
|
-
load_error_callback: message => console.error(message)
|
|
118
|
-
});
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
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.
|
|
122
|
-
|
|
123
|
-
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.3/docs/v2-usage.md) for worker factories, callbacks and more examples.
|
|
124
|
-
|
|
125
|
-
## Formats and saving
|
|
126
|
-
|
|
127
|
-
| Format | Open | Save |
|
|
128
|
-
| --- | --- | --- |
|
|
129
|
-
| STL | Binary and ASCII, including supported color variants | Binary STL |
|
|
130
|
-
| OBJ | Geometry | Geometry; optional colors through an MTL companion |
|
|
131
|
-
| 3MF | Supported mesh, component, unit and color data | Meshes and colors |
|
|
132
|
-
| STEP / STP | CAD surfaces tessellated for viewing | Triangle surfaces |
|
|
133
|
-
| IGES / IGS | CAD surfaces tessellated for viewing | Triangle surfaces |
|
|
134
|
-
| VSB | Packaged ViewSTL scene | Scene settings and meshes in one archive |
|
|
135
|
-
| VSJ | ViewSTL scene with model references | Scene settings and model references |
|
|
136
|
-
| PNG | — | Image of the current view |
|
|
137
|
-
|
|
138
|
-
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.
|
|
139
|
-
|
|
140
|
-
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.3/docs/v2-usage.md#rendering-and-file-processing).
|
|
141
|
-
|
|
142
|
-
## Local files and URL imports
|
|
143
|
-
|
|
144
|
-
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.
|
|
145
|
-
|
|
146
|
-
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.
|
|
147
|
-
|
|
148
|
-
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.3/docs/v2-usage.md#optional-streaming-url-imports).
|
|
149
|
-
|
|
150
|
-
## Existing users and previous versions
|
|
151
|
-
|
|
152
|
-
**The legacy plugin remains available in the GitHub repository.** v2 has separate source and build directories, so switching to it is an explicit choice. The npm package contains the v2 distribution; it does not replace legacy download paths.
|
|
153
|
-
|
|
154
|
-
| | Legacy v1 | New v2 |
|
|
155
|
-
| --- | --- | --- |
|
|
156
|
-
| Source | Existing files in `src/` | `src/v2/` |
|
|
157
|
-
| Browser script | `build/stl_viewer.min.js` | `build/v2/viewstl.min.js` |
|
|
158
|
-
| Renderer | Three.js | Native WebGL 2 |
|
|
159
|
-
| Documentation | [viewstl.com/plugin](https://www.viewstl.com/plugin/) | [Package usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.3/docs/v2-usage.md) |
|
|
160
|
-
|
|
161
|
-
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.3/docs/v2-usage.md#existing-api-and-intentional-differences).
|
|
162
|
-
|
|
163
|
-
Existing tags and release history are retained. The [legacy archive notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.3/legacy/README.md) also describe the separate local v1.14 snapshot and its provenance.
|
|
164
|
-
|
|
165
|
-
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.
|
|
166
|
-
|
|
167
|
-
## Requirements and current limits
|
|
168
|
-
|
|
169
|
-
- A browser with WebGL 2 and module-worker support; WebAssembly is required for STEP/IGES import.
|
|
170
|
-
- Model capacity depends on geometry complexity and available browser/GPU memory. Configured limits reject files that exceed the budget.
|
|
171
|
-
- 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.
|
|
172
|
-
- 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.3/docs/v2-verification.md).
|
|
173
|
-
|
|
174
|
-
## Development
|
|
175
|
-
|
|
176
|
-
For contributors working in the source checkout, use Node.js 20 or newer and pnpm. The npm package contains the built viewer and documentation:
|
|
177
|
-
|
|
178
|
-
```sh
|
|
179
|
-
pnpm install --frozen-lockfile
|
|
180
|
-
pnpm build
|
|
181
|
-
pnpm test
|
|
182
|
-
pnpm check:types
|
|
183
|
-
pnpm check:legacy
|
|
184
|
-
pnpm start
|
|
32
|
+
import { analyzeFile } from 'viewstl/node';
|
|
33
|
+
console.log(await analyzeFile('part.stl', { units: 'mm' }));
|
|
185
34
|
```
|
|
186
35
|
|
|
187
|
-
|
|
36
|
+
No version suffix is needed. `npm install @omrips/viewstl` also installs the current release; existing scoped imports remain supported. Both names contain the same plugin, including animation and VSB/VSJ scene persistence.
|
|
188
37
|
|
|
189
|
-
|
|
38
|
+
More at [viewstl.com/plugin](https://www.viewstl.com/plugin/) (legacy documentation). For v2, see [usage and API notes](docs/v2-usage.md), [release notes](docs/releases/2.0.0-rc.5.md) and [verification](docs/v2-verification.md).
|
|
190
39
|
|
|
191
|
-
|
|
40
|
+
The [original README and usage examples](https://github.com/omrips/viewstl/blob/main/legacy/v1/README.md) are preserved with the legacy plugin. ViewSTL uses the [MIT license](LICENSE); optional dependencies retain their [third-party notices](THIRD-PARTY-NOTICES.txt).
|