@toolpath/viewer 2.3.1 → 2.5.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 +801 -1169
- package/dist/{chunk-N54FHMTG.js → chunk-LBG6GVGE.js} +405 -86
- package/dist/engine/index.d.ts +14 -3
- package/dist/engine/index.js +5 -3
- package/dist/index.d.ts +12 -2
- package/dist/index.js +13 -1
- package/dist/{normalize-C4Wj4IGK.d.ts → normalize-BBADLCmd.d.ts} +47 -2
- package/package.json +1 -1
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PartModel, a as PartMeshRefs } from '../normalize-
|
|
2
|
-
export { E as EnginePart,
|
|
1
|
+
import { P as PartModel, a as PartMeshRefs, b as PartModelFeature, T as ThreadMark } from '../normalize-BBADLCmd.js';
|
|
2
|
+
export { E as EnginePart, c as EnginePartProps, M as MIN_KERNEL_VERSION, d as assertSupportedKernelVersion, n as normalizePartReport, s as smoothRegionNormals } from '../normalize-BBADLCmd.js';
|
|
3
3
|
import { BufferGeometry } from 'three';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -115,4 +115,15 @@ declare function loadPartMesh(mesh: PartMeshRefs, options?: LoadPartGeometryOpti
|
|
|
115
115
|
*/
|
|
116
116
|
declare function parsePartGeometry(data: ArrayBuffer, mesh: PartMeshExpectation, format?: MeshFormat): Promise<BufferGeometry>;
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
/**
|
|
119
|
+
* The thread to draw in a hole, read from its Engine datasheet: a hole's
|
|
120
|
+
* `facts.threading.spec`, which the Engine fills for a modeled thread it
|
|
121
|
+
* took for a catalog thread (ISO 6H, ANSI 2B, straight pipe). `null` for a
|
|
122
|
+
* plain hole, any other feature, and a datasheet of an unexpected shape.
|
|
123
|
+
*
|
|
124
|
+
* Only what the Engine sends is drawn: a thread it did not report is not
|
|
125
|
+
* guessed at from the mesh.
|
|
126
|
+
*/
|
|
127
|
+
declare function threadMark(feature: PartModelFeature, datasheet: unknown): ThreadMark | null;
|
|
128
|
+
|
|
129
|
+
export { type CacheablePart, type EngineGeometryCache, type EngineGeometryResource, type FetchLike, type LoadPartGeometryOptions, type MeshAsset, type MeshFormat, PartMeshError, type PartMeshExpectation, createEngineGeometryCache, engineGeometryCache, engineGeometryResourceKey, loadPartGeometry, loadPartMesh, parsePartGeometry, partMeshAssets, threadMark };
|
package/dist/engine/index.js
CHANGED
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
normalizePartReport,
|
|
12
12
|
parsePartGeometry,
|
|
13
13
|
partMeshAssets,
|
|
14
|
-
smoothRegionNormals
|
|
15
|
-
|
|
14
|
+
smoothRegionNormals,
|
|
15
|
+
threadMark
|
|
16
|
+
} from "../chunk-LBG6GVGE.js";
|
|
16
17
|
export {
|
|
17
18
|
EnginePart,
|
|
18
19
|
MIN_KERNEL_VERSION,
|
|
@@ -26,5 +27,6 @@ export {
|
|
|
26
27
|
normalizePartReport,
|
|
27
28
|
parsePartGeometry,
|
|
28
29
|
partMeshAssets,
|
|
29
|
-
smoothRegionNormals
|
|
30
|
+
smoothRegionNormals,
|
|
31
|
+
threadMark
|
|
30
32
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PartModel, F as FeatureTag,
|
|
2
|
-
export { A as AXES_PLANE_OFFSET,
|
|
1
|
+
import { P as PartModel, F as FeatureTag, e as PartPick, V as Vec3, R as RegionHighlight, f as ViewerTheme, S as SectionOptions, g as SectionState, h as ViewerCamera, i as ViewportSize, j as PartModelRegion, C as CameraLimits, k as ViewerView, l as Projection, m as TriangleRange, o as RegionIndex, b as PartModelFeature, p as FeatureType } from './normalize-BBADLCmd.js';
|
|
2
|
+
export { A as AXES_PLANE_OFFSET, q as AXES_PLANE_SCALE, r as AxesPlane, B as BuildPickInput, t as CAD_CAMERA_UP, u as CANDIDATE_WEIGHT, v as CAP_HATCH, D as DEFAULT_FIT_MARGIN, w as DEFAULT_SECTION_NORMAL, x as DEFAULT_THEME, y as DIRECTION_COLORS, z as DISABLED_SECTION, G as EXCLUDE_FROM_FRAME, E as EnginePart, H as FeatureHighlight, I as FocusOptions, J as HANDLE_PIXELS, K as HIGHLIGHT_COLORS, L as HIGHLIGHT_WEIGHT, N as HOVER_WEIGHT, O as HighlightLayers, Q as KnownFeatureType, U as KnownShapeKind, W as MAX_FRAME_RATIO, X as MIN_FRAME_RATIO, Y as NO_MODIFIERS, Z as OUTLINE_SCALE, _ as PERSPECTIVE_FOV, $ as PICKED_SURFACE_LABEL, a0 as PREVIEW_SCALE, a1 as PartDisplay, a2 as PartMesh, a3 as PartMeshProps, a as PartMeshRefs, a4 as PartObject, a5 as PickModifiers, a6 as PointerLocation, a7 as REGION_ATTRIBUTE, a8 as RegionPaint, a9 as SECTION_GIZMO_FRAME_SCALE, aa as SECTION_RENDER_ORDER, ab as SceneBounds, ac as SectionAnchor, ad as SectionBounds, ae as SectionPlacement, af as ShapeKind, ag as SharpCorner, ah as SharpCornerOptions, ai as SurfaceCreases, aj as SurfaceHit, T as ThreadMark, ak as ThreadOptions, al as adaptedUp, am as applyHighlightLayers, an as applyProjection, ao as aspectRatio, ap as axesPlanes, aq as boundsFromBox, ar as buildPick, as as buildRegionAttribute, at as buildRegionTexels, au as cadViewDirections, av as cameraLimits, aw as contentBounds, ax as createPart, ay as currentViewDirection, az as defaultBounds, aA as directionColor, aB as dragPlane, aC as excludedFromFrame, aD as findSharpCorners, aE as fitDistance, aF as focusForPick, aG as hitUnderRay, n as normalizePartReport, aH as orthographicHalfHeight, aI as perspectiveFitDistance, aJ as pickedStartDepth, aK as resolveTheme, aL as screenLength, aM as sectionAnchor, aN as sectionBounds, aO as sectionConstant, aP as sectionDepth, aQ as sectionDepthConstant, aR as sectionDepthRange, aS as sectionFromPick, aT as sectionMeasurement, aU as sectionOffset, aV as sectionOptionsFromState, aW as sectionPlane, aX as sharpCornerPositions, s as smoothRegionNormals, aY as startPosition, aZ as surfaceCreases, a_ as surfaceUnderRay, a$ as targetBoundary, b0 as themesEqual, b1 as viewDirection } from './normalize-BBADLCmd.js';
|
|
3
3
|
import { BufferGeometry, Box3, CanvasTexture, Plane, Vector3, Matrix4, Vector2, Ray, ShaderMaterial, Texture, Color, MeshBasicMaterial, WebGLRenderTarget } from 'three';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, PropsWithChildren, RefObject, CSSProperties } from 'react';
|
|
@@ -93,6 +93,8 @@ interface ViewerToolbarControls {
|
|
|
93
93
|
dfm?: ViewerToolbarControl;
|
|
94
94
|
/** The DFM rules' sharp corners, drawn on the part: see `sharpCorners` on `<PartMesh>`. */
|
|
95
95
|
sharpCorners?: ViewerToolbarControl;
|
|
96
|
+
/** Threads drawn in their holes: see `threads` on `<PartMesh>`. */
|
|
97
|
+
threads?: ViewerToolbarControl;
|
|
96
98
|
hover?: ViewerToolbarControl;
|
|
97
99
|
focus?: ViewerToolbarControl;
|
|
98
100
|
wireframe?: ViewerToolbarControl;
|
|
@@ -136,6 +138,7 @@ declare const ViewerToolbar: (({ className, children }: ViewerToolbarProps) => r
|
|
|
136
138
|
DirectionsButton: () => react.JSX.Element;
|
|
137
139
|
DfmButton: () => react.JSX.Element;
|
|
138
140
|
SharpCornersButton: () => react.JSX.Element;
|
|
141
|
+
ThreadsButton: () => react.JSX.Element;
|
|
139
142
|
HoverButton: () => react.JSX.Element;
|
|
140
143
|
FocusButton: () => react.JSX.Element;
|
|
141
144
|
WireframeButton: () => react.JSX.Element;
|
|
@@ -1501,6 +1504,13 @@ interface ViewerProps {
|
|
|
1501
1504
|
* section handle. The usual meaning is "put the selection down".
|
|
1502
1505
|
*/
|
|
1503
1506
|
onPointerMissed?: () => void;
|
|
1507
|
+
/**
|
|
1508
|
+
* What to show in place of the canvas when the browser will not create a
|
|
1509
|
+
* WebGL context — hardware acceleration off, or the GPU blocklisted. It goes
|
|
1510
|
+
* inside a `role="alert"` element (`viewer-webgl-unavailable`), and replaces
|
|
1511
|
+
* the default message asking the user to turn acceleration on.
|
|
1512
|
+
*/
|
|
1513
|
+
webglUnavailable?: ReactNode;
|
|
1504
1514
|
}
|
|
1505
1515
|
declare const Viewer: react.ForwardRefExoticComponent<ViewerProps & react.RefAttributes<ViewerHandle>>;
|
|
1506
1516
|
|
package/dist/index.js
CHANGED
|
@@ -163,7 +163,7 @@ import {
|
|
|
163
163
|
viewUp,
|
|
164
164
|
viewVector,
|
|
165
165
|
visualSurfaces
|
|
166
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-LBG6GVGE.js";
|
|
167
167
|
|
|
168
168
|
// src/render/feature-triangles.ts
|
|
169
169
|
var EMPTY = { positions: new Float32Array(), normals: new Float32Array() };
|
|
@@ -274,6 +274,7 @@ var SharpCornersIcon = () => /* @__PURE__ */ jsxs(SvgIcon, { children: [
|
|
|
274
274
|
/* @__PURE__ */ jsx2("path", { d: "M4 3v17h17" }),
|
|
275
275
|
/* @__PURE__ */ jsx2("circle", { cx: "9", cy: "15", r: "4" })
|
|
276
276
|
] });
|
|
277
|
+
var ThreadsIcon = () => /* @__PURE__ */ jsx2(SvgIcon, { children: /* @__PURE__ */ jsx2("path", { d: "M8 3h8v18H8zM8 8l8-2M8 12l8-2M8 16l8-2M8 20l8-2" }) });
|
|
277
278
|
var HoverIcon = () => /* @__PURE__ */ jsx2(SvgIcon, { children: /* @__PURE__ */ jsx2("path", { d: "M4 4h16v12H9l-5 4zm4 5h8m-8 3h5" }) });
|
|
278
279
|
var FocusIcon = () => /* @__PURE__ */ jsx2(SvgIcon, { children: /* @__PURE__ */ jsx2("path", { d: "M4 4h16v16H4zM8 8h8v8H8zM2 12h4m12 0h4M12 2v4m0 12v4" }) });
|
|
279
280
|
var WireframeIcon = () => /* @__PURE__ */ jsx2(SvgIcon, { children: /* @__PURE__ */ jsx2("path", { d: "M4 7l8-4 8 4v10l-8 4-8-4zM4 7l8 4 8-4M12 11v10M4 17l8-4 8 4M12 3v10" }) });
|
|
@@ -291,6 +292,7 @@ var ICONS = {
|
|
|
291
292
|
directions: DirectionsIcon,
|
|
292
293
|
dfm: DfmIcon,
|
|
293
294
|
sharpCorners: SharpCornersIcon,
|
|
295
|
+
threads: ThreadsIcon,
|
|
294
296
|
hover: HoverIcon,
|
|
295
297
|
focus: FocusIcon,
|
|
296
298
|
wireframe: WireframeIcon,
|
|
@@ -401,6 +403,14 @@ var SharpCornersButton = () => /* @__PURE__ */ jsx3(
|
|
|
401
403
|
label: (pressed) => pressed ? "Hide sharp corners" : "Show sharp corners"
|
|
402
404
|
}
|
|
403
405
|
);
|
|
406
|
+
var ThreadsButton = () => /* @__PURE__ */ jsx3(
|
|
407
|
+
ToolbarButton,
|
|
408
|
+
{
|
|
409
|
+
action: "threads",
|
|
410
|
+
icon: "threads",
|
|
411
|
+
label: (pressed) => pressed ? "Hide threads" : "Show threads"
|
|
412
|
+
}
|
|
413
|
+
);
|
|
404
414
|
var HoverButton = () => /* @__PURE__ */ jsx3(
|
|
405
415
|
ToolbarButton,
|
|
406
416
|
{
|
|
@@ -461,6 +471,7 @@ var DefaultControls = () => {
|
|
|
461
471
|
controls.directions ? /* @__PURE__ */ jsx3(DirectionsButton, {}, "directions") : null,
|
|
462
472
|
controls.dfm ? /* @__PURE__ */ jsx3(DfmButton, {}, "dfm") : null,
|
|
463
473
|
controls.sharpCorners ? /* @__PURE__ */ jsx3(SharpCornersButton, {}, "sharpCorners") : null,
|
|
474
|
+
controls.threads ? /* @__PURE__ */ jsx3(ThreadsButton, {}, "threads") : null,
|
|
464
475
|
controls.hover ? /* @__PURE__ */ jsx3(HoverButton, {}, "hover") : null,
|
|
465
476
|
controls.focus ? /* @__PURE__ */ jsx3(FocusButton, {}, "focus") : null,
|
|
466
477
|
controls.wireframe ? /* @__PURE__ */ jsx3(WireframeButton, {}, "wireframe") : null,
|
|
@@ -502,6 +513,7 @@ var ViewerToolbar = Object.assign(ViewerToolbarRoot, {
|
|
|
502
513
|
DirectionsButton,
|
|
503
514
|
DfmButton,
|
|
504
515
|
SharpCornersButton,
|
|
516
|
+
ThreadsButton,
|
|
505
517
|
HoverButton,
|
|
506
518
|
FocusButton,
|
|
507
519
|
WireframeButton,
|
|
@@ -546,6 +546,39 @@ declare function findSharpCorners(creases: SurfaceCreases, model: Pick<PartModel
|
|
|
546
546
|
/** The flagged features' corners, as `x y z x y z` endpoint pairs. See {@link findSharpCorners}. */
|
|
547
547
|
declare function sharpCornerPositions(creases: SurfaceCreases, model: Pick<PartModel, 'features' | 'regionIndex'>, options: SharpCornerOptions): Float32Array;
|
|
548
548
|
|
|
549
|
+
/**
|
|
550
|
+
* Threads drawn into the bores they are cut in.
|
|
551
|
+
*
|
|
552
|
+
* The kernel cuts a modeled internal thread out of the body before it meshes
|
|
553
|
+
* it, so a tapped hole arrives as a plain bore. A displacement map cannot put
|
|
554
|
+
* the thread back: it moves vertices, and wants UVs and a dense mesh, where
|
|
555
|
+
* the Engine's has neither — a small bore is a handful of 30° facets. So the
|
|
556
|
+
* thread is drawn the way a bump map draws: the part's shader tilts each
|
|
557
|
+
* pixel's normal along the bore's axis as a helix of the thread's pitch runs
|
|
558
|
+
* past it, and the light falls as it would on the flanks of a real thread.
|
|
559
|
+
* The silhouette stays round, which inside a bore nobody sees.
|
|
560
|
+
*
|
|
561
|
+
* What the shader needs per region is the bore's axis, a point on it, and the
|
|
562
|
+
* pitch. The pitch comes from the caller; the axis and the point are fitted
|
|
563
|
+
* here from the region's own triangles, so the drawing sits on the mesh
|
|
564
|
+
* exactly and needs nothing from the report it does not already carry.
|
|
565
|
+
*/
|
|
566
|
+
/** One thread to draw, on the faces of the hole it is cut in. */
|
|
567
|
+
interface ThreadMark {
|
|
568
|
+
/** The regions of the threaded hole, as the report numbers them. */
|
|
569
|
+
readonly regions: readonly number[];
|
|
570
|
+
/** From one crest to the next, in mm. Negative for a left-hand thread. */
|
|
571
|
+
readonly pitch: number;
|
|
572
|
+
/**
|
|
573
|
+
* The thread's major diameter, in mm. A cylinder of the hole wider than
|
|
574
|
+
* this — a counterbore — is not threaded, and is left plain.
|
|
575
|
+
*/
|
|
576
|
+
readonly majorDiameter: number;
|
|
577
|
+
}
|
|
578
|
+
interface ThreadOptions {
|
|
579
|
+
readonly threads: readonly ThreadMark[];
|
|
580
|
+
}
|
|
581
|
+
|
|
549
582
|
/** The vertex attribute carrying each vertex's column in the state texture. */
|
|
550
583
|
declare const REGION_ATTRIBUTE = "aRegion";
|
|
551
584
|
type PartDisplay = 'solid' | 'wireframe';
|
|
@@ -610,6 +643,11 @@ interface PartObject {
|
|
|
610
643
|
}, camera: ViewerCamera, viewport: ViewportSize): SharpCorner | null;
|
|
611
644
|
/** Draws one corner up as the one under the pointer; `null` for none. */
|
|
612
645
|
setHoveredSharpCorner(index: number | null): void;
|
|
646
|
+
/**
|
|
647
|
+
* Draws threads into the bores they are cut in — see `render/threads.ts`.
|
|
648
|
+
* `null` draws none. Keyed by content, like `setSharpCorners`.
|
|
649
|
+
*/
|
|
650
|
+
setThreads(options: ThreadOptions | null): void;
|
|
613
651
|
dispose(): void;
|
|
614
652
|
}
|
|
615
653
|
interface RegionPaint {
|
|
@@ -1180,6 +1218,13 @@ interface PartMeshProps {
|
|
|
1180
1218
|
* Coloured by the theme's `sharpCorner`.
|
|
1181
1219
|
*/
|
|
1182
1220
|
sharpCorners?: SharpCornerOptions | null;
|
|
1221
|
+
/**
|
|
1222
|
+
* Draws threads into the bores they are cut in: each mark's pitch, as a
|
|
1223
|
+
* helix of light and shade over the hole's cylinders. The Engine cuts a
|
|
1224
|
+
* modeled internal thread out of the mesh, so without this a tapped hole is
|
|
1225
|
+
* a plain bore. Off when omitted or `null`. See `threadMark` in `/engine`.
|
|
1226
|
+
*/
|
|
1227
|
+
threads?: ThreadOptions | null;
|
|
1183
1228
|
/** Wireframe shows region boundaries and any hovered/painted faces, with no triangle diagonals. */
|
|
1184
1229
|
display?: PartDisplay;
|
|
1185
1230
|
/**
|
|
@@ -1198,7 +1243,7 @@ interface PartMeshProps {
|
|
|
1198
1243
|
* React render at all: the hovered face lives in a ref, and routing it through
|
|
1199
1244
|
* state is what this rewrite exists to stop doing.
|
|
1200
1245
|
*/
|
|
1201
|
-
declare const PartMesh: ({ model, geometry, selection, focus, candidates, highlights, regionHighlights, pickedRegions, hoveredFeatureIds, hover, activeDirection, section, onSectionChange, onAdjacency, focusFeature, onHover, onPick, theme, showEdges, sharpCorners, display, children, }: PartMeshProps) => react.JSX.Element;
|
|
1246
|
+
declare const PartMesh: ({ model, geometry, selection, focus, candidates, highlights, regionHighlights, pickedRegions, hoveredFeatureIds, hover, activeDirection, section, onSectionChange, onAdjacency, focusFeature, onHover, onPick, theme, showEdges, sharpCorners, threads, display, children, }: PartMeshProps) => react.JSX.Element;
|
|
1202
1247
|
|
|
1203
1248
|
interface EnginePartProps extends Omit<PartMeshProps, 'model' | 'geometry'> {
|
|
1204
1249
|
/**
|
|
@@ -1273,4 +1318,4 @@ declare function normalizePartReport(report: unknown): PartModel;
|
|
|
1273
1318
|
*/
|
|
1274
1319
|
declare function assertSupportedKernelVersion(kernelVersion: string): void;
|
|
1275
1320
|
|
|
1276
|
-
export {
|
|
1321
|
+
export { PICKED_SURFACE_LABEL as $, AXES_PLANE_OFFSET as A, type BuildPickInput as B, type CameraLimits as C, DEFAULT_FIT_MARGIN as D, EnginePart as E, type FeatureTag as F, EXCLUDE_FROM_FRAME as G, type FeatureHighlight as H, type FocusOptions as I, HANDLE_PIXELS as J, HIGHLIGHT_COLORS as K, HIGHLIGHT_WEIGHT as L, MIN_KERNEL_VERSION as M, HOVER_WEIGHT as N, type HighlightLayers as O, type PartModel as P, type KnownFeatureType as Q, type RegionHighlight as R, type SectionOptions as S, type ThreadMark as T, type KnownShapeKind as U, type Vec3 as V, MAX_FRAME_RATIO as W, MIN_FRAME_RATIO as X, NO_MODIFIERS as Y, OUTLINE_SCALE as Z, PERSPECTIVE_FOV as _, type PartMeshRefs as a, targetBoundary as a$, PREVIEW_SCALE as a0, type PartDisplay as a1, PartMesh as a2, type PartMeshProps as a3, type PartObject as a4, type PickModifiers as a5, type PointerLocation as a6, REGION_ATTRIBUTE as a7, type RegionPaint as a8, SECTION_GIZMO_FRAME_SCALE as a9, directionColor as aA, dragPlane as aB, excludedFromFrame as aC, findSharpCorners as aD, fitDistance as aE, focusForPick as aF, hitUnderRay as aG, orthographicHalfHeight as aH, perspectiveFitDistance as aI, pickedStartDepth as aJ, resolveTheme as aK, screenLength as aL, sectionAnchor as aM, sectionBounds as aN, sectionConstant as aO, sectionDepth as aP, sectionDepthConstant as aQ, sectionDepthRange as aR, sectionFromPick as aS, sectionMeasurement as aT, sectionOffset as aU, sectionOptionsFromState as aV, sectionPlane as aW, sharpCornerPositions as aX, startPosition as aY, surfaceCreases as aZ, surfaceUnderRay as a_, SECTION_RENDER_ORDER as aa, type SceneBounds as ab, type SectionAnchor as ac, type SectionBounds as ad, type SectionPlacement as ae, type ShapeKind as af, type SharpCorner as ag, type SharpCornerOptions as ah, type SurfaceCreases as ai, type SurfaceHit as aj, type ThreadOptions as ak, adaptedUp as al, applyHighlightLayers as am, applyProjection as an, aspectRatio as ao, axesPlanes as ap, boundsFromBox as aq, buildPick as ar, buildRegionAttribute as as, buildRegionTexels as at, cadViewDirections as au, cameraLimits as av, contentBounds as aw, createPart as ax, currentViewDirection as ay, defaultBounds as az, type PartModelFeature as b, themesEqual as b0, viewDirection as b1, type EnginePartProps as c, assertSupportedKernelVersion as d, type PartPick as e, type ViewerTheme as f, type SectionState as g, type ViewerCamera as h, type ViewportSize as i, type PartModelRegion as j, type ViewerView as k, type Projection as l, type TriangleRange as m, normalizePartReport as n, type RegionIndex as o, type FeatureType as p, AXES_PLANE_SCALE as q, type AxesPlane as r, smoothRegionNormals as s, CAD_CAMERA_UP as t, CANDIDATE_WEIGHT as u, CAP_HATCH as v, DEFAULT_SECTION_NORMAL as w, DEFAULT_THEME as x, DIRECTION_COLORS as y, DISABLED_SECTION as z };
|