@faicad/cq-compat 0.13.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.
Files changed (41) hide show
  1. package/dist/assembly-compare.d.ts +135 -0
  2. package/dist/assembly-compare.d.ts.map +1 -0
  3. package/dist/assembly-compare.js +266 -0
  4. package/dist/assembly-compare.js.map +1 -0
  5. package/dist/assembly.d.ts +102 -0
  6. package/dist/assembly.d.ts.map +1 -0
  7. package/dist/assembly.js +403 -0
  8. package/dist/assembly.js.map +1 -0
  9. package/dist/browser.d.ts +13 -0
  10. package/dist/browser.d.ts.map +1 -0
  11. package/dist/browser.js +13 -0
  12. package/dist/browser.js.map +1 -0
  13. package/dist/gear-test-harness.d.ts +79 -0
  14. package/dist/gear-test-harness.d.ts.map +1 -0
  15. package/dist/gear-test-harness.js +112 -0
  16. package/dist/gear-test-harness.js.map +1 -0
  17. package/dist/gears.d.ts +226 -0
  18. package/dist/gears.d.ts.map +1 -0
  19. package/dist/gears.js +274 -0
  20. package/dist/gears.js.map +1 -0
  21. package/dist/geom-types.d.ts +7 -0
  22. package/dist/geom-types.d.ts.map +1 -0
  23. package/dist/geom-types.js +2 -0
  24. package/dist/geom-types.js.map +1 -0
  25. package/dist/index.d.ts +26 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +23 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/step-compare.d.ts +83 -0
  30. package/dist/step-compare.d.ts.map +1 -0
  31. package/dist/step-compare.js +140 -0
  32. package/dist/step-compare.js.map +1 -0
  33. package/dist/transpile.d.ts +42 -0
  34. package/dist/transpile.d.ts.map +1 -0
  35. package/dist/transpile.js +557 -0
  36. package/dist/transpile.js.map +1 -0
  37. package/dist/workplane.d.ts +1216 -0
  38. package/dist/workplane.d.ts.map +1 -0
  39. package/dist/workplane.js +4026 -0
  40. package/dist/workplane.js.map +1 -0
  41. package/package.json +48 -0
@@ -0,0 +1,1216 @@
1
+ /**
2
+ * @faicad/cq-compat — CadQuery API compatibility layer for faijs.
3
+ *
4
+ * Implements a Workplane carrier (geometry hidden in .shape) and
5
+ * CadQuery-style methods. All methods are async and return a new Workplane
6
+ * (immutable updates). The carrier uses a custom prototype so compatOp's
7
+ * `borrowDeep` does not traverse its fields when the library is auto-lifted.
8
+ *
9
+ * Design doc: docs/plans/2026-09-06-cadquery-compat-and-multifile-faijs.md
10
+ */
11
+ import type { Shape } from '@faicad/faijs/mesh/types';
12
+ /**
13
+ * 把可能是借用视图的几何输入归一为真实 faijs Shape(见上方注释)。
14
+ * @param v 真实 Shape、借用视图(`{ wrapped }`)或其他原样透传的输入。
15
+ * @returns 真实 faijs `Shape`(借用视图经 `fromHandle` 还原并缓存)。
16
+ */
17
+ export declare function asBrepShape(v: unknown): Shape;
18
+ /** RGB color (sRGB 0..1). */
19
+ export type RGB = [number, number, number];
20
+ /**
21
+ * A pending 2D profile wire (CadQuery `ctx.pendingWires` analogue).
22
+ *
23
+ * Upstream keeps a LIST of wires, and `extrude()` turns them into one face per
24
+ * outermost wire with the enclosed wires punched as holes — verified against
25
+ * cadquery 2.8.0 (two columns per pushPoint, and a plate with four holes):
26
+ *
27
+ * `circle(4).circle(2).extrude(4)` -> annulus, vol 150.796
28
+ * `pushPoints([p1,p2]).circle(4).circle(2)` -> TWO annuli (2 solids)
29
+ * `rect(2,2).rect(1.3,1.3,fc).vertices()`
30
+ * `.circle(0.125).extrude(0.5)` -> ONE plate, vol 1.901825
31
+ *
32
+ * `cx`/`cy` are workplane-LOCAL coordinates (a wire created under `pushPoints`
33
+ * or after `vertices()` is already positioned at its point). `group` is the
34
+ * index of the point it was created at, kept only for diagnostics.
35
+ */
36
+ /** Snapshot of the plane a pending wire was created on (world coordinates). */
37
+ export interface WirePlane {
38
+ origin: [number, number, number];
39
+ xDir: [number, number, number];
40
+ yDir: [number, number, number];
41
+ normal: [number, number, number];
42
+ }
43
+ /**
44
+ * A 2D profile wire queued on a Workplane until a solid op (extrude / revolve /
45
+ * loft / …) consumes it. Every variant records its local 2D placement plus a
46
+ * snapshot of the creation plane, so a later `workplane(offset)` or transformed
47
+ * move does not retro-actively relocate wires that are already queued.
48
+ */
49
+ export type PendingWire = {
50
+ kind: 'rect';
51
+ w: number;
52
+ d: number;
53
+ cx: number;
54
+ cy: number;
55
+ construction: boolean;
56
+ plane?: WirePlane;
57
+ } | {
58
+ kind: 'circle';
59
+ radius: number;
60
+ cx: number;
61
+ cy: number;
62
+ construction: boolean;
63
+ plane?: WirePlane;
64
+ } | {
65
+ kind: 'ellipse';
66
+ majorRadius: number;
67
+ minorRadius: number;
68
+ cx: number;
69
+ cy: number;
70
+ construction: boolean;
71
+ plane?: WirePlane;
72
+ /** True when the caller's y_radius exceeds x_radius (see {@link ellipse}). */
73
+ flip?: boolean;
74
+ } | {
75
+ kind: 'polygon';
76
+ n: number;
77
+ d: number;
78
+ cx: number;
79
+ cy: number;
80
+ construction: boolean;
81
+ plane?: WirePlane;
82
+ }
83
+ /** Open/closed ring produced by moveTo/lineTo/arcs/polyline + close()/wire(). */
84
+ | {
85
+ kind: 'path';
86
+ pts: [number, number][];
87
+ edges?: PendingEdge[];
88
+ construction: boolean;
89
+ plane?: WirePlane;
90
+ };
91
+ /**
92
+ * One drafted 2D edge, in workplane-LOCAL coordinates — the CadQuery
93
+ * `ctx.pendingEdges` analogue. All descriptors keep `from`/`to` so generic
94
+ * consumers (vertex ring, close()) can treat every kind uniformly.
95
+ */
96
+ export type PendingEdge = {
97
+ kind: 'line';
98
+ from: [number, number];
99
+ to: [number, number];
100
+ } | {
101
+ kind: 'arc3';
102
+ from: [number, number];
103
+ mid: [number, number];
104
+ to: [number, number];
105
+ } | {
106
+ kind: 'tangentArc';
107
+ from: [number, number];
108
+ tgt: [number, number];
109
+ to: [number, number];
110
+ } | {
111
+ kind: 'spline';
112
+ from: [number, number];
113
+ pts: [number, number][];
114
+ to: [number, number];
115
+ endTgt?: [number, number];
116
+ builtEdge?: unknown;
117
+ };
118
+ /**
119
+ * Workplane carrier — object with a custom prototype so compatOp's
120
+ * `borrowDeep` does NOT traverse its fields (it only walks objects whose
121
+ * prototype === Object.prototype). This prevents .shape from being replaced
122
+ * by a borrowed brepjs view when the library is auto-lifted.
123
+ */
124
+ export interface Workplane {
125
+ __cq: true;
126
+ /** Plane name: "XY" | "XZ" | "YZ". */
127
+ plane: string;
128
+ /** Workplane origin in world coordinates. */
129
+ origin: [number, number, number];
130
+ /** Workplane normal (unit vector, local +Z). */
131
+ normal: [number, number, number];
132
+ /** Workplane local +X in world coordinates (CadQuery Plane.xDir convention). */
133
+ xDir: [number, number, number];
134
+ /** Workplane local +Y in world coordinates (= normal × xDir). */
135
+ yDir: [number, number, number];
136
+ /** Current geometry (faijs Shape), or null for empty workplane. */
137
+ shape: Shape | null;
138
+ /** Pending face selector (e.g. ">Z", "<X"). Set by .faces(). */
139
+ faceSel: string | null;
140
+ /** Pending edge selector (e.g. "|Z", ""). Set by .edges(). */
141
+ edgeSel: string | null;
142
+ /** Pending vertex selector. Set by .vertices(). */
143
+ vertexSel: string | null;
144
+ /** Accumulated pushPoints (2D offsets in workplane coords). */
145
+ pts: [number, number][];
146
+ /** Edge midpoints for construction rect (set by .edges()). */
147
+ edgePts?: [number, number][];
148
+ /** forConstruction flag — next rect/circle is construction geometry. */
149
+ forConstruction: boolean;
150
+ /** Pending 2D rect profile (set by .rect(), consumed by .extrude()/.cutBlind()). */
151
+ pendingRect?: {
152
+ w: number;
153
+ d: number;
154
+ };
155
+ /** Pending 2D circle profile (set by .circle(), consumed by .extrude()/.cutBlind()). */
156
+ pendingCircle?: {
157
+ radius: number;
158
+ };
159
+ /** Pending regular polygon profile (set by .polygon(), consumed by .extrude()/.cutBlind()). */
160
+ pendingPolygon?: {
161
+ n: number;
162
+ d: number;
163
+ };
164
+ /**
165
+ * Pending 2D profile wires — the CadQuery `pendingWires` LIST.
166
+ * `rect`/`circle`/`polygon` APPEND; `extrude` consumes. The single-slot
167
+ * fields above are kept for the (single-wire) legacy path.
168
+ */
169
+ pendingWires?: PendingWire[];
170
+ /**
171
+ * Drafted 2D edges waiting to be combined into a wire — CadQuery
172
+ * `ctx.pendingEdges`. Consumed by `wire()` / `close()`.
173
+ */
174
+ pendingEdges?: PendingEdge[];
175
+ /**
176
+ * Current drawing point in local coords — end of the last drafted edge, or
177
+ * the plane origin when nothing has been drawn yet (upstream
178
+ * `_findFromPoint`: last stack object, else `plane.origin`).
179
+ */
180
+ currentPoint?: [number, number];
181
+ /**
182
+ * First point of the wire currently being drafted, local coords — CadQuery
183
+ * `ctx.firstPoint`. Set by the first non-construction edge, cleared by
184
+ * `close()`.
185
+ */
186
+ firstPoint?: [number, number];
187
+ /** Optional color (sRGB 0..1) for this part. */
188
+ color?: RGB;
189
+ }
190
+ /**
191
+ * Resolve a CadQuery-style face selector string to the selected face's center
192
+ * point and outward normal.
193
+ *
194
+ * Supported forms: ">Z", "<Z", ">X", "<X", ">Y", "<Y", each with an optional
195
+ * CadQuery-style index suffix like ">Z[-2]", plus the six named views
196
+ * ("front"/"back"/"left"/"right"/"top"/"bottom") which are aliases for the
197
+ * corresponding axis selectors per cadquery/selectors.py:687-694.
198
+ * @param shape - Shape whose BREP faces are enumerated for selection.
199
+ * @param sel - Selector string, e.g. ">Z", "front", ">Z[-2]".
200
+ * @param centerOption - Optional center computation option forwarded to the
201
+ * face-center evaluation.
202
+ * @returns Promise resolving to the selected face's center point and outward
203
+ * normal.
204
+ * @throws Error when the selector matches no face or has unknown syntax
205
+ * (never falls back silently).
206
+ */
207
+ export declare function resolveFaceSelector(shape: Shape, sel: string, centerOption?: string): Promise<{
208
+ center: [number, number, number];
209
+ normal: [number, number, number];
210
+ }>;
211
+ /** CadQuery `centered` parameter: bool or per-axis triple. */
212
+ type Centered3 = boolean | [boolean, boolean, boolean];
213
+ /**
214
+ * Workplane
215
+ * @param plane - string
216
+ * @returns Workplane
217
+ */
218
+ export declare function Workplane(plane?: string): Workplane;
219
+ /**
220
+ * add
221
+ * @param wp - Workplane
222
+ * @param shape - Shape
223
+ * @returns Promise<Workplane>
224
+ */
225
+ export declare function add(wp: Workplane, shape: Shape): Promise<Workplane>;
226
+ /**
227
+ * box
228
+ * @param wp - Workplane
229
+ * @param w - number
230
+ * @param d - number
231
+ * @param h - number
232
+ * @param opts - { centered?; combine? }
233
+ * @returns Promise<Workplane>
234
+ *
235
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.box`): with the
236
+ * default `centered=(True, True, True)` the box is centered on the workplane
237
+ * origin in ALL three axes — including the normal direction. The old
238
+ * "sit on the face" behaviour belonged to the makeBoxAt tool-body helper and
239
+ * leaked into this public op (found by the parity harness, testBoxDefaults).
240
+ *
241
+ * Each-point semantics (verified vs 2.8.0): box() is eachpoint-based — with
242
+ * points pushed on the stack a box is created at every point; `combine=True`
243
+ * (default) fuses them with the existing solid, `combine=False` leaves them
244
+ * as separate solids in a compound (test_getitem / testBoxPointList).
245
+ */
246
+ export declare function box(wp: Workplane, w: number, d: number, h: number, opts?: {
247
+ centered?: Centered3;
248
+ combine?: boolean;
249
+ }): Promise<Workplane>;
250
+ /**
251
+ * sphere
252
+ * @param wp - Workplane
253
+ * @param radius - number
254
+ * @param opts - { centered?; combine? }
255
+ * @returns Promise<Workplane>
256
+ *
257
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.sphere`): a sphere
258
+ * is created for every point on the stack (or the workplane origin); per-axis
259
+ * `centered=false` puts the sphere's bbox corner on the point. Only full
260
+ * spheres are supported (angle1/angle2/angle3 partial sweeps are not
261
+ * expressible with the cad.sphere primitive — upstream testSphereCustom stays
262
+ * blocked on that).
263
+ */
264
+ export declare function sphere(wp: Workplane, radius: number, opts?: {
265
+ centered?: Centered3;
266
+ combine?: boolean;
267
+ }): Promise<Workplane>;
268
+ /**
269
+ * wedge — CadQuery `Workplane.wedge` parity.
270
+ *
271
+ * OCCT `BRepPrimAPI_MakeWedge(dx, dy, dz, xmin, zmin, xmax, zmax)` geometry:
272
+ * the bottom face (local y=0) spans the full [0,dx]×[0,dz] rectangle and the
273
+ * top face (local y=dy) spans [xmin,xmax]×[zmin,zmax]; all six faces are
274
+ * planar. Built here as a RULED loft between the two rectangles — geometrically
275
+ * identical to the OCCT primitive (verified vs cadquery 2.8.0: testClean
276
+ * wedge-with-sphere union vol 9.079922 / testNoClean 10.650718).
277
+ *
278
+ * `centered=True` (default) shifts by (−dx/2, −dy/2, −dz/2) along the LOCAL
279
+ * workplane axes, mirroring upstream's `offset` computation. Limitation: the
280
+ * kernel has no makeWedge primitive, and upstream composes the wedge in WORLD
281
+ * axes before the eachpoint location transform — for the default XY plane the
282
+ * two agree; rotated planes are not exercised by any current mirror.
283
+ *
284
+ * @param wp - Workplane acting as the eachpoint carrier
285
+ * @param dx - Bottom-face extent along local X
286
+ * @param dy - Wedge height along local Y
287
+ * @param dz - Bottom-face extent along local Z
288
+ * @param xmin - Top-face minimum along local X
289
+ * @param zmin - Top-face minimum along local Z
290
+ * @param xmax - Top-face maximum along local X
291
+ * @param zmax - Top-face maximum along local Z
292
+ * @param opts - { centered?: Centered3; combine?: boolean; clean?: boolean }
293
+ * @returns Promise<Workplane> carrying the wedge solid
294
+ */
295
+ export declare function wedge(wp: Workplane, dx: number, dy: number, dz: number, xmin: number, zmin: number, xmax: number, zmax: number, opts?: {
296
+ centered?: Centered3;
297
+ combine?: boolean;
298
+ clean?: boolean;
299
+ }): Promise<Workplane>;
300
+ /**
301
+ * cylinder
302
+ * @param wp - Workplane
303
+ * @param height - number
304
+ * @param radius - number
305
+ * @param opts - { direct?; centered?; combine? }
306
+ * @returns Promise<Workplane>
307
+ *
308
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.cylinder`): a
309
+ * cylinder for every point on the stack; per-axis `centered` offsets are
310
+ * applied in the LOCAL frame (xDir/yDir/normal), then rotated by the
311
+ * `direct` plane orientation (ax3Rotation table), then mapped by the
312
+ * workplane basis. `angle != 360` pie-slice sweeps are not supported.
313
+ */
314
+ export declare function cylinder(wp: Workplane, height: number, radius: number, opts?: {
315
+ direct?: [number, number, number];
316
+ angle?: number;
317
+ centered?: Centered3;
318
+ combine?: boolean;
319
+ }): Promise<Workplane>;
320
+ /**
321
+ * torus — CadQuery free-function analogue (occ_impl.shapes.torus).
322
+ *
323
+ * Upstream takes DIAMETERS and builds a full torus centred at the origin,
324
+ * axis +Z: `torus(d1, d2)` -> R = d1/2, r = d2/2, V = 2π²·R·r²
325
+ * (`torus(10, 2)` -> 98.696, ref-verified against cadquery 2.8.0).
326
+ *
327
+ * @param wp - Workplane carrier (fresh `Workplane()` for the free function).
328
+ * @param d1 - Major DIAMETER.
329
+ * @param d2 - Minor DIAMETER.
330
+ * @param opts - { combine?: boolean }
331
+ * @returns Promise<Workplane> carrying the torus solid.
332
+ */
333
+ export declare function torus(wp: Workplane, d1: number, d2: number, opts?: {
334
+ combine?: boolean;
335
+ }): Promise<Workplane>;
336
+ /**
337
+ * cone — CadQuery free-function analogue (occ_impl.shapes.cone).
338
+ *
339
+ * Upstream takes DIAMETERS with the base centred on the origin at z=0, axis
340
+ * +Z: `cone(d1, d2, h)` -> R = d1/2, r = d2/2, V = π/3·h·(R²+Rr+r²)
341
+ * (`cone(2, 1, 1)` -> 1.8326, ref-verified against cadquery 2.8.0). The
342
+ * 2-arg upstream form `cone(d, h)` is the full cone — pass `d2 = 0`.
343
+ *
344
+ * @param wp - Workplane carrier (fresh `Workplane()` for the free function).
345
+ * @param d1 - Base DIAMETER.
346
+ * @param d2 - Top DIAMETER (0 for a full cone).
347
+ * @param h - Height along +Z.
348
+ * @param opts - { combine?: boolean }
349
+ * @returns Promise<Workplane> carrying the cone solid.
350
+ */
351
+ export declare function cone(wp: Workplane, d1: number, d2: number, h: number, opts?: {
352
+ combine?: boolean;
353
+ }): Promise<Workplane>;
354
+ /**
355
+ * rarray
356
+ * @param wp - Workplane
357
+ * @param xSpacing - number
358
+ * @param ySpacing - number
359
+ * @param xCount - number
360
+ * @param yCount - number
361
+ * @param center - boolean | [boolean, boolean]
362
+ * @returns Workplane
363
+ *
364
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.rarray`): pushes
365
+ * an xCount×yCount grid of points; per-axis `center=true` centers the grid on
366
+ * the workplane origin, `false` puts the lower corner on it.
367
+ */
368
+ export declare function rarray(wp: Workplane, xSpacing: number, ySpacing: number, xCount: number, yCount: number, center?: boolean | [boolean, boolean]): Workplane;
369
+ /**
370
+ * rect
371
+ * @param wp - Workplane
372
+ * @param w - number
373
+ * @param d - number
374
+ * @param opts - { forConstruction?: boolean }
375
+ * @returns Workplane
376
+ */
377
+ export declare function rect(wp: Workplane, w: number, d: number, opts?: {
378
+ forConstruction?: boolean;
379
+ centered?: boolean | [boolean, boolean];
380
+ }): Workplane;
381
+ /**
382
+ * circle
383
+ * @param wp - Workplane
384
+ * @param radius - number
385
+ * @returns Workplane
386
+ */
387
+ export declare function circle(wp: Workplane, radius: number): Workplane;
388
+ /**
389
+ * ellipse — CadQuery `Workplane.ellipse(x_radius, y_radius)` parity.
390
+ *
391
+ * `x_radius` lies on the workplane X axis and `y_radius` on Y — upstream puts
392
+ * no ordering constraint on them (`testEdgeTypesFilter` uses `ellipse(3, 4)`).
393
+ * The kernel's `makeEllipseEdge` requires major >= minor, ignores the plane's
394
+ * own axes and lays the major axis on the global X direction, so a "tall"
395
+ * ellipse is built as a wide one and then rotated 90° about the workplane
396
+ * normal through its centre (see `buildProfileWire`).
397
+ *
398
+ * @param wp - Workplane
399
+ * @param x_radius - radius along the workplane X axis
400
+ * @param y_radius - radius along the workplane Y axis
401
+ * @returns Workplane
402
+ */
403
+ export declare function ellipse(wp: Workplane, x_radius: number, y_radius: number): Workplane;
404
+ /**
405
+ * polygon
406
+ * @param wp - Workplane
407
+ * @param n - number
408
+ * @param d - number
409
+ * @returns Workplane
410
+ */
411
+ export declare function polygon(wp: Workplane, n: number, d: number): Workplane;
412
+ /**
413
+ * threePointArc — draft an arc from the current point through `point1`,
414
+ * ending at `point2` (CadQuery `Workplane.threePointArc`).
415
+ * @param wp - Workplane
416
+ * @param point1 - intermediate point the arc passes through (local 2D)
417
+ * @param point2 - end point of the arc (local 2D)
418
+ * @param forConstruction - edge is reference geometry only (default false)
419
+ * @returns Workplane
420
+ */
421
+ export declare function threePointArc(wp: Workplane, point1: [number, number], point2: [number, number], forConstruction?: boolean): Workplane;
422
+ /**
423
+ * sagittaArc — arc from the current point to `endPoint` with sagitta `sag`
424
+ * (CadQuery `Workplane.sagittaArc`). Positive sag bulges to the LEFT of the
425
+ * start→end direction (convex for a clockwise contour), negative to the right.
426
+ * Mirrors the upstream sag-vector rotation in cq.py sagittaArc.
427
+ * @param wp - Workplane
428
+ * @param endPoint - end point (local 2D)
429
+ * @param sag - sagitta (perpendicular distance from arc midpoint to the chord)
430
+ * @param forConstruction - edge is reference geometry only (default false)
431
+ * @returns Workplane
432
+ */
433
+ export declare function sagittaArc(wp: Workplane, endPoint: [number, number], sag: number, forConstruction?: boolean): Workplane;
434
+ /**
435
+ * radiusArc — arc from the current point to `endPoint` with radius `radius`
436
+ * (CadQuery `Workplane.radiusArc`). Positive radius = convex arc (for a
437
+ * clockwise contour), negative = concave. The sagitta is derived exactly as
438
+ * upstream: sag = |r| − sqrt(r² − (len/2)²).
439
+ * @param wp - Workplane
440
+ * @param endPoint - end point (local 2D)
441
+ * @param radius - arc radius (sign selects the bulge side)
442
+ * @param forConstruction - edge is reference geometry only (default false)
443
+ * @returns Workplane
444
+ */
445
+ export declare function radiusArc(wp: Workplane, endPoint: [number, number], radius: number, forConstruction?: boolean): Workplane;
446
+ /**
447
+ * tangentArcPoint — arc tangent to the end of the last drafted edge, ending at
448
+ * `endpoint` (CadQuery `Workplane.tangentArcPoint`).
449
+ * @param wp - Workplane
450
+ * @param endpoint - end point (local 2D; relative to the current point when
451
+ * `relative` is true)
452
+ * @param forConstruction - edge is reference geometry only (default false)
453
+ * @param relative - interpret `endpoint` relative to the current point (default true)
454
+ * @returns Workplane
455
+ */
456
+ export declare function tangentArcPoint(wp: Workplane, endpoint: [number, number], forConstruction?: boolean, relative?: boolean): Workplane;
457
+ /**
458
+ * spline — cubic B-spline edge interpolated exactly through `points`
459
+ * (CadQuery `Workplane.spline`, includeCurrent=false default: the edge starts
460
+ * at points[0], NOT at the current point — upstream `_toVectors` only prepends
461
+ * the current point when includeCurrent is set). The current point becomes the
462
+ * spline end. `includeCurrent` prepends the current point; the resulting edge
463
+ * stores its kernel-measured end tangent so a following tangentArcPoint can
464
+ * continue the curve.
465
+ * @param wp - Workplane
466
+ * @param points - interpolation points (local 2D; 3D z=0)
467
+ * @param opts - { forConstruction?; includeCurrent?; periodic?; makeWire? }
468
+ * @returns Workplane
469
+ */
470
+ export declare function spline(wp: Workplane, points: [number, number][], opts?: {
471
+ forConstruction?: boolean;
472
+ includeCurrent?: boolean;
473
+ periodic?: boolean;
474
+ makeWire?: boolean;
475
+ }): Workplane;
476
+ /**
477
+ * moveTo — move the current point without drawing (CadQuery `Workplane.moveTo`).
478
+ * @param wp - Workplane
479
+ * @param x - target x in local coords (default 0)
480
+ * @param y - target y in local coords (default 0)
481
+ * @returns Workplane
482
+ */
483
+ export declare function moveTo(wp: Workplane, x?: number, y?: number): Workplane;
484
+ /**
485
+ * move2D — relative version of `moveTo` (CadQuery `Workplane.move`).
486
+ *
487
+ * NOTE: upstream spells this `move`, but the Shape-level `move` (the in-place
488
+ * twin of `moved`, which takes `Location` arguments) already owns that name in
489
+ * cq-compat, so the 2D drafting variant is exported as `move2D`.
490
+ *
491
+ * @param wp - Workplane
492
+ * @param xDist - x offset from the current point (default 0)
493
+ * @param yDist - y offset from the current point (default 0)
494
+ * @returns Workplane
495
+ */
496
+ export declare function move2D(wp: Workplane, xDist?: number, yDist?: number): Workplane;
497
+ /**
498
+ * lineTo — draft a straight edge to an absolute local point
499
+ * (CadQuery `Workplane.lineTo`).
500
+ * @param wp - Workplane
501
+ * @param x - target x in local coords
502
+ * @param y - target y in local coords
503
+ * @param forConstruction - edge is reference geometry only (default false)
504
+ * @returns Workplane
505
+ */
506
+ export declare function lineTo(wp: Workplane, x: number, y: number, forConstruction?: boolean): Workplane;
507
+ /**
508
+ * line — draft a straight edge by a relative offset (CadQuery `Workplane.line`).
509
+ * @param wp - Workplane
510
+ * @param xDist - x offset from the current point
511
+ * @param yDist - y offset from the current point
512
+ * @param forConstruction - edge is reference geometry only (default false)
513
+ * @returns Workplane
514
+ */
515
+ export declare function line(wp: Workplane, xDist: number, yDist: number, forConstruction?: boolean): Workplane;
516
+ /**
517
+ * vLine — vertical (local +Y) relative line (CadQuery `Workplane.vLine`).
518
+ *
519
+ * @param wp - Workplane
520
+ * @param distance - signed length along local +Y
521
+ * @param forConstruction - edge is reference geometry only (default false)
522
+ * @returns Workplane
523
+ */
524
+ export declare function vLine(wp: Workplane, distance: number, forConstruction?: boolean): Workplane;
525
+ /**
526
+ * hLine — horizontal (local +X) relative line (CadQuery `Workplane.hLine`).
527
+ *
528
+ * @param wp - Workplane
529
+ * @param distance - signed length along local +X
530
+ * @param forConstruction - edge is reference geometry only (default false)
531
+ * @returns Workplane
532
+ */
533
+ export declare function hLine(wp: Workplane, distance: number, forConstruction?: boolean): Workplane;
534
+ /**
535
+ * vLineTo — vertical line to an absolute local y (CadQuery `Workplane.vLineTo`).
536
+ *
537
+ * @param wp - Workplane
538
+ * @param yCoord - absolute local y to end at
539
+ * @param forConstruction - edge is reference geometry only (default false)
540
+ * @returns Workplane
541
+ */
542
+ export declare function vLineTo(wp: Workplane, yCoord: number, forConstruction?: boolean): Workplane;
543
+ /**
544
+ * hLineTo — horizontal line to an absolute local x (CadQuery `Workplane.hLineTo`).
545
+ *
546
+ * @param wp - Workplane
547
+ * @param xCoord - absolute local x to end at
548
+ * @param forConstruction - edge is reference geometry only (default false)
549
+ * @returns Workplane
550
+ */
551
+ export declare function hLineTo(wp: Workplane, xCoord: number, forConstruction?: boolean): Workplane;
552
+ /**
553
+ * polyline — draft a chain of edges through the given local points
554
+ * (CadQuery `Workplane.polyline`).
555
+ *
556
+ * `includeCurrent=false` (upstream default) treats the FIRST point as an
557
+ * implicit moveTo and only draws from it onward.
558
+ *
559
+ * @param wp - Workplane
560
+ * @param pts - local 2D points
561
+ * @param forConstruction - edges are reference geometry only (default false)
562
+ * @param includeCurrent - start from the current point (default false)
563
+ * @returns Workplane
564
+ */
565
+ export declare function polyline(wp: Workplane, pts: [number, number][], forConstruction?: boolean, includeCurrent?: boolean): Workplane;
566
+ /**
567
+ * wire — combine all pending edges into one pending wire
568
+ * (CadQuery `Workplane.wire`). No-op when there are no free edges (upstream
569
+ * returns self unchanged in that case).
570
+ *
571
+ * @param wp - Workplane
572
+ * @param forConstruction - keep the wire out of the solid profile (default false)
573
+ * @returns Workplane
574
+ */
575
+ export declare function wire(wp: Workplane, forConstruction?: boolean): Workplane;
576
+ /**
577
+ * close — end drafting and build a closed wire (CadQuery `Workplane.close`).
578
+ * Appends the closing segment when the end point is more than 1e-6 away from
579
+ * the first point (upstream threshold), then delegates to `wire()`.
580
+ *
581
+ * @param wp - Workplane
582
+ * @returns Workplane
583
+ */
584
+ export declare function close(wp: Workplane): Workplane;
585
+ /**
586
+ * extrude — CadQuery `Workplane.extrude` parity.
587
+ *
588
+ * Pulls the pending profile wire(s) along the workplane normal by `height`;
589
+ * a negative height extrudes the other way. `taper` (degrees, default 0)
590
+ * narrows the section towards the top and is limited to a single
591
+ * non-construction pending wire.
592
+ *
593
+ * @param wp - Workplane
594
+ * @param height - extrusion distance along the workplane normal
595
+ * @param combine - fuse the result with the carried shape (default true)
596
+ * @param opts - { taper?: number } draft angle in degrees
597
+ * @returns Promise<Workplane>
598
+ */
599
+ export declare function extrude(wp: Workplane, height: number, combine?: boolean, opts?: {
600
+ taper?: number;
601
+ }): Promise<Workplane>;
602
+ /**
603
+ * revolve — CadQuery `Workplane.revolve` parity.
604
+ *
605
+ * Consumes the pending wire LIST (same grouping as extrude: one holed face per
606
+ * outermost wire) and revolves each face around an axis. Axis endpoints are
607
+ * LOCAL workplane coordinates (verified against cadquery 2.8.0
608
+ * `Workplane.revolve`): start defaults to the plane origin; when only start is
609
+ * given, end defaults to `(0, start.y)` if `start.y != 0` else `(0, 1)` — i.e.
610
+ * the local +Y direction. Angle 0 is normalized to 360 (OCCT cannot do a
611
+ * 0-degree revolve).
612
+ *
613
+ * @param wp - Workplane
614
+ * @param angleDegrees - revolution angle (default 360)
615
+ * @param axisStart - axis start point in local 2D coords
616
+ * @param axisEnd - axis end point in local 2D coords
617
+ * @param combine - true: fuse with base; "cut": subtract from base; false: keep separate
618
+ * @returns Promise<Workplane>
619
+ */
620
+ export declare function revolve(wp: Workplane, angleDegrees?: number, axisStart?: [number, number] | [number, number, number], axisEnd?: [number, number] | [number, number, number], combine?: boolean | 'cut'): Promise<Workplane>;
621
+ /** Options accepted by {@link loft}. */
622
+ export interface LoftOptions {
623
+ ruled?: boolean;
624
+ combine?: boolean | 'cut';
625
+ /** Degenerate start point (upstream `loft(vertex(...), ...)`) — world coordinates. */
626
+ startPoint?: [number, number, number];
627
+ /** Degenerate end point (upstream `loft(..., vertex(...))`) — world coordinates. */
628
+ endPoint?: [number, number, number];
629
+ }
630
+ /**
631
+ * loft — CadQuery `Workplane.loft` parity.
632
+ *
633
+ * Consumes the pending wire LIST as loft sections (each wire built on its own
634
+ * creation-plane snapshot, so intermediate workplane(offset)/transformed moves
635
+ * are honored). Upstream default is a smooth (ruled=False) loft.
636
+ *
637
+ * Additional workplanes may be passed positionally (upstream free-function form
638
+ * `loft(w1, w2, w3)`): each contributes its own pending wires, or — when it
639
+ * carries no pending wire — the outer wires of its stacked faces.
640
+ *
641
+ * @param wp - Workplane
642
+ * @param rest - extra section workplanes, plus at most one options object
643
+ * @returns Promise<Workplane>
644
+ */
645
+ export declare function loft(wp: Workplane, ...rest: (Workplane | LoftOptions)[]): Promise<Workplane>;
646
+ /**
647
+ * cutBlind
648
+ * @param wp - Workplane
649
+ * @param depth - number
650
+ * @param opts - { w?: number; d?: number; radius?: number }
651
+ * @returns Promise<Workplane>
652
+ */
653
+ export declare function cutBlind(wp: Workplane, depth: number, opts?: {
654
+ w?: number;
655
+ d?: number;
656
+ radius?: number;
657
+ taper?: number;
658
+ }): Promise<Workplane>;
659
+ /**
660
+ * cutThruAll
661
+ * @param wp - Workplane
662
+ * @returns Promise<Workplane>
663
+ *
664
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.cutThruAll`):
665
+ * uses the pending 2D profile to cut through ALL material in BOTH normal
666
+ * directions of the workplane. The tool body spans the whole solid along
667
+ * the workplane normal (computed from the shape bounding box), so it is
668
+ * exact for any profile depth.
669
+ */
670
+ export declare function cutThruAll(wp: Workplane): Promise<Workplane>;
671
+ /**
672
+ * hole
673
+ * @param wp - Workplane
674
+ * @param diameter - number
675
+ * @param depth - number
676
+ * @returns Promise<Workplane>
677
+ */
678
+ export declare function hole(wp: Workplane, diameter: number, depth?: number): Promise<Workplane>;
679
+ /**
680
+ * cboreHole
681
+ * @param wp - Workplane
682
+ * @param diameter - number
683
+ * @param cboreDiameter - number
684
+ * @param cboreDepth - number
685
+ * @param depth - number | undefined (bore depth; undefined drills through, upstream depth=None)
686
+ * @returns Promise<Workplane>
687
+ */
688
+ export declare function cboreHole(wp: Workplane, diameter: number, cboreDiameter: number, cboreDepth: number, depth?: number): Promise<Workplane>;
689
+ /**
690
+ * cskHole
691
+ * @param wp - Workplane
692
+ * @param diameter - number
693
+ * @param cskDiameter - number
694
+ * @param cskAngle - number
695
+ * @returns Promise<Workplane>
696
+ */
697
+ export declare function cskHole(wp: Workplane, diameter: number, cskDiameter: number, cskAngle: number): Promise<Workplane>;
698
+ /**
699
+ * threadedHole
700
+ * @param wp - Workplane
701
+ * @param diameterOrFastener - number | unknown
702
+ * @param depth - number
703
+ * @returns Promise<Workplane>
704
+ */
705
+ export declare function threadedHole(wp: Workplane, diameterOrFastener: number | unknown, depth?: number): Promise<Workplane>;
706
+ /**
707
+ * faces
708
+ * @param wp - Workplane
709
+ * @param sel - string
710
+ * @returns Workplane
711
+ */
712
+ export declare function faces(wp: Workplane, sel: string): Workplane;
713
+ /**
714
+ * edges
715
+ * @param wp - Workplane
716
+ * @param sel - string | { slice?: [number, number]; index?: number }
717
+ * @returns Workplane
718
+ */
719
+ export declare function edges(wp: Workplane, sel?: string | {
720
+ slice?: [number, number];
721
+ index?: number;
722
+ }): Workplane;
723
+ /**
724
+ * vertices
725
+ * @param wp - Workplane
726
+ * @param sel - string | { slice?: [number, number]; index?: number }
727
+ * @returns Workplane
728
+ */
729
+ export declare function vertices(wp: Workplane, sel?: string | {
730
+ slice?: [number, number];
731
+ index?: number;
732
+ }): Workplane;
733
+ /**
734
+ * solids — CadQuery `Workplane.solids(selector)` parity (selector forms not
735
+ * supported; bare `solids()` only).
736
+ *
737
+ * Upstream returns a new Workplane whose stack holds each solid of the current
738
+ * compound as a separate object, so `val()` is the FIRST solid (verified vs
739
+ * cadquery 2.8.0: test_map_apply_filter_sort w.val() = vol 1.0 solid). The
740
+ * cq-compat carrier keeps a single `.shape`, so `solids()` mirrors the
741
+ * observable contract: the carrier shape becomes the first solid of the
742
+ * compound (a single-solid shape passes through unchanged).
743
+ *
744
+ * @param wp - Workplane
745
+ * @returns Workplane whose carried shape is the compound's first solid
746
+ */
747
+ export declare function solids(wp: Workplane): Workplane;
748
+ /**
749
+ * workplane
750
+ * @param wp - Workplane
751
+ * @param opts - { centerOption?: string; offset?: number }
752
+ * @returns Promise<Workplane>
753
+ */
754
+ export declare function workplane(wp: Workplane, opts?: {
755
+ centerOption?: string;
756
+ offset?: number;
757
+ invert?: boolean;
758
+ }): Promise<Workplane>;
759
+ /**
760
+ * center
761
+ * @param wp - Workplane
762
+ * @param x - number
763
+ * @param y - number
764
+ * @returns Workplane
765
+ */
766
+ export declare function center(wp: Workplane, x: number, y: number): Workplane;
767
+ /**
768
+ * pushPoints
769
+ * @param wp - Workplane
770
+ * @param pts - [number, number][]
771
+ * @returns Workplane
772
+ */
773
+ export declare function pushPoints(wp: Workplane, pts: [number, number][]): Workplane;
774
+ /**
775
+ * translate
776
+ * @param wp - Workplane
777
+ * @param v - [number, number, number]
778
+ * @returns Promise<Workplane>
779
+ */
780
+ export declare function translate(wp: Workplane, v: [number, number, number]): Promise<Workplane>;
781
+ /**
782
+ * rotate
783
+ * @param wp - Workplane
784
+ * @param axis - [number, number, number]
785
+ * @param angle - number
786
+ * @returns Promise<Workplane>
787
+ */
788
+ export declare function rotate(wp: Workplane, axis: [number, number, number], angle: number): Promise<Workplane>;
789
+ /**
790
+ * mirror — full upstream `Workplane.mirror` semantics (cadquery 2.8.0, verified
791
+ * against cq.py:1113):
792
+ * - string form: 'XY'..'ZY' named mirror planes
793
+ * - vector form: plane normal, mirrored about `basePointVector` (default origin)
794
+ * - Workplane form (upstream Face form): normal + center of the selected face;
795
+ * basePointVector only overrides the center when explicitly given
796
+ * - `union`: fuse the mirrored copy with the original (upstream `self.union(newS)`)
797
+ *
798
+ * The kernel projection is `cad.mirror(shape, { normal, at })` — the previous
799
+ * implementation passed `{ plane }`, which MirrorOptions does not know, so every
800
+ * mirror silently used the default normal [1,0,0] (latent bug, found while
801
+ * writing the test_mirror mirrors).
802
+ *
803
+ * @param wp - Workplane
804
+ * @param mirrorPlane - 'XY'..'ZY' | plane normal vector | Workplane carrying a face selection (default 'XY')
805
+ * @param basePointVector - point the mirror plane passes through (default: the selected face centre for the Workplane form, otherwise the world origin)
806
+ * @param union - fuse the mirrored copy with the original (default false)
807
+ * @returns Promise<Workplane> carrying the mirrored (or unioned) shape
808
+ */
809
+ export declare function mirror(wp: Workplane, mirrorPlane?: string | number[] | Workplane, basePointVector?: [number, number, number], union?: boolean): Promise<Workplane>;
810
+ /**
811
+ * faceCompound — extract the faces picked by a direction selector as a
812
+ * standalone compound Shape (upstream module-level `Shape.faces(">Z")`, which
813
+ * returns a Compound of faces — unlike `Workplane.faces()`, which only records
814
+ * the selection). Needed by test_single_ent_selector where the exported var IS
815
+ * the face compound (ref: Compound, area 2 = two unit-box top faces).
816
+ *
817
+ * `sel = 'all'` picks EVERY face of the shape — the upstream
818
+ * `compound(shape.Faces())` free-function form (test_constructors c1/c2).
819
+ *
820
+ * @param wp - Workplane
821
+ * @param sel - direction selector (">Z", "<X", …) or 'all' for every face
822
+ * @returns Promise<Workplane> carrying the face compound
823
+ */
824
+ export declare function faceCompound(wp: Workplane, sel: string): Promise<Workplane>;
825
+ /**
826
+ * edgeCompound — extract the edges picked by a direction selector as a
827
+ * standalone compound Shape (upstream `shape.edges(">Z")` on a Solid, which
828
+ * returns a Compound of edges). Needed by TestCQSelectors.testShape where the
829
+ * exported var IS the edge compound (ref: Compound of the 4 top edges).
830
+ *
831
+ * Semantics (upstream DirectionMinMaxSelector = CenterNthSelector n=-1):
832
+ * order ALL edges by their center-of-mass projection onto the axis and take
833
+ * the extremum cluster (ties included). For a centered box the vertical edges'
834
+ * centers sit at z=0 while the top edges sit at z=+h/2 — so `">Z"` picks
835
+ * exactly the 4 top edges.
836
+ *
837
+ * @param wp - Workplane
838
+ * @param sel - direction selector (">Z", "<X", …) picking the extremum edge cluster
839
+ * @returns Promise<Workplane> carrying the edge compound
840
+ */
841
+ export declare function edgeCompound(wp: Workplane, sel: string): Promise<Workplane>;
842
+ /**
843
+ * Minimal analogue of CadQuery's `Location`.
844
+ *
845
+ * Upstream (`cadquery/occ_impl/geom.py::Location`) builds a `gp_Trsf` from a
846
+ * translation plus an Euler rotation using **degrees** and
847
+ * `gp_Extrinsic_XYZ` order, then maps `p -> R·p + t` (rotate first, translate
848
+ * second). We keep exactly those two fields; rotation is stored in degrees so
849
+ * mirrors can pass upstream angle literals verbatim.
850
+ *
851
+ * Not modelled: the `Location(Plane)` / `Location(Plane, VectorLike)` overloads
852
+ * and `TopLoc_Location` composition — no mirror case needs them yet.
853
+ */
854
+ export interface CqLocation {
855
+ readonly __cqLocation: true;
856
+ /** Translation (mm). */
857
+ readonly pos: [number, number, number];
858
+ /** Euler rotation in degrees (upstream gp_Extrinsic_XYZ). */
859
+ readonly rot: [number, number, number];
860
+ }
861
+ /**
862
+ * Type guard for a `Location` produced by {@link Location}.
863
+ *
864
+ * @param v - value to test
865
+ * @returns True when `v` is a cq-compat Location
866
+ */
867
+ export declare function isLocation(v: unknown): v is CqLocation;
868
+ /**
869
+ * Location — CadQuery `Location` constructor.
870
+ *
871
+ * Accepted forms (all verified against the upstream overloads used by
872
+ * `tests/test_free_functions.py::test_moved`):
873
+ * `Location([x, y, z])`
874
+ * `Location([x, y, z], [rx, ry, rz])`
875
+ * `Location(x, y, z)` / `Location(x, y, z, rx, ry, rz)`
876
+ * `Location({ x, y, z, rx, ry, rz })` ← the `.moved(z=-1)` keyword form
877
+ *
878
+ * @param args - overload payload: `[pos]`, `[pos, rot]`, `(x, y, z[, rx, ry, rz])`, or the keyword object
879
+ * @returns CqLocation (position in mm, rotation in degrees)
880
+ */
881
+ export declare function Location(...args: unknown[]): CqLocation;
882
+ /**
883
+ * composeLocations(a, b) — the Location product `a * b` (upstream `Location.__mul__`):
884
+ * apply `b` first, then `a`. Result: R = Ra·Rb, t = Ra·t_b + t_a.
885
+ *
886
+ * Mirrors need this because a Workplane whose carried shape is a **compound**
887
+ * cannot be fed back into `moved` — the faijs runtime only re-attaches the BREP
888
+ * handle across statement boundaries for solids (see `moved`'s KNOWN LIMITATION
889
+ * note), so `bs1.moved(l3, l4)` has to be written as one `moved` over the
890
+ * composed locations instead of two chained ones.
891
+ *
892
+ * @param a - outer location (applied second)
893
+ * @param b - inner location (applied first)
894
+ * @returns CqLocation holding the product a·b
895
+ */
896
+ export declare function composeLocations(a: CqLocation, b: CqLocation): CqLocation;
897
+ /**
898
+ * moved — apply one or more Locations to the carried geometry.
899
+ *
900
+ * Upstream is `Shape.moved(*locs)`: one location returns a moved copy, several
901
+ * return a **compound** holding one copy per location (no boolean union —
902
+ * `test_moved` asserts `bs1.Volume() == 2` and `len(bs1.Solids()) == 2` for two
903
+ * disjoint unit boxes, which only holds for a compound).
904
+ *
905
+ * @param wp - Workplane
906
+ * @param locs - Location | [x,y,z] | {x,y,z,rx,ry,rz} | list thereof
907
+ * @returns Promise<Workplane>
908
+ */
909
+ export declare function moved(wp: Workplane, ...locs: unknown[]): Promise<Workplane>;
910
+ /**
911
+ * move — upstream mutates the shape in place; cq-compat carriers are immutable
912
+ * so this is an alias of {@link moved}.
913
+ *
914
+ * @param wp - Workplane
915
+ * @param locs - same forms as {@link moved}
916
+ * @returns Promise<Workplane>
917
+ */
918
+ export declare function move(wp: Workplane, ...locs: unknown[]): Promise<Workplane>;
919
+ /**
920
+ * union
921
+ * @param wp - Workplane
922
+ * @param other - Workplane | Shape
923
+ * @returns Promise<Workplane>
924
+ */
925
+ export declare function union(wp: Workplane, other: Workplane | Shape): Promise<Workplane>;
926
+ /**
927
+ * combine
928
+ * @param wp - Workplane
929
+ * @returns Promise<Workplane>
930
+ *
931
+ * CadQuery semantics note (verified vs cadquery 2.8.0): upstream `combine()`
932
+ * fuses all stack items. cq-compat fuses eagerly inside the building ops
933
+ * (extrude / eachpoint with combine=True), so by the time combine() runs the
934
+ * stack holds a single fused solid — the op degenerates to a `clean()` pass
935
+ * (same-face merge), which matches the upstream test expectations
936
+ * (testCombine: 11 faces either way).
937
+ */
938
+ export declare function combine(wp: Workplane): Promise<Workplane>;
939
+ /**
940
+ * cut
941
+ * @param wp - Workplane
942
+ * @param other - Workplane | Shape
943
+ * @returns Promise<Workplane>
944
+ */
945
+ export declare function cut(wp: Workplane, other: Workplane | Shape): Promise<Workplane>;
946
+ /**
947
+ * face — materialize the pending wire LIST as one planar face per outermost
948
+ * wire (upstream module-level `face(*wires)` free function). Enclosed wires
949
+ * become holes of the enclosing face — the same outer/hole grouping `extrude`
950
+ * uses. Several disjoint outer wires yield a Compound of faces.
951
+ *
952
+ * @param wp - Workplane carrying the pending wires
953
+ * @returns Promise<Workplane> whose shape is the face (or face compound)
954
+ */
955
+ export declare function face(wp: Workplane): Promise<Workplane>;
956
+ /**
957
+ * vertex — upstream module-level `vertex(x, y, z)` free function: a single
958
+ * point shape. Used as a degenerate loft section (`loft(face, vertex(0,0,1))`)
959
+ * and inside compounds.
960
+ *
961
+ * @param x - world x (default 0)
962
+ * @param y - world y (default 0)
963
+ * @param z - world z (default 0)
964
+ * @returns Shape holding the vertex
965
+ */
966
+ export declare function vertex(x?: number, y?: number, z?: number): Shape;
967
+ /**
968
+ * compound — upstream module-level `compound(*shapes)` free function: bundle
969
+ * several shapes into a single Compound WITHOUT any boolean operation. Needed
970
+ * by test_history_bool (imprint result = base solid + tool solid as a
971
+ * compound) and test_union_compound-style cases.
972
+ *
973
+ * Accepts Shapes and Workplanes (their current shape is used); null/empty
974
+ * entries are skipped. Returns a Shape whose value is the compound itself, so
975
+ * mirrors write `let result = c` directly.
976
+ *
977
+ * @param items - Shapes and/or Workplanes to bundle (null/undefined entries are skipped)
978
+ * @returns Compound Shape, or null when no item carries geometry
979
+ */
980
+ export declare function compound(...items: (Workplane | Shape | null | undefined)[]): Shape | null;
981
+ /**
982
+ * intersect
983
+ * @param wp - Workplane
984
+ * @param other - Workplane | Shape
985
+ * @returns Promise<Workplane>
986
+ */
987
+ export declare function intersect(wp: Workplane, other: Workplane | Shape): Promise<Workplane>;
988
+ /**
989
+ * Fillet selected edges of the current shape.
990
+ *
991
+ * Edge resolution mirrors chamfer: an explicit `|Z`-style / empty edgeSel goes
992
+ * through `resolveEdgeSelection`; a pending face selection
993
+ * (`.faces(">Z").fillet(r)`) fillets THE SELECTED FACE's edges via
994
+ * `resolveFaceEdgeSelection` (upstream `.faces("+Z").edges().fillet(r)`
995
+ * semantics — the missing faceSel branch made testTopFaceFillet fillet all 12
996
+ * edges instead of the 4 top ones). Failures propagate — silently returning
997
+ * the unfilleted shape previously produced plates whose fillets were missing
998
+ * entirely (bp/mb/mt/tp diagnosis, 2026-09-08).
999
+ *
1000
+ * @param wp - Workplane whose current shape is filleted; consumes `edgeSel`/`faceSel`.
1001
+ * @param radius - Fillet radius in world units.
1002
+ * @returns Promise resolving to a new Workplane holding the filleted shape.
1003
+ */
1004
+ export declare function fillet(wp: Workplane, radius: number): Promise<Workplane>;
1005
+ /**
1006
+ * chamfer
1007
+ * @param wp - Workplane
1008
+ * @param length - number
1009
+ * @param length2 - number | undefined
1010
+ * @returns Promise<Workplane>
1011
+ *
1012
+ * CadQuery semantics (verified vs cadquery 2.8.0 `Workplane.chamfer`):
1013
+ * chamfers the selected edges of the current shape. Edge resolution order:
1014
+ * explicit `edges("|Z")` selector; else, if a face selector is pending
1015
+ * (`.faces(">Z").chamfer(l)`), the edges OF the selected face; else all
1016
+ * edges. LIMITATION: asymmetric `length2` is NOT supported — the occt-wasm
1017
+ * kernel chamfer takes a single uniform distance (resolveUniformRadius
1018
+ * degrades a pair to d1), so length2 throws instead of silently producing a
1019
+ * symmetric chamfer.
1020
+ */
1021
+ export declare function chamfer(wp: Workplane, length: number, length2?: number): Promise<Workplane>;
1022
+ /**
1023
+ * shell
1024
+ *
1025
+ * CadQuery `Workplane.shell(thickness)` parity: shells the solid found on the
1026
+ * stack, removing the faces selected by a preceding `faces(sel)` (empty
1027
+ * selection = `Shape.hollow` — no faces removed, the solid is hollowed into a
1028
+ * closed shell, verified vs cadquery 2.8.0: `box(2,2,2).shell(-0.1)` → 12
1029
+ * faces, vol 2.168). The kernel call is `OcctKernel.shell` =
1030
+ * `BRepOffsetAPI_MakeThickSolidByJoin` (negative thickness → walls inward,
1031
+ * positive → walls outward, mirroring upstream sign semantics).
1032
+ *
1033
+ * Face removal set: single-axis selectors (">Z"/"<Z"/"+Z"/"-Z" …) pick the
1034
+ * faces perpendicular to the axis whose bbox center sits at the extreme —
1035
+ * the same criteria `resolveFaceSelector` uses. Multi-axis and indexed
1036
+ * selectors are not supported here yet (the blocked mirrors that need them
1037
+ * are out of this phase's scope).
1038
+ *
1039
+ * @param wp - Workplane
1040
+ * @param thickness - number (negative: inward hollow)
1041
+ * @returns Promise<Workplane>
1042
+ */
1043
+ export declare function shell(wp: Workplane, thickness: number): Promise<Workplane>;
1044
+ /**
1045
+ * val
1046
+ * @param wp - Workplane
1047
+ * @returns Shape | null
1048
+ */
1049
+ export declare function val(wp: Workplane): Shape | null;
1050
+ /**
1051
+ * vals
1052
+ * @param wp - Workplane
1053
+ * @returns (Shape | null)[]
1054
+ */
1055
+ export declare function vals(wp: Workplane): (Shape | null)[];
1056
+ /**
1057
+ * transformed
1058
+ * @param wp - Workplane
1059
+ * @param opts - { offset?: [number, number, number]; rotate?: [number, number, number] }
1060
+ * @returns Promise<Workplane>
1061
+ */
1062
+ export declare function transformed(wp: Workplane, opts: {
1063
+ offset?: [number, number, number];
1064
+ rotate?: [number, number, number];
1065
+ }): Promise<Workplane>;
1066
+ /**
1067
+ * setColor
1068
+ * @param wp - Workplane
1069
+ * @param color - RGB
1070
+ * @returns Workplane
1071
+ */
1072
+ export declare function setColor(wp: Workplane, color: RGB): Workplane;
1073
+ /**
1074
+ * splineFace — build a B-spline surface face from a regular point grid and set
1075
+ * it as the workplane's current shape. CadQuery analog: `Face.makeSplineApprox`
1076
+ * (`Part.makeSplineSurface`) over the same `rows × cols` point grid.
1077
+ *
1078
+ * Two strategies are available via `opts.strategy`:
1079
+ *
1080
+ * - `'row-approx-loft'` (**default**): each grid row becomes a curve through
1081
+ * `approximatePoints(row, tolerance)`, the row wires are skinned with
1082
+ * `loft(wires, false, false)`, and the single resulting face is returned.
1083
+ * This matches CadQuery `makeSplineApprox` to 4.2e-11 (straight) / 5.6e-7
1084
+ * (helical) relative area on gear tooth grids — ≈3 orders better than
1085
+ * `'grid'` — because the curve-level tolerance carries the same meaning as
1086
+ * CadQuery's `spline_approx_tol`.
1087
+ * - `'grid'`: one-shot `bsplineSurface(flat, rows, cols)` over the whole grid.
1088
+ * occt-wasm exposes no DegMin/DegMax/Tol3D arguments here, so it runs with
1089
+ * kernel defaults; that measurably diverges from CadQuery's explicit
1090
+ * `(3, 8, 1e-2)` (≈2.3e-4 relative area on a gear tooth grid).
1091
+ *
1092
+ * Points are world-space and row-major (length `rows * cols`); the workplane's
1093
+ * plane/origin are not consulted — it is only the returned carrier.
1094
+ *
1095
+ * @param wp - Workplane carrier
1096
+ * @param grid - world-space points, row-major (length must equal `rows*cols`)
1097
+ * @param opts - `{ rows; cols; tolerance?; strategy? }`. `tolerance` is the
1098
+ * per-row curve approximation tolerance (default `1e-2`, matching CadQuery's
1099
+ * `spline_approx_tol`); `strategy` defaults to `'row-approx-loft'`
1100
+ * @returns Workplane with the spline face as `.shape`
1101
+ */
1102
+ export declare function splineFace(wp: Workplane, grid: [number, number, number][], opts: {
1103
+ rows: number;
1104
+ cols: number;
1105
+ tolerance?: number;
1106
+ strategy?: 'row-approx-loft' | 'grid';
1107
+ }): Promise<Workplane>;
1108
+ /**
1109
+ * helix — create a helical wire on the workplane (origin = `wp.origin`, axis =
1110
+ * `wp.normal`). Equivalent to CadQuery `Workplane().makeHelix(pitch, height,
1111
+ * radius, ...)`.
1112
+ *
1113
+ * @param wp - Workplane (origin + normal define the helix axis)
1114
+ * @param pitch - axial advance per full turn (mm)
1115
+ * @param height - total helix height (mm)
1116
+ * @param radius - helix radius (mm)
1117
+ * @param opts - `{ leftHanded?: boolean }` (default right-handed)
1118
+ * @returns Workplane with the helix wire as `.shape`
1119
+ */
1120
+ export declare function helix(wp: Workplane, pitch: number, height: number, radius: number, opts?: {
1121
+ leftHanded?: boolean;
1122
+ }): Promise<Workplane>;
1123
+ /**
1124
+ * splitFace — split the workplane's current shape by a plane and keep one side.
1125
+ * Equivalent to CadQuery `face.split(plane)` / `split(keepTop)`.
1126
+ *
1127
+ * Internally builds a half-space tool (`occt-wasm` `halfSpace`) from the plane
1128
+ * and runs `BOPAlgo_Splitter` (`split`); the kept fragment is selected by the
1129
+ * signed distance of its bounding-box centre to the plane.
1130
+ *
1131
+ * @param wp - Workplane whose `.shape` is the face/solid to split
1132
+ * @param plane - splitting plane as `{ origin: Vec3; normal: Vec3 }`
1133
+ * @param keep - `'top'` (normal side, default) | `'bottom'` (opposite side)
1134
+ * @returns Workplane with the kept fragment as `.shape`
1135
+ */
1136
+ export declare function splitFace(wp: Workplane, plane: {
1137
+ origin: [number, number, number];
1138
+ normal: [number, number, number];
1139
+ }, keep?: 'top' | 'bottom'): Promise<Workplane>;
1140
+ /**
1141
+ * twistExtrude — extrude a profile while twisting it about the extrusion axis
1142
+ * by `angle` (deg) over `height` (mm). Equivalent to CadQuery
1143
+ * `Workplane().twistExtrude(profile, angle, height, ...)`.
1144
+ *
1145
+ * Implemented by sweeping `steps`+1 rotated+translated copies of the profile
1146
+ * through `loft` (a smooth, ruled=False loft). The twist axis is `wp.normal`.
1147
+ *
1148
+ * @param wp - Workplane carrying the profile: either `.shape` (face/wire) or a
1149
+ * pending 2D profile (`rect`/`circle`/`pendingWires`), as upstream accepts
1150
+ * @param angle - total twist angle over height (deg)
1151
+ * @param height - extrusion height (mm)
1152
+ * @param opts - `{ steps?: number }` (section count; default scales with |angle|)
1153
+ * @returns Workplane with the twisted solid as `.shape`
1154
+ */
1155
+ export declare function twistExtrude(wp: Workplane, angle: number, height: number, opts?: {
1156
+ steps?: number;
1157
+ }): Promise<Workplane>;
1158
+ /**
1159
+ * solidFromFaces — sew a closed set of faces into a solid on the workplane.
1160
+ * Equivalent to CadQuery `cq.Shell.makeShell(faces)` + `Solid.makeSolid(...)`
1161
+ * (BRepBuilderAPI_Sewing + BRepBuilderAPI_MakeSolid + orientation fix).
1162
+ *
1163
+ * This is cq-compat extension E5 (fai_cq_gears port plan §13-6): the existing
1164
+ * `shell` op is hollowing (thickening a solid), not sewing face patches into
1165
+ * a solid, and gears need the latter after their tooth-face/cap faces are built.
1166
+ *
1167
+ * @param wp - Workplane providing the result's coordinate frame (origin/normal)
1168
+ * @param faces - Workplanes whose `.shape` are the faces to sew (each must be a face)
1169
+ * @param opts - `{ sewingTolerance?: number (default 1e-2, cq shell_sewing_tol);
1170
+ * fixOrientations?: boolean (default true) }`. `sew` does not guarantee
1171
+ * consistent face orientation — a loft-skinned tooth face can come out
1172
+ * inward-facing, making the sewn solid carry negative volume — so
1173
+ * `fixFaceOrientations` runs by default. If the fixed shape degrades back to
1174
+ * a shell (observed on micro-gap shells that only close via the sewing
1175
+ * tolerance), the pre-fix `makeSolid` result is kept instead.
1176
+ * @returns Workplane with the sewn solid as `.shape`
1177
+ */
1178
+ export declare function solidFromFaces(wp: Workplane, faces: Workplane[], opts?: {
1179
+ sewingTolerance?: number;
1180
+ fixOrientations?: boolean;
1181
+ }): Promise<Workplane>;
1182
+ /**
1183
+ * planarCap — build a planar cap face from the boundary edges of the given
1184
+ * faces that lie on the plane `origin · normal = d`, then set it as the
1185
+ * workplane shape. Equivalent to CadQuery gears' `planarCapAtZ` /
1186
+ * `Face.makeFromWires(Wire.combine(boundaryEdges, tol))`.
1187
+ *
1188
+ * This is cq-compat extension E6 (fai_cq_gears port plan §13-6): the existing
1189
+ * `wire`/`face` ops only consume pending drawing descriptors, not edges that
1190
+ * already exist inside kernel shapes — gears need to close their tooth-face
1191
+ * patches with end caps built from those edges.
1192
+ *
1193
+ * Edge chaining ports the proven TS re-implementation of OCCT's
1194
+ * `ShapeAnalysis_FreeBounds::ConnectEdgesToWires`: unordered edges are chained
1195
+ * by endpoint proximity within `tol` (kernel `makeWire` silently drops edges
1196
+ * when gaps exceed OCCT precision, so in-tolerance gaps are bridged with a
1197
+ * line segment — same as upstream).
1198
+ *
1199
+ * @param wp - Workplane providing the result's coordinate frame
1200
+ * @param faces - Workplanes whose `.shape` are the faces supplying boundary edges
1201
+ * @param plane - cap plane: `{ origin, normal }`; the plane offset is taken
1202
+ * from `origin` (edges whose bounding box lies within `pickTolerance` of the
1203
+ * plane are collected)
1204
+ * @param opts - `{ combineTolerance?: number (default 1e-2, cq wire_comb_tol);
1205
+ * pickTolerance?: number (default 1e-6) }`
1206
+ * @returns Workplane with the cap face as `.shape`
1207
+ */
1208
+ export declare function planarCap(wp: Workplane, faces: Workplane[], plane: {
1209
+ origin: [number, number, number];
1210
+ normal: [number, number, number];
1211
+ }, opts?: {
1212
+ combineTolerance?: number;
1213
+ pickTolerance?: number;
1214
+ }): Promise<Workplane>;
1215
+ export {};
1216
+ //# sourceMappingURL=workplane.d.ts.map