beckhoff-xts-viewer-3d 6.2.0 → 6.3.0

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Philipp Leidig
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Philipp Leidig
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,273 +1,283 @@
1
- > **⚠️ Disclaimer — this is not a Beckhoff product**
2
- >
3
- > `beckhoff-xts-viewer-3d` is an independent, unofficial open-source project.
4
- > It is **not** developed, published, reviewed, endorsed, sponsored or
5
- > supported by Beckhoff Automation GmbH & Co. KG or by HepcoMotion, and it has
6
- > no affiliation with either company. Please do not contact their support
7
- > about it — open an
8
- > [issue](https://github.com/philippleidig/beckhoff-xts-viewer-3d/issues)
9
- > instead.
10
- >
11
- > "Beckhoff", "XTS" and "TwinCAT" are trademarks of Beckhoff Automation
12
- > GmbH & Co. KG; "Hepco", "HepcoMotion" and "GFX" are trademarks of Hepco
13
- > Slide Systems Ltd. They are used here only descriptively, to identify the
14
- > hardware this viewer renders, and remain the property of their respective
15
- > owners.
16
- >
17
- > The 3D geometry is derived from CAD data published by those manufacturers
18
- > for engineering use. Rights to that data and to the product designs it
19
- > depicts stay with their owners: the MIT license covers this project's own
20
- > source code only and grants no rights to third-party CAD data, trademarks or
21
- > other intellectual property. Rights holders can reach the maintainer through
22
- > a GitHub issue, and any material will be removed on request.
23
- >
24
- > The software is provided "as is", without warranty of any kind (see
25
- > [LICENSE](LICENSE)). It is a visualization aid: not a safety device, not
26
- > validated for machine control or any safety-related function, and no
27
- > substitute for the manufacturer's own documentation.
28
-
29
- # beckhoff-xts-viewer-3d
30
-
31
- [![npm](https://img.shields.io/npm/v/beckhoff-xts-viewer-3d.svg)](https://www.npmjs.com/package/beckhoff-xts-viewer-3d)
32
- [![npm assets](https://img.shields.io/npm/v/beckhoff-xts-viewer-3d-assets.svg?label=assets)](https://www.npmjs.com/package/beckhoff-xts-viewer-3d-assets)
33
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
34
- [![CI](https://github.com/philippleidig/beckhoff-xts-viewer-3d/actions/workflows/ci.yml/badge.svg)](https://github.com/philippleidig/beckhoff-xts-viewer-3d/actions/workflows/ci.yml)
35
-
36
- A React component that renders Beckhoff XTS linear-motor systems — and Hepco
37
- GFX rail variants — in 3D. It takes a declarative description of modules,
38
- movers and tools and handles the path math, GLB loading, mover animation,
39
- selection, lighting and camera work.
40
-
41
- It covers the same ground as the official 2D `Beckhoff.TwinCAT.HMI.XTS.Controls`
42
- viewer, using real CAD geometry in three dimensions.
43
-
44
- ![A 5 m XTS packaging line rendered by the viewer](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/01-packaging-line.webp)
45
-
46
- ## Installation
47
-
48
- ```bash
49
- npm install beckhoff-xts-viewer-3d
50
- npm install react react-dom three
51
- ```
52
-
53
- | Requirement | Version | Why |
54
- | ------------------------------------------------ | ------------------------ | -------------------------------------------------- |
55
- | `react` / `react-dom` | `^19.0.0` | required by `@react-three/fiber` 9 |
56
- | `three` | `>= 0.181.0` | the viewer uses the console-hook API added in r181 |
57
- | `@react-three/fiber` | `>= 9.0.0` | |
58
- | `@react-three/drei` | `>= 10.0.0` | |
59
- | `three-stdlib` | `>= 2.36.0` | GLTF, KTX2 and Meshopt loaders |
60
- | `postprocessing` + `@react-three/postprocessing` | `>= 6.39.2` / `>= 3.0.0` | optional — only needed for SSAO and bloom |
61
- | Node | `>= 20` | build tooling only; the runtime is browser ESM |
62
-
63
- The package is `"type": "module"` and ships ESM and CJS from
64
- `./dist/index.{js,cjs,d.ts}`. `sideEffects: false`, so unused exports
65
- tree-shake out.
66
-
67
- Any modern bundler works (Vite, Webpack, Next.js, Remix, Astro). If your
68
- bundler installs more than one copy of `three`, deduplicate it — see
69
- [Troubleshooting](#troubleshooting).
70
-
71
- ## Minimal example
72
-
73
- ```tsx
74
- import { XtsViewer3D } from 'beckhoff-xts-viewer-3d';
75
-
76
- <XtsViewer3D
77
- config={{
78
- processingUnits: [
79
- {
80
- objectId: 0,
81
- moverType: 'AT9014_0055',
82
- parts: [
83
- {
84
- objectId: 0,
85
- globalNumber: 0,
86
- modules: [
87
- { moduleType: 'AT2001_0250', globalNumber: 1 },
88
- { moduleType: 'AT2000_0250', globalNumber: 2 },
89
- { moduleType: 'AT2050_0500', globalNumber: 3 },
90
- { moduleType: 'AT2050_0501', globalNumber: 4 },
91
- { moduleType: 'AT2001_0250', globalNumber: 5 },
92
- { moduleType: 'AT2000_0250', globalNumber: 6 },
93
- { moduleType: 'AT2050_0500', globalNumber: 7 },
94
- { moduleType: 'AT2050_0501', globalNumber: 8 },
95
- ],
96
- },
97
- ],
98
- movers: [{ index: 0, id: 0, partOid: 0, partPositionMm: 200 }],
99
- },
100
- ],
101
- }}
102
- />;
103
- ```
104
-
105
- No asset hosting is required. GLBs stream from the matching
106
- `beckhoff-xts-viewer-3d-assets` release on jsDelivr; see
107
- [asset hosting](docs/USING-THE-COMPONENT.md#1-glb-assets--zero-config-by-default)
108
- to self-host them instead.
109
-
110
- ## Module catalogue
111
-
112
- Every image on this page comes out of the component itself, through the same
113
- `exportScreenshot()` a consumer calls, and shows a layout a line would
114
- actually be built as — a 5 m racetrack with four stations, a buffer loop
115
- beside it. See [docs/screenshots](docs/screenshots/README.md) for the capture
116
- script and [`playground/src/configs.ts`](playground/src/configs.ts) for the
117
- layouts themselves.
118
-
119
- | | | |
120
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
121
- | ![Standard AT](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/02-standard-at.webp)<br>**Standard AT** — AT2001 infeed, AT2000 straights and the AT2050 180° clothoid reversal. | ![Eco AT2200](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/03-eco-at2200.webp)<br>**Eco AT2200 / AT2202** — 500 mm straights, which pair naturally with the 500 mm reversal. | ![NCT with AT8200 tools](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/04-nct-tools.webp)<br>**NCT AT2002 / AT2102** — high modules carrying AT8200 tool carriers on the movers. |
122
- | ![Hygienic ATH](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/05-hygienic-ath.webp)<br>**Hygienic ATH** — stainless housings, sealed joints and the ATH9011 mover. | ![Hepco GFX2](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/06-hepco-gfx.webp)<br>**Hepco GFX2** — the procedural GFX rail profile with a GFX2 1TC carriage instead of the Beckhoff guiding rail. | ![Material close-up](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/07-materials-closeup.webp)<br>**Real materials, not CAD colours** — anodised housing, stator packs, printed type plate with its LED row. |
123
-
124
- The GLBs ship with a named PBR material library rather than the CAD sources'
125
- placeholder colours — see [Asset pipeline](#asset-pipeline).
126
-
127
- ## Features
128
-
129
- **Geometry and layout.** The full Beckhoff module and mover catalogue —
130
- Standard AT, Eco AT2200, NCT (AT2002 / AT2102 with AT8200 tools), Hygienic ATH
131
- and Hepco GFX2 — with straights, ±22.5° and ±45° curves and the AT2050 / ATH2050
132
- 180° clothoid reversal. Both Hepco guideways are modelled as procedural
133
- sections swept along the track and picked by the carriage on it: the TL1
134
- 1-Trak spear bar under a `1TC` carriage, the PRT2 size-44 track under an
135
- `FCC` one. Module-to-module C0/C1 continuity is pinned by golden
136
- fixtures. Per-XPU `trackTransform` places independent lines in one scene, and
137
- `positionFrame` remaps every position value into the host's coordinate
138
- convention without touching the rest of the config.
139
-
140
- **Mover motion.** `setMoverPositions()` writes into a per-component store that
141
- `useFrame` drains directly into the three.js scene graph, so a 60 Hz drive loop
142
- produces no React renders. An instanced fast path batches mover bodies into a
143
- draw-call count that no longer grows with the mover count, where per-mover
144
- scene nodes are not needed.
145
-
146
- **Rendering.** ACES filmic tone mapping, image-based lighting from a
147
- procedurally built indoor environment, anisotropic filtering and optional
148
- PCF-soft shadows, all switchable through `display.*`. SSAO and bloom are
149
- available when the optional post-processing peers are installed.
150
-
151
- **Interaction and status.** Click selection for modules, movers, whole tracks
152
- and static custom assets, tinting the GLB itself rather than overlaying
153
- wireframes; draggable translate / rotate / scale handles on a selected track
154
- or custom asset, in the same palette as the orientation gizmo; drive-status blink plus
155
- camera-facing warning and error icons; feed-segment (Einspeisestrang) tinting
156
- that wraps the seam of a closed loop; stations, areas, dimensions and info bars;
157
- stop-position ghost movers; and a stator heatmap driven by
158
- `(positionMm, value)` samples.
159
-
160
- **Measuring and annotating.** CAD-style tools — point-to-point distance with
161
- optional ΔX/ΔY/ΔZ guides, angle, polyline, and distance _along_ the XTS path —
162
- picked in the scene with snapping to geometry corners and edges as well as to
163
- mover centres, module boundaries, station stops and the track path itself.
164
- Annotations pin a label anywhere, including to a mover, where they follow it
165
- while it drives. Everything works the same in the 2D plan view, renders into
166
- screenshots and video frames, and is fully drivable from
167
- `viewerRef.current.measurements`.
168
-
169
- **Analysis.** Sub-millimetre mover collision detection, as a one-shot call or a
170
- continuous monitor, plus module-level collision probes.
171
-
172
- **Export.** `exportScreenshot()` renders offscreen at any resolution with MSAA,
173
- in current-camera, top-down or saved-camera mode. `beginFrameCapture()` opens a
174
- reusable session whose `grab()` returns a frame synchronously without image
175
- encoding, and keeps producing frames while the window is minimised. Both bypass
176
- the post-processing chain; the result reports whether that happened.
177
-
178
- **Camera.** Orthographic top-down projection for a live 2D plan view, an
179
- animated `focusOn()` for stations, areas, movers, modules or the whole scene,
180
- and an opt-in X / Y / Z orientation gizmo.
181
-
182
- ### Measurements and annotations
183
-
184
- ```tsx
185
- const viewer = useRef<XtsViewer3DRef>(null);
186
- const [tool, setTool] = useState<MeasurementTool>('none');
187
-
188
- <XtsViewer3D
189
- ref={viewer}
190
- config={config}
191
- // The same tools work in the 3D view and the 2D plan view.
192
- projection={plan2D ? 'orthographic' : 'perspective'}
193
- measurement={{
194
- tool, // 'distance' | 'angle' | 'path' | 'trackDistance' | 'annotation'
195
- snap: { enabled: true, radiusPx: 14 },
196
- onMeasurementCreate: (m, result) => console.log(m.kind, result.text),
197
- }}
198
- />;
199
-
200
- // …or place and read measurements without any user interaction:
201
- viewer.current.measurements.add({
202
- kind: 'distance',
203
- points: [{ positionMm: [0, 0, 200] }, { positionMm: [1000, 0, 200] }],
204
- });
205
- viewer.current.measurements.results(); // [{ value: 1000, text: '1 000.0 mm', … }]
206
- const saved = viewer.current.measurements.toJSON(); // persist, restore with fromJSON()
207
- ```
208
-
209
- See [Measurements + annotations](docs/USING-THE-COMPONENT.md#17-measurements--annotations)
210
- for the tools, the snap kinds and the full API.
211
-
212
- ## Gallery
213
-
214
- | | |
215
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
216
- | ![Two parallel lines](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/08-multi-track.webp)<br>A packaging line and a buffer loop side by side, placed with `trackTransform`. | ![Stations and areas](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/09-stations-areas.webp)<br>Station tubes with their stop markers, ghost movers parked on the stops, and cleanroom / manual-access zones. |
217
- | ![Dimensions and stations](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/10-dimensions.webp)<br>Dimensions along the track, stepped out from the modules they measure. | ![Stator heatmap](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/11-stator-heatmap.webp)<br>Vertex-colour gradient along the centerline, fed from `(positionMm, value)` samples. |
218
- | ![Collision detection](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/12-collision.webp)<br>Two movers of the line parked at a 1 mm overlap — `checkMoverCollisions()` reports the penetration. | ![Drive status](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/13-drive-status.webp)<br>Emissive tint on the GLB plus camera-facing warning and error icons, on modules and movers alike. |
219
- | ![Feed segments](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/14-feed-segments.webp)<br>`feedSegmentHighlights` tints whole electrical strands; the pink one wraps the loop seam. | ![Measurements and annotations](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/15-measurements.webp)<br>A distance across the loop with ΔX/ΔY guides and two annotations, placed through `viewerRef.current.measurements`. |
220
- | ![Selection](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/16-selection.webp)<br>Selection tints the GLB itself — two modules green, one mover orange — rather than overlaying a wireframe. | ![Shadows and IBL](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/18-shadows.webp)<br>Opt-in PCF-soft shadows over the procedurally built indoor environment. |
221
- | ![Many movers](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/19-perf-stress.webp)<br>750 movers on three ovals, animated at 60 Hz with no React commits in steady state. | |
222
-
223
- ![Top-down export](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/17-plan-view.webp)
224
-
225
- `exportScreenshot({ mode: 'top-down' })` — orthographic, fitted to the scene
226
- AABB. The same view is available live through `projection="orthographic"`.
227
-
228
- ## Troubleshooting
229
-
230
- ### Modules render as yellow boxes and movers as blue boxes
231
-
232
- The viewer is showing wireframe placeholders because no GLB was accepted. The
233
- console also reports `THREE.WARNING: Multiple instances of Three.js being
234
- imported`, and no `models/*.glb` requests appear in the network panel.
235
-
236
- This happens when a transitive dependency pins its own copy of `three`. Two
237
- copies mean two `THREE.*` namespaces, and the `instanceof` checks inside
238
- `useGLTF` reject every parsed scene across that boundary.
239
-
240
- Deduplicate `three` in your bundler:
241
-
242
- ```ts
243
- // vite.config.ts
244
- export default defineConfig({
245
- plugins: [react()],
246
- resolve: { dedupe: ['three'] },
247
- });
248
- ```
249
-
250
- For Webpack and Next.js, alias `three` to your root `node_modules/three`.
251
- [Bundler configuration](docs/USING-THE-COMPONENT.md#bundler-configuration--deduplicate-three)
252
- has the full snippets and explains how to clear Vite's pre-bundle cache
253
- afterwards.
254
-
255
- ## Documentation
256
-
257
- - [Using the component](docs/USING-THE-COMPONENT.md) — every prop, every ref
258
- method, asset hosting, recipes and performance tuning.
259
- - [Adding a module](docs/ADDING-A-MODULE.md) — taking a new module, mover or
260
- tool type from STP file to calibrated GLB.
261
- - [Performance](docs/PERFORMANCE.md) — the asset compression pipeline and the
262
- runtime budget.
263
- - [Releasing](docs/RELEASING.md) — the automated publish flow.
264
- - [Migrating to v6](MIGRATION.md) — what changed and what to do about it.
265
-
266
- ## Contributing
267
-
268
- Setup, the asset pipeline, the repository layout and the release flow are in
269
- [CONTRIBUTING.md](CONTRIBUTING.md).
270
-
271
- ## License
272
-
273
- MIT — see [LICENSE](LICENSE).
1
+ > **⚠️ Disclaimer — this is not a Beckhoff product**
2
+ >
3
+ > `beckhoff-xts-viewer-3d` is an independent, unofficial open-source project.
4
+ > It is **not** developed, published, reviewed, endorsed, sponsored or
5
+ > supported by Beckhoff Automation GmbH & Co. KG or by HepcoMotion, and it has
6
+ > no affiliation with either company. Please do not contact their support
7
+ > about it — open an
8
+ > [issue](https://github.com/philippleidig/beckhoff-xts-viewer-3d/issues)
9
+ > instead.
10
+ >
11
+ > "Beckhoff", "XTS" and "TwinCAT" are trademarks of Beckhoff Automation
12
+ > GmbH & Co. KG; "Hepco", "HepcoMotion" and "GFX" are trademarks of Hepco
13
+ > Slide Systems Ltd. They are used here only descriptively, to identify the
14
+ > hardware this viewer renders, and remain the property of their respective
15
+ > owners.
16
+ >
17
+ > The 3D geometry is derived from CAD data published by those manufacturers
18
+ > for engineering use. Rights to that data and to the product designs it
19
+ > depicts stay with their owners: the MIT license covers this project's own
20
+ > source code only and grants no rights to third-party CAD data, trademarks or
21
+ > other intellectual property. Rights holders can reach the maintainer through
22
+ > a GitHub issue, and any material will be removed on request.
23
+ >
24
+ > The software is provided "as is", without warranty of any kind (see
25
+ > [LICENSE](LICENSE)). It is a visualization aid: not a safety device, not
26
+ > validated for machine control or any safety-related function, and no
27
+ > substitute for the manufacturer's own documentation.
28
+
29
+ # beckhoff-xts-viewer-3d
30
+
31
+ [![npm](https://img.shields.io/npm/v/beckhoff-xts-viewer-3d.svg)](https://www.npmjs.com/package/beckhoff-xts-viewer-3d)
32
+ [![npm assets](https://img.shields.io/npm/v/beckhoff-xts-viewer-3d-assets.svg?label=assets)](https://www.npmjs.com/package/beckhoff-xts-viewer-3d-assets)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
34
+ [![CI](https://github.com/philippleidig/beckhoff-xts-viewer-3d/actions/workflows/ci.yml/badge.svg)](https://github.com/philippleidig/beckhoff-xts-viewer-3d/actions/workflows/ci.yml)
35
+
36
+ A React component that renders Beckhoff XTS linear-motor systems — and Hepco
37
+ GFX rail variants — in 3D. It takes a declarative description of modules,
38
+ movers and tools and handles the path math, GLB loading, mover animation,
39
+ selection, lighting and camera work.
40
+
41
+ It covers the same ground as the official 2D `Beckhoff.TwinCAT.HMI.XTS.Controls`
42
+ viewer, using real CAD geometry in three dimensions.
43
+
44
+ ![A 5 m XTS packaging line rendered by the viewer](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/01-packaging-line.webp)
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ npm install beckhoff-xts-viewer-3d
50
+ npm install react react-dom three
51
+ ```
52
+
53
+ | Requirement | Version | Why |
54
+ | ------------------------------------------------ | ------------------------ | -------------------------------------------------- |
55
+ | `react` / `react-dom` | `^19.0.0` | required by `@react-three/fiber` 9 |
56
+ | `three` | `>= 0.181.0` | the viewer uses the console-hook API added in r181 |
57
+ | `@react-three/fiber` | `>= 9.0.0` | |
58
+ | `@react-three/drei` | `>= 10.0.0` | |
59
+ | `three-stdlib` | `>= 2.36.0` | GLTF, KTX2 and Meshopt loaders |
60
+ | `postprocessing` + `@react-three/postprocessing` | `>= 6.39.2` / `>= 3.0.0` | optional — only needed for SSAO and bloom |
61
+ | Node | `>= 20` | build tooling only; the runtime is browser ESM |
62
+
63
+ The package is `"type": "module"` and ships ESM and CJS from
64
+ `./dist/index.{js,cjs,d.ts}`. `sideEffects: false`, so unused exports
65
+ tree-shake out.
66
+
67
+ Any modern bundler works (Vite, Webpack, Next.js, Remix, Astro). If your
68
+ bundler installs more than one copy of `three`, deduplicate it — see
69
+ [Troubleshooting](#troubleshooting).
70
+
71
+ ## Minimal example
72
+
73
+ ```tsx
74
+ import { XtsViewer3D } from 'beckhoff-xts-viewer-3d';
75
+
76
+ <XtsViewer3D
77
+ config={{
78
+ processingUnits: [
79
+ {
80
+ objectId: 0,
81
+ moverType: 'AT9014_0055',
82
+ parts: [
83
+ {
84
+ objectId: 0,
85
+ globalNumber: 0,
86
+ modules: [
87
+ { moduleType: 'AT2001_0250', globalNumber: 1 },
88
+ { moduleType: 'AT2000_0250', globalNumber: 2 },
89
+ { moduleType: 'AT2050_0500', globalNumber: 3 },
90
+ { moduleType: 'AT2050_0501', globalNumber: 4 },
91
+ { moduleType: 'AT2001_0250', globalNumber: 5 },
92
+ { moduleType: 'AT2000_0250', globalNumber: 6 },
93
+ { moduleType: 'AT2050_0500', globalNumber: 7 },
94
+ { moduleType: 'AT2050_0501', globalNumber: 8 },
95
+ ],
96
+ },
97
+ ],
98
+ movers: [{ index: 0, id: 0, partOid: 0, partPositionMm: 200 }],
99
+ },
100
+ ],
101
+ }}
102
+ />;
103
+ ```
104
+
105
+ No asset hosting is required. GLBs stream from the matching
106
+ `beckhoff-xts-viewer-3d-assets` release on jsDelivr; see
107
+ [asset hosting](docs/USING-THE-COMPONENT.md#1-glb-assets--zero-config-by-default)
108
+ to self-host them instead.
109
+
110
+ ## Module catalogue
111
+
112
+ Every image on this page comes out of the component itself, through the same
113
+ `exportScreenshot()` a consumer calls, and shows a layout a line would
114
+ actually be built as — a 5 m racetrack with four stations, a buffer loop
115
+ beside it. See [docs/screenshots](docs/screenshots/README.md) for the capture
116
+ script and [`playground/src/configs.ts`](playground/src/configs.ts) for the
117
+ layouts themselves.
118
+
119
+ | | | |
120
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
121
+ | ![Standard AT](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/02-standard-at.webp)<br>**Standard AT** — AT2001 infeed, AT2000 straights and the AT2050 180° clothoid reversal. | ![Eco AT2200](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/03-eco-at2200.webp)<br>**Eco AT2200 / AT2202** — 500 mm straights, which pair naturally with the 500 mm reversal. | ![NCT with AT8200 tools](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/04-nct-tools.webp)<br>**NCT AT2002 / AT2102** — high modules carrying AT8200 tool carriers on the movers. |
122
+ | ![Hygienic ATH](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/05-hygienic-ath.webp)<br>**Hygienic ATH** — stainless housings, sealed joints and the ATH9011 mover. | ![Hepco GFX2](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/06-hepco-gfx.webp)<br>**Hepco GFX2** — the procedural GFX rail profile with a GFX2 1TC carriage instead of the Beckhoff guiding rail. | ![Material close-up](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/07-materials-closeup.webp)<br>**Real materials, not CAD colours** — anodised housing, stator packs, printed type plate with its LED row. |
123
+
124
+ The GLBs ship with a named PBR material library rather than the CAD sources'
125
+ placeholder colours — see [Asset pipeline](#asset-pipeline).
126
+
127
+ ## Features
128
+
129
+ **Geometry and layout.** The full Beckhoff module and mover catalogue —
130
+ Standard AT, Eco AT2200, NCT (AT2002 / AT2102 with AT8200 tools), Hygienic ATH
131
+ and Hepco GFX2 — with straights, ±22.5° and ±45° curves and the AT2050 / ATH2050
132
+ 180° clothoid reversal. Both Hepco guideways are modelled as procedural
133
+ sections swept along the track and picked by the carriage on it: the TL1
134
+ 1-Trak spear bar under a `1TC` carriage, the PRT2 size-44 track under an
135
+ `FCC` one. Module-to-module C0/C1 continuity is pinned by golden
136
+ fixtures. Per-XPU `trackTransform` places independent lines in one scene, and
137
+ `positionFrame` remaps every position value into the host's coordinate
138
+ convention without touching the rest of the config.
139
+
140
+ **Mover motion.** `setMoverPositions()` writes into a per-component store that
141
+ `useFrame` drains directly into the three.js scene graph, so a 60 Hz drive loop
142
+ produces no React renders. An instanced fast path batches mover bodies into a
143
+ draw-call count that no longer grows with the mover count, where per-mover
144
+ scene nodes are not needed.
145
+
146
+ **Rendering.** ACES filmic tone mapping, image-based lighting from a
147
+ procedurally built indoor environment, anisotropic filtering and optional
148
+ PCF-soft shadows, all switchable through `display.*`. SSAO and bloom are
149
+ available when the optional post-processing peers are installed.
150
+
151
+ **Interaction and status.** Click selection for modules, movers, whole tracks
152
+ and static custom assets, tinting the GLB itself rather than overlaying
153
+ wireframes; draggable translate / rotate / scale handles on a selected track
154
+ or custom asset, in the same palette as the orientation gizmo; drive-status blink plus
155
+ camera-facing warning and error icons; feed-segment (Einspeisestrang) tinting
156
+ that wraps the seam of a closed loop; stations, areas, dimensions and info bars;
157
+ stop-position ghost movers; and a stator heatmap driven by
158
+ `(positionMm, value)` samples.
159
+
160
+ **Measuring and annotating.** CAD-style tools — point-to-point distance with
161
+ optional ΔX/ΔY/ΔZ guides, angle, polyline, and distance _along_ the XTS path —
162
+ picked in the scene with snapping to geometry corners and edges as well as to
163
+ mover centres, module boundaries, station stops and the track path itself.
164
+ Annotations pin a label anywhere, including to a mover, where they follow it
165
+ while it drives. Everything works the same in the 2D plan view, renders into
166
+ screenshots and video frames, and is fully drivable from
167
+ `viewerRef.current.measurements`.
168
+
169
+ **Analysis.** Sub-millimetre mover collision detection, as a one-shot call or a
170
+ continuous monitor, plus module-level collision probes.
171
+
172
+ **Export.** `exportScreenshot()` renders offscreen at any resolution with MSAA,
173
+ in current-camera, top-down or saved-camera mode. `beginFrameCapture()` opens a
174
+ reusable session whose `grab()` returns a frame synchronously without image
175
+ encoding, and keeps producing frames while the window is minimised. Both bypass
176
+ the post-processing chain; the result reports whether that happened.
177
+
178
+ **Camera.** Orthographic top-down projection for a live 2D plan view, an
179
+ animated `focusOn()` for stations, areas, movers, modules or the whole scene,
180
+ and an opt-in X / Y / Z orientation gizmo.
181
+
182
+ ### Measurements and annotations
183
+
184
+ ```tsx
185
+ const viewer = useRef<XtsViewer3DRef>(null);
186
+ const [tool, setTool] = useState<MeasurementTool>('none');
187
+
188
+ <XtsViewer3D
189
+ ref={viewer}
190
+ config={config}
191
+ // The same tools work in the 3D view and the 2D plan view.
192
+ projection={plan2D ? 'orthographic' : 'perspective'}
193
+ measurement={{
194
+ tool, // 'distance' | 'angle' | 'path' | 'trackDistance' | 'annotation'
195
+ snap: { enabled: true, radiusPx: 14 },
196
+ onMeasurementCreate: (m, result) => console.log(m.kind, result.text),
197
+ }}
198
+ />;
199
+
200
+ // …or place and read measurements without any user interaction:
201
+ viewer.current.measurements.add({
202
+ kind: 'distance',
203
+ points: [{ positionMm: [0, 0, 200] }, { positionMm: [1000, 0, 200] }],
204
+ });
205
+ viewer.current.measurements.results(); // [{ value: 1000, text: '1 000.0 mm', … }]
206
+ const saved = viewer.current.measurements.toJSON(); // persist, restore with fromJSON()
207
+ ```
208
+
209
+ See [Measurements + annotations](docs/USING-THE-COMPONENT.md#17-measurements--annotations)
210
+ for the tools, the snap kinds and the full API.
211
+
212
+ ## Gallery
213
+
214
+ | | |
215
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
216
+ | ![Two parallel lines](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/08-multi-track.webp)<br>A packaging line and a buffer loop side by side, placed with `trackTransform`. | ![Stations and areas](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/09-stations-areas.webp)<br>Station tubes with their stop markers, ghost movers parked on the stops, and cleanroom / manual-access zones. |
217
+ | ![Dimensions and stations](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/10-dimensions.webp)<br>Dimensions along the track, stepped out from the modules they measure. | ![Stator heatmap](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/11-stator-heatmap.webp)<br>Vertex-colour gradient along the centerline, fed from `(positionMm, value)` samples. |
218
+ | ![Collision detection](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/12-collision.webp)<br>Two movers of the line parked at a 1 mm overlap — `checkMoverCollisions()` reports the penetration. | ![Drive status](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/13-drive-status.webp)<br>Emissive tint on the GLB plus camera-facing warning and error icons, on modules and movers alike. |
219
+ | ![Feed segments](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/14-feed-segments.webp)<br>`feedSegmentHighlights` tints whole electrical strands; the pink one wraps the loop seam. | ![Measurements and annotations](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/15-measurements.webp)<br>A distance across the loop with ΔX/ΔY guides and two annotations, placed through `viewerRef.current.measurements`. |
220
+ | ![Selection](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/16-selection.webp)<br>Selection tints the GLB itself — two modules green, one mover orange — rather than overlaying a wireframe. | ![Shadows and IBL](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/18-shadows.webp)<br>Opt-in PCF-soft shadows over the procedurally built indoor environment. |
221
+ | ![Many movers](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/19-perf-stress.webp)<br>750 movers on three ovals, animated at 60 Hz with no React commits in steady state. | |
222
+
223
+ ![Top-down export](https://cdn.jsdelivr.net/npm/beckhoff-xts-viewer-3d/docs/screenshots/17-plan-view.webp)
224
+
225
+ `exportScreenshot({ mode: 'top-down' })` — orthographic, fitted to the scene
226
+ AABB. The same view is available live through `projection="orthographic"`.
227
+
228
+ ## Troubleshooting
229
+
230
+ ### Modules render as yellow boxes and movers as blue boxes
231
+
232
+ The viewer is showing wireframe placeholders because no GLB was accepted. The
233
+ console also reports `THREE.WARNING: Multiple instances of Three.js being
234
+ imported`, and no `models/*.glb` requests appear in the network panel.
235
+
236
+ This happens when a transitive dependency pins its own copy of `three`. Two
237
+ copies mean two `THREE.*` namespaces, and the `instanceof` checks inside
238
+ `useGLTF` reject every parsed scene across that boundary.
239
+
240
+ Deduplicate `three` in your bundler:
241
+
242
+ ```ts
243
+ // vite.config.ts
244
+ export default defineConfig({
245
+ plugins: [react()],
246
+ resolve: { dedupe: ['three'] },
247
+ });
248
+ ```
249
+
250
+ For Webpack and Next.js, alias `three` to your root `node_modules/three`.
251
+ [Bundler configuration](docs/USING-THE-COMPONENT.md#bundler-configuration--deduplicate-three)
252
+ has the full snippets and explains how to clear Vite's pre-bundle cache
253
+ afterwards.
254
+
255
+ ### Labels are missing and the console names `connect-src`
256
+
257
+ The page's Content-Security-Policy blocks the built-in label font, which
258
+ the viewer loads from a `blob:` URL. The viewer falls back to a `data:`
259
+ URL where `connect-src` allows it and logs which directive to change.
260
+ Add `blob:` to `connect-src` and `worker-src`.
261
+ [Content-Security-Policy](docs/USING-THE-COMPONENT.md#content-security-policy)
262
+ lists every directive the viewer needs, including
263
+ `script-src 'wasm-unsafe-eval'` for the compressed models.
264
+
265
+ ## Documentation
266
+
267
+ - [Using the component](docs/USING-THE-COMPONENT.md) — every prop, every ref
268
+ method, asset hosting, recipes and performance tuning.
269
+ - [Adding a module](docs/ADDING-A-MODULE.md) — taking a new module, mover or
270
+ tool type from STP file to calibrated GLB.
271
+ - [Performance](docs/PERFORMANCE.md) — the asset compression pipeline and the
272
+ runtime budget.
273
+ - [Releasing](docs/RELEASING.md) — the automated publish flow.
274
+ - [Migrating to v6](MIGRATION.md) — what changed and what to do about it.
275
+
276
+ ## Contributing
277
+
278
+ Setup, the asset pipeline, the repository layout and the release flow are in
279
+ [CONTRIBUTING.md](CONTRIBUTING.md).
280
+
281
+ ## License
282
+
283
+ MIT — see [LICENSE](LICENSE).