beckhoff-xts-viewer-3d 5.0.0 → 5.2.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/README.md CHANGED
@@ -106,6 +106,15 @@ that wraps the seam of a closed loop; stations, areas, dimensions and info bars;
106
106
  stop-position ghost movers; and a stator heatmap driven by
107
107
  `(positionMm, value)` samples.
108
108
 
109
+ **Measuring and annotating.** CAD-style tools — point-to-point distance with
110
+ optional ΔX/ΔY/ΔZ guides, angle, polyline, and distance _along_ the XTS path —
111
+ picked in the scene with snapping to geometry corners and edges as well as to
112
+ mover centres, module boundaries, station stops and the track path itself.
113
+ Annotations pin a label anywhere, including to a mover, where they follow it
114
+ while it drives. Everything works the same in the 2D plan view, renders into
115
+ screenshots and video frames, and is fully drivable from
116
+ `viewerRef.current.measurements`.
117
+
109
118
  **Analysis.** Sub-millimetre mover collision detection, as a one-shot call or a
110
119
  continuous monitor, plus module-level collision probes.
111
120
 
@@ -119,6 +128,36 @@ the post-processing chain; the result reports whether that happened.
119
128
  animated `focusOn()` for stations, areas, movers, modules or the whole scene,
120
129
  and an opt-in CAD ViewCube.
121
130
 
131
+ ### Measurements and annotations
132
+
133
+ ```tsx
134
+ const viewer = useRef<XtsViewer3DRef>(null);
135
+ const [tool, setTool] = useState<MeasurementTool>('none');
136
+
137
+ <XtsViewer3D
138
+ ref={viewer}
139
+ config={config}
140
+ // The same tools work in the 3D view and the 2D plan view.
141
+ projection={plan2D ? 'orthographic' : 'perspective'}
142
+ measurement={{
143
+ tool, // 'distance' | 'angle' | 'path' | 'trackDistance' | 'annotation'
144
+ snap: { enabled: true, radiusPx: 14 },
145
+ onMeasurementCreate: (m, result) => console.log(m.kind, result.text),
146
+ }}
147
+ />;
148
+
149
+ // …or place and read measurements without any user interaction:
150
+ viewer.current.measurements.add({
151
+ kind: 'distance',
152
+ points: [{ positionMm: [0, 0, 200] }, { positionMm: [1000, 0, 200] }],
153
+ });
154
+ viewer.current.measurements.results(); // [{ value: 1000, text: '1 000.0 mm', … }]
155
+ const saved = viewer.current.measurements.toJSON(); // persist, restore with fromJSON()
156
+ ```
157
+
158
+ See [Measurements + annotations](docs/USING-THE-COMPONENT.md#17-measurements--annotations)
159
+ for the tools, the snap kinds and the full API.
160
+
122
161
  ## Gallery
123
162
 
124
163
  | | |
@@ -191,11 +230,22 @@ JSON sidecars:
191
230
 
192
231
  ```bash
193
232
  pnpm assets:convert # STP → GLB
233
+ pnpm assets:optimize # meshopt compression
234
+ pnpm assets:apply-materials # CAD placeholder colours → real PBR materials
235
+ pnpm assets:verify-colors # no authored STEP colour got lost
194
236
  pnpm assets:inspect # refresh docs/data/glb-inspection.json
195
237
  pnpm assets:generate-sidecars # module .meta.json origin corrections
196
238
  pnpm assets:generate-mover-sidecars
197
239
  ```
198
240
 
241
+ The CAD sources carry Autodesk Inventor placeholder colours, not product
242
+ colours — an AT2 motor module's whole solid is styled #696969 — so
243
+ `assets:apply-materials` maps them onto the named PBR library in
244
+ `scripts/materialLibrary.mjs` (anodised aluminium, stainless steel, hardened
245
+ rail steel, plastics, printed labels, LEDs). It rewrites only the GLB's JSON
246
+ chunk, leaving geometry and the compressed binary chunk byte-identical, and is
247
+ idempotent. See [docs/ADDING-A-MODULE.md](docs/ADDING-A-MODULE.md).
248
+
199
249
  The generators skip existing files so hand-tuned calibration is never
200
250
  overwritten; pass `--force` to regenerate. The release pipeline never runs them
201
251
  and reads the sidecars read-only.