@toolpath/viewer 2.3.3 → 2.6.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.
@@ -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 { PREVIEW_SCALE 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, type FeatureHighlight as G, type FocusOptions as H, HANDLE_PIXELS as I, HIGHLIGHT_COLORS as J, HIGHLIGHT_WEIGHT as K, HOVER_WEIGHT as L, MIN_KERNEL_VERSION as M, type HighlightLayers as N, type KnownFeatureType as O, type PartModel as P, type KnownShapeKind as Q, type RegionHighlight as R, type SectionOptions as S, type TriangleRange as T, MAX_FRAME_RATIO as U, type Vec3 as V, MIN_FRAME_RATIO as W, NO_MODIFIERS as X, OUTLINE_SCALE as Y, PERSPECTIVE_FOV as Z, PICKED_SURFACE_LABEL as _, type PartMeshRefs as a, viewDirection as a$, type PartDisplay as a0, PartMesh as a1, type PartMeshProps as a2, type PartObject as a3, type PickModifiers as a4, type PointerLocation as a5, REGION_ATTRIBUTE as a6, type RegionPaint as a7, SECTION_GIZMO_FRAME_SCALE as a8, SECTION_RENDER_ORDER as a9, excludedFromFrame as aA, findSharpCorners as aB, fitDistance as aC, focusForPick as aD, hitUnderRay as aE, orthographicHalfHeight as aF, perspectiveFitDistance as aG, pickedStartDepth as aH, resolveTheme as aI, screenLength as aJ, sectionAnchor as aK, sectionBounds as aL, sectionConstant as aM, sectionDepth as aN, sectionDepthConstant as aO, sectionDepthRange as aP, sectionFromPick as aQ, sectionMeasurement as aR, sectionOffset as aS, sectionOptionsFromState as aT, sectionPlane as aU, sharpCornerPositions as aV, startPosition as aW, surfaceCreases as aX, surfaceUnderRay as aY, targetBoundary as aZ, themesEqual as a_, type SceneBounds as aa, type SectionAnchor as ab, type SectionBounds as ac, type SectionPlacement as ad, type ShapeKind as ae, type SharpCorner as af, type SharpCornerOptions as ag, type SurfaceCreases as ah, type SurfaceHit as ai, adaptedUp as aj, applyHighlightLayers as ak, applyProjection as al, aspectRatio as am, axesPlanes as an, boundsFromBox as ao, buildPick as ap, buildRegionAttribute as aq, buildRegionTexels as ar, cadViewDirections as as, cameraLimits as at, contentBounds as au, createPart as av, currentViewDirection as aw, defaultBounds as ax, directionColor as ay, dragPlane as az, type EnginePartProps as b, assertSupportedKernelVersion as c, type PartPick as d, type ViewerTheme as e, type SectionState as f, type ViewerCamera as g, type ViewportSize as h, type PartModelRegion as i, type ViewerView as j, type Projection as k, type RegionIndex as l, type PartModelFeature as m, normalizePartReport as n, type FeatureType as o, AXES_PLANE_SCALE as p, type AxesPlane as q, CAD_CAMERA_UP as r, smoothRegionNormals as s, CANDIDATE_WEIGHT as t, CAP_HATCH as u, DEFAULT_SECTION_NORMAL as v, DEFAULT_THEME as w, DIRECTION_COLORS as x, DISABLED_SECTION as y, EXCLUDE_FROM_FRAME as z };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolpath/viewer",
3
- "version": "2.3.3",
3
+ "version": "2.6.0",
4
4
  "description": "React Three Fiber viewer for Toolpath Engine part reports",
5
5
  "license": "MIT",
6
6
  "engines": {