@faicad/cq-compat 0.13.2 → 0.14.1
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/dist/browser.d.ts +0 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +7 -6
- package/dist/browser.js.map +1 -1
- package/dist/gear-test-harness.d.ts.map +1 -1
- package/dist/gear-test-harness.js +9 -12
- package/dist/gear-test-harness.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/sketch.d.ts +209 -0
- package/dist/sketch.d.ts.map +1 -0
- package/dist/sketch.js +529 -0
- package/dist/sketch.js.map +1 -0
- package/dist/workplane.d.ts +47 -0
- package/dist/workplane.d.ts.map +1 -1
- package/dist/workplane.js +424 -5
- package/dist/workplane.js.map +1 -1
- package/package.json +3 -2
package/dist/browser.d.ts
CHANGED
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,aAAa,CAAA;AAQ3B,cAAc,SAAS,CAAA"}
|
package/dist/browser.js
CHANGED
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* writing `import * as cq from '@faicad/cq-compat'`.
|
|
10
10
|
*/
|
|
11
11
|
export * from './workplane.js';
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
// initOcctWasm + types — no node
|
|
15
|
-
// as much as workplane
|
|
16
|
-
//
|
|
17
|
-
// resolution and every gear factory
|
|
12
|
+
// Assembly layer moved out of the main package → @faicad/cq-compat-assembly
|
|
13
|
+
// (browser entry there: ./browser). Gear primitives stay here (browser-safe:
|
|
14
|
+
// gears.ts imports only `@faicad/faijs`'s initOcctWasm + types — no node
|
|
15
|
+
// builtins), so they belong in this entry just as much as workplane do.
|
|
16
|
+
// Without this line `@faicad/fai-cq-gears` (which imports `getGearKernel`
|
|
17
|
+
// from `@faicad/cq-compat`) has no browser resolution and every gear factory
|
|
18
|
+
// throws at call time.
|
|
18
19
|
export * from './gears.js';
|
|
19
20
|
//# sourceMappingURL=browser.js.map
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,aAAa,CAAA;AAC3B,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,aAAa,CAAA;AAC3B,4EAA4E;AAC5E,6EAA6E;AAC7E,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,6EAA6E;AAC7E,uBAAuB;AACvB,cAAc,SAAS,CAAA","sourcesContent":["/**\n * @faicad/cq-compat/browser — browser-safe entry for the CadQuery compatibility layer.\n *\n * Unlike the package root (`./index`), this entry does NOT re-export the STEP /\n * assembly comparison helpers (`step-compare`, `assembly-compare`), which import\n * `node:fs` and cannot be bundled into a browser (Vite/Rollup would fail on the\n * builtin module). The faijs demo libLoader imports this entry statically and\n * registers it under the `@faicad/cq-compat` specifier, so `.fai.js` scripts keep\n * writing `import * as cq from '@faicad/cq-compat'`.\n */\nexport * from './workplane'\n// Assembly layer moved out of the main package → @faicad/cq-compat-assembly\n// (browser entry there: ./browser). Gear primitives stay here (browser-safe:\n// gears.ts imports only `@faicad/faijs`'s initOcctWasm + types — no node\n// builtins), so they belong in this entry just as much as workplane do.\n// Without this line `@faicad/fai-cq-gears` (which imports `getGearKernel`\n// from `@faicad/cq-compat`) has no browser resolution and every gear factory\n// throws at call time.\nexport * from './gears'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gear-test-harness.d.ts","sourceRoot":"","sources":["../src/gear-test-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,WAAW,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"gear-test-harness.d.ts","sourceRoot":"","sources":["../src/gear-test-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,WAAW,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBvD;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,IAAI,UAAU,CAEnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,SAAS,CAgB7D;AAED;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAEvC;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEzC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* This file is NOT a test (no `*.test.ts`); it is imported by the E1–E4 specs.
|
|
13
13
|
*/
|
|
14
|
-
import { registerOcctBrepEngine, configureBackends, CONTRACT_VERSION } from '@faicad/faijs';
|
|
14
|
+
import { registerOcctBrepEngine, configureBackends, getBrepEngine, CONTRACT_VERSION, OCCT_BREP_ENGINE_ID } from '@faicad/faijs';
|
|
15
15
|
import { getKernel } from '@faicad/faijs/occt-kernel/occtKernel';
|
|
16
16
|
import { brepOf } from '@faicad/faijs/shape';
|
|
17
17
|
export { brepOf };
|
|
@@ -28,22 +28,19 @@ export { brepOf };
|
|
|
28
28
|
export async function setupNativeKernel() {
|
|
29
29
|
await registerOcctBrepEngine();
|
|
30
30
|
const k = getKernel();
|
|
31
|
+
// Capability declaration is NOT re-typed here: take back the honest declaration
|
|
32
|
+
// the OCCT adapter itself carries. Before this, the harness hand-mirrored it with
|
|
33
|
+
// `evolution: true` — a second home for the same fact, which silently desynced the
|
|
34
|
+
// moment the adapter moved to a per-kernel-function list (`BrepEvolutionKind`).
|
|
35
|
+
// dual-ops that gate on a capability (e.g. union → 'fuse') still dispatch to brep
|
|
36
|
+
// instead of throwing E_BREP_UNSUPPORTED in the bare-kernel test path.
|
|
37
|
+
const occtEngine = await getBrepEngine(OCCT_BREP_ENGINE_ID);
|
|
31
38
|
configureBackends({
|
|
32
39
|
contractVersion: CONTRACT_VERSION,
|
|
33
|
-
// Mirror the OCCT engine capabilities declared in registerOcctBrepEngine so
|
|
34
|
-
// dual-ops that gate on a capability (e.g. cut → 'evolution') dispatch to
|
|
35
|
-
// brep instead of throwing E_BREP_UNSUPPORTED in the bare-kernel test path.
|
|
36
40
|
config: {
|
|
37
41
|
mode: 'brep',
|
|
38
42
|
brepEngineId: 'occt',
|
|
39
|
-
brepCapabilities:
|
|
40
|
-
evolution: true,
|
|
41
|
-
heal: true,
|
|
42
|
-
directEdit: true,
|
|
43
|
-
advSurface: true,
|
|
44
|
-
assembly: true,
|
|
45
|
-
meshLift: true,
|
|
46
|
-
},
|
|
43
|
+
brepCapabilities: occtEngine.capabilities,
|
|
47
44
|
},
|
|
48
45
|
kernel: { brep: k, csg: undefined, sdf: undefined },
|
|
49
46
|
fonts: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gear-test-harness.js","sourceRoot":"","sources":["../src/gear-test-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"gear-test-harness.js","sourceRoot":"","sources":["../src/gear-test-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAC/H,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,CAAA;AAKjB;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,sBAAsB,EAAE,CAAA;IAC9B,MAAM,CAAC,GAAG,SAAS,EAA2B,CAAA;IAC9C,gFAAgF;IAChF,kFAAkF;IAClF,mFAAmF;IACnF,gFAAgF;IAChF,kFAAkF;IAClF,uEAAuE;IACvE,MAAM,UAAU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AAC,KAAY;IAC/B,OAAO,MAAM,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAA2B,CAAC,CAAA;AACzE,CAAC","sourcesContent":["/**\n * Shared harness for the E1–E4 gear-extension ops.\n *\n * These ops call the occt-wasm kernel directly via `getKernel()` (the native\n * singleton that `registerOcctBrepEngine()` initializes) and wrap results with\n * `fromHandle`. `fromHandle` needs `getBackends().kernel.brep` to be a MESHABLE\n * kernel — the raw occt-wasm `OcctKernel` exposes `meshShape`, so we wire it\n * straight into `configureBackends`. This is intentionally the SAME native\n * instance the ops use, so handles stay consistent (no second kernel, no\n * `createRuntime`, which only lazily builds its brep chain inside `execute`).\n *\n * This file is NOT a test (no `*.test.ts`); it is imported by the E1–E4 specs.\n */\n\nimport { registerOcctBrepEngine, configureBackends, getBrepEngine, CONTRACT_VERSION, OCCT_BREP_ENGINE_ID } from '@faicad/faijs'\nimport { getKernel } from '@faicad/faijs/occt-kernel/occtKernel'\nimport { brepOf } from '@faicad/faijs/shape'\nexport { brepOf }\nimport type { OcctKernel, ShapeHandle } from 'occt-wasm'\nimport type { Shape } from '@faicad/faijs/mesh/types'\nimport type { Workplane } from './workplane'\n\n/**\n * Initialise the native occt-wasm kernel for the E1–E4 specs.\n *\n * Calls `registerOcctBrepEngine()` (which boots the kernel singleton and\n * registers the OCCT engine) and then wires that SAME instance into the\n * backend registry via `configureBackends`, so `fromHandle` can resolve a\n * meshable kernel. Must be awaited in `beforeAll` before any op is invoked.\n *\n * @returns a promise that resolves once the kernel and backends are ready\n */\nexport async function setupNativeKernel(): Promise<void> {\n await registerOcctBrepEngine()\n const k = getKernel() as unknown as OcctKernel\n // Capability declaration is NOT re-typed here: take back the honest declaration\n // the OCCT adapter itself carries. Before this, the harness hand-mirrored it with\n // `evolution: true` — a second home for the same fact, which silently desynced the\n // moment the adapter moved to a per-kernel-function list (`BrepEvolutionKind`).\n // dual-ops that gate on a capability (e.g. union → 'fuse') still dispatch to brep\n // instead of throwing E_BREP_UNSUPPORTED in the bare-kernel test path.\n const occtEngine = await getBrepEngine(OCCT_BREP_ENGINE_ID)\n configureBackends({\n contractVersion: CONTRACT_VERSION,\n config: {\n mode: 'brep',\n brepEngineId: 'occt',\n brepCapabilities: occtEngine.capabilities,\n },\n kernel: { brep: k, csg: undefined, sdf: undefined },\n fonts: undefined,\n texture: undefined,\n assets: undefined,\n events: undefined,\n })\n}\n\n/**\n * Return the shared native occt-wasm kernel singleton.\n *\n * The same instance the E1–E4 ops obtain internally via `getKernel()`, so\n * fixtures built here and op outputs share one handle space.\n *\n * @returns the live `OcctKernel` instance (valid after {@link setupNativeKernel})\n */\nexport function kernel(): OcctKernel {\n return getKernel() as unknown as OcctKernel\n}\n\n/**\n * Build a minimal valid root `Workplane` without touching the `cad.*` backend.\n *\n * Defaults to the XY plane at the origin (normal +Z, xDir +X, yDir +Y) with no\n * shape and no pending wires; pass `over` to override any field (e.g.\n * `{ shape }` or `{ normal, origin }`).\n *\n * @param over - partial overrides merged onto the default workplane\n * @returns a `Workplane` literal suitable as the first argument of an op\n */\nexport function mkWP(over: Partial<Workplane> = {}): Workplane {\n return {\n __cq: true,\n plane: 'XY',\n origin: [0, 0, 0],\n normal: [0, 0, 1],\n xDir: [1, 0, 0],\n yDir: [0, 1, 0],\n shape: null,\n faceSel: null,\n edgeSel: null,\n vertexSel: null,\n pts: [],\n forConstruction: false,\n ...over,\n }\n}\n\n/**\n * Axis-aligned bounding box of a shape, in the kernel's field naming.\n *\n * Mirrors the `BoundingBox` record returned by the native\n * `getBoundingBox` call (all six min/max fields, no `minX`-style aliases).\n */\nexport type BBox = {\n xmin: number\n xmax: number\n ymin: number\n ymax: number\n zmin: number\n zmax: number\n}\n\n/**\n * Compute the axis-aligned bounding box of a shape through the native kernel.\n *\n * @param shape - a faijs `Shape` carrying a BREP handle (see `brepOf`)\n * @returns the six-field bounding box\n */\nexport function bbox(shape: Shape): BBox {\n return kernel().getBoundingBox(brepOf(shape) as unknown as ShapeHandle) as BBox\n}\n\n/**\n * Surface area of a face (or total area of a shell/solid), via the native\n * kernel's `getSurfaceArea`.\n *\n * @param shape - a faijs `Shape` carrying a BREP handle (see `brepOf`)\n * @returns the area in model units squared\n */\nexport function area(shape: Shape): number {\n return kernel().getSurfaceArea(brepOf(shape) as unknown as ShapeHandle)\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* All methods are standalone functions taking Workplane as first argument
|
|
14
14
|
* (transpiler converts method chains to this form).
|
|
15
15
|
*/
|
|
16
|
-
export { Workplane, add, box, sphere, wedge, cylinder, torus, cone, rarray, rect, circle, ellipse, polygon, extrude, revolve, loft, cutBlind, cutThruAll, hole, cboreHole, cskHole, threadedHole, faces, edges, vertices, solids, workplane, center, pushPoints, moveTo, move2D, lineTo, line, vLine, hLine, vLineTo, hLineTo, polyline, close, wire, face, vertex, threePointArc, sagittaArc, radiusArc, tangentArcPoint, spline, translate, rotate, mirror, faceCompound, edgeCompound, Location, isLocation, composeLocations, moved, move, union, cut, compound, intersect, combine, fillet, chamfer, shell, val, vals, transformed, setColor, splineFace, helix, splitFace, twistExtrude, solidFromFaces, planarCap, } from './workplane.js';
|
|
17
|
-
export type { Workplane as WorkplaneType, RGB, CqLocation } from './workplane.js';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export { compareAssemblyFiles, printAssemblyReport } from './assembly-compare.js';
|
|
22
|
-
export type { AssemblyCompareOptions, AssemblyCompareResult, PartCompareResult, } from './assembly-compare.js';
|
|
16
|
+
export { Workplane, add, box, sphere, wedge, cylinder, torus, cone, rarray, rect, circle, ellipse, polygon, extrude, revolve, loft, cutBlind, cutThruAll, hole, cboreHole, cskHole, threadedHole, faces, edges, vertices, solids, workplane, center, pushPoints, moveTo, move2D, lineTo, line, vLine, hLine, vLineTo, hLineTo, polyline, close, wire, face, vertex, threePointArc, sagittaArc, radiusArc, tangentArcPoint, spline, translate, rotate, mirror, faceCompound, edgeCompound, Location, isLocation, composeLocations, moved, move, union, cut, compound, intersect, combine, fillet, chamfer, shell, val, vals, transformed, setColor, splineFace, helix, splitFace, twistExtrude, solidFromFaces, planarCap, siblings, tag, workplaneFromTagged, } from './workplane.js';
|
|
17
|
+
export type { Workplane as WorkplaneType, RGB, CqLocation, TaggedWorkplane } from './workplane.js';
|
|
18
|
+
export { sketch as sketchCreate, rect as sketchRect, circle as sketchCircle, ellipse as sketchEllipse, polygon as sketchPolygon, regularPolygon as sketchRegularPolygon, slot as sketchSlot, trapezoid as sketchTrapezoid, offset as sketchOffset, faces as sketchFaces, wires as sketchWires, edges as sketchEdges, vertices as sketchVertices, reset as sketchReset, val as sketchVal, vals as sketchVals, tag as sketchTag, select as sketchSelect, area as sketchArea, faceCount as sketchFaceCount, extrude as sketchExtrude, dispose as sketchDispose, } from './sketch.js';
|
|
19
|
+
export type { Sketch, SketchMode, SketchOpts } from './sketch.js';
|
|
20
|
+
export { asBrepShape, resolveFaceSelector } from './workplane.js';
|
|
23
21
|
export { getGearKernel, connectEdgesToWires, gearFaceFromWires, gearShellToSolid, gearEdgeEnds, buildGearSplineFace, soleGearFace, gearDistanceToFace, gearFaceDeviation, DEFAULT_GEAR_SPLINE_FACE_STRATEGY, GEAR_SPLINE_FACE_STRATEGIES, } from './gears.js';
|
|
24
22
|
export type { GearKernel, GearAxis, GearEdgeEnds, GearSplineFaceStrategy, GearSplineFaceOptions, GearSplineGrid, GearDeviationStats, } from './gears.js';
|
|
25
23
|
export type { Vec3 } from './geom-types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,aAAa,EACb,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,EACH,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EAC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CAAA;AAK9D,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAS9D,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,SAAS,CAAA;AAChB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,GACnB,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,20 @@
|
|
|
13
13
|
* All methods are standalone functions taking Workplane as first argument
|
|
14
14
|
* (transpiler converts method chains to this form).
|
|
15
15
|
*/
|
|
16
|
-
export { Workplane, add, box, sphere, wedge, cylinder, torus, cone, rarray, rect, circle, ellipse, polygon, extrude, revolve, loft, cutBlind, cutThruAll, hole, cboreHole, cskHole, threadedHole, faces, edges, vertices, solids, workplane, center, pushPoints, moveTo, move2D, lineTo, line, vLine, hLine, vLineTo, hLineTo, polyline, close, wire, face, vertex, threePointArc, sagittaArc, radiusArc, tangentArcPoint, spline, translate, rotate, mirror, faceCompound, edgeCompound, Location, isLocation, composeLocations, moved, move, union, cut, compound, intersect, combine, fillet, chamfer, shell, val, vals, transformed, setColor, splineFace, helix, splitFace, twistExtrude, solidFromFaces, planarCap, } from './workplane.js';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
export { Workplane, add, box, sphere, wedge, cylinder, torus, cone, rarray, rect, circle, ellipse, polygon, extrude, revolve, loft, cutBlind, cutThruAll, hole, cboreHole, cskHole, threadedHole, faces, edges, vertices, solids, workplane, center, pushPoints, moveTo, move2D, lineTo, line, vLine, hLine, vLineTo, hLineTo, polyline, close, wire, face, vertex, threePointArc, sagittaArc, radiusArc, tangentArcPoint, spline, translate, rotate, mirror, faceCompound, edgeCompound, Location, isLocation, composeLocations, moved, move, union, cut, compound, intersect, combine, fillet, chamfer, shell, val, vals, transformed, setColor, splineFace, helix, splitFace, twistExtrude, solidFromFaces, planarCap, siblings, tag, workplaneFromTagged, } from './workplane.js';
|
|
17
|
+
// Sketch geometry container (CadQuery Sketch.py parity, non-planegcs part —
|
|
18
|
+
// Phase 2 of the max-cadquery plan; constraints blocked on LGPL verdict).
|
|
19
|
+
// Names carry a `sketch` prefix to avoid clashing with the Workplane ops
|
|
20
|
+
// (rect/circle/val/tag/... are already taken by the workplane layer).
|
|
21
|
+
export { sketch as sketchCreate, rect as sketchRect, circle as sketchCircle, ellipse as sketchEllipse, polygon as sketchPolygon, regularPolygon as sketchRegularPolygon, slot as sketchSlot, trapezoid as sketchTrapezoid, offset as sketchOffset, faces as sketchFaces, wires as sketchWires, edges as sketchEdges, vertices as sketchVertices, reset as sketchReset, val as sketchVal, vals as sketchVals, tag as sketchTag, select as sketchSelect, area as sketchArea, faceCount as sketchFaceCount, extrude as sketchExtrude, dispose as sketchDispose, } from './sketch.js';
|
|
22
|
+
// Internal helpers consumed by @faicad/cq-compat-assembly (the assembly layer
|
|
23
|
+
// split into its own package; these workplane-internal symbols are re-exported
|
|
24
|
+
// so the assembly package does not duplicate them).
|
|
25
|
+
export { asBrepShape, resolveFaceSelector } from './workplane.js';
|
|
26
|
+
// Assembly layer (buildAssembly/constraint/constraintEx/faceRef/pointRef/axisRef/
|
|
27
|
+
// Color + CadQuery solve()/toCompound()/save()) lives in
|
|
28
|
+
// @faicad/cq-compat-assembly. STEP / assembly equivalence comparers (dev-only)
|
|
29
|
+
// live in @faicad/cq-compat-compare.
|
|
20
30
|
// Gear primitive layer (raw-handle kernel access for the cq_gears port;
|
|
21
31
|
// see gears.ts header). fai_cq_gears consumes these instead of occt-wasm.
|
|
22
32
|
export { getGearKernel, connectEdgesToWires, gearFaceFromWires, gearShellToSolid, gearEdgeEnds, buildGearSplineFace, soleGearFace, gearDistanceToFace, gearFaceDeviation, DEFAULT_GEAR_SPLINE_FACE_STRATEGY, GEAR_SPLINE_FACE_STRATEGIES, } from './gears.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,aAAa,EACb,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,EACH,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,E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B,KAAK,IAAI,WAAW,EACpB,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,GAAG,IAAI,SAAS,EAChB,IAAI,IAAI,UAAU,EAClB,GAAG,IAAI,SAAS,EAChB,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,SAAS,IAAI,eAAe,EAC5B,OAAO,IAAI,aAAa,EACxB,OAAO,IAAI,aAAa,GACzB,MAAM,UAAU,CAAA;AAGjB,8EAA8E;AAC9E,+EAA+E;AAC/E,oDAAoD;AACpD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAE9D,kFAAkF;AAClF,yDAAyD;AACzD,+EAA+E;AAC/E,qCAAqC;AAErC,wEAAwE;AACxE,0EAA0E;AAC1E,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,SAAS,CAAA","sourcesContent":["/**\n * @faicad/cq-compat — CadQuery API compatibility layer for faijs.\n *\n * Usage in .fai.js:\n * import * as cq from '@faicad/cq-compat'\n * let wp = cq.Workplane('XY')\n * let wp1 = await cq.box(wp, 100, 80, 10)\n * let wp2 = await cq.faces(wp1, '>Z')\n * let wp3 = await cq.workplane(wp2)\n * let result = await cq.hole(wp3, 5)\n * let shape = cq.val(result)\n *\n * All methods are standalone functions taking Workplane as first argument\n * (transpiler converts method chains to this form).\n */\n\nexport {\n Workplane,\n add,\n box,\n sphere,\n wedge,\n cylinder,\n torus,\n cone,\n rarray,\n rect,\n circle,\n ellipse,\n polygon,\n extrude,\n revolve,\n loft,\n cutBlind,\n cutThruAll,\n hole,\n cboreHole,\n cskHole,\n threadedHole,\n faces,\n edges,\n vertices,\n solids,\n workplane,\n center,\n pushPoints,\n moveTo,\n move2D,\n lineTo,\n line,\n vLine,\n hLine,\n vLineTo,\n hLineTo,\n polyline,\n close,\n wire,\n face,\n vertex,\n threePointArc,\n sagittaArc,\n radiusArc,\n tangentArcPoint,\n spline,\n translate,\n rotate,\n mirror,\n faceCompound,\n edgeCompound,\n Location,\n isLocation,\n composeLocations,\n moved,\n move,\n union,\n cut,\n compound,\n intersect,\n combine,\n fillet,\n chamfer,\n shell,\n val,\n vals,\n transformed,\n setColor,\n splineFace,\n helix,\n splitFace,\n twistExtrude,\n solidFromFaces,\n planarCap,\n siblings,\n tag,\n workplaneFromTagged,\n} from './workplane'\nexport type { Workplane as WorkplaneType, RGB, CqLocation, TaggedWorkplane } from './workplane'\n\n// Sketch geometry container (CadQuery Sketch.py parity, non-planegcs part —\n// Phase 2 of the max-cadquery plan; constraints blocked on LGPL verdict).\n// Names carry a `sketch` prefix to avoid clashing with the Workplane ops\n// (rect/circle/val/tag/... are already taken by the workplane layer).\nexport {\n sketch as sketchCreate,\n rect as sketchRect,\n circle as sketchCircle,\n ellipse as sketchEllipse,\n polygon as sketchPolygon,\n regularPolygon as sketchRegularPolygon,\n slot as sketchSlot,\n trapezoid as sketchTrapezoid,\n offset as sketchOffset,\n faces as sketchFaces,\n wires as sketchWires,\n edges as sketchEdges,\n vertices as sketchVertices,\n reset as sketchReset,\n val as sketchVal,\n vals as sketchVals,\n tag as sketchTag,\n select as sketchSelect,\n area as sketchArea,\n faceCount as sketchFaceCount,\n extrude as sketchExtrude,\n dispose as sketchDispose,\n} from './sketch'\nexport type { Sketch, SketchMode, SketchOpts } from './sketch'\n\n// Internal helpers consumed by @faicad/cq-compat-assembly (the assembly layer\n// split into its own package; these workplane-internal symbols are re-exported\n// so the assembly package does not duplicate them).\nexport { asBrepShape, resolveFaceSelector } from './workplane'\n\n// Assembly layer (buildAssembly/constraint/constraintEx/faceRef/pointRef/axisRef/\n// Color + CadQuery solve()/toCompound()/save()) lives in\n// @faicad/cq-compat-assembly. STEP / assembly equivalence comparers (dev-only)\n// live in @faicad/cq-compat-compare.\n\n// Gear primitive layer (raw-handle kernel access for the cq_gears port;\n// see gears.ts header). fai_cq_gears consumes these instead of occt-wasm.\nexport {\n getGearKernel,\n connectEdgesToWires,\n gearFaceFromWires,\n gearShellToSolid,\n gearEdgeEnds,\n buildGearSplineFace,\n soleGearFace,\n gearDistanceToFace,\n gearFaceDeviation,\n DEFAULT_GEAR_SPLINE_FACE_STRATEGY,\n GEAR_SPLINE_FACE_STRATEGIES,\n} from './gears'\nexport type {\n GearKernel,\n GearAxis,\n GearEdgeEnds,\n GearSplineFaceStrategy,\n GearSplineFaceOptions,\n GearSplineGrid,\n GearDeviationStats,\n} from './gears'\nexport type { Vec3 } from './geom-types'\n"]}
|
package/dist/sketch.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sketch — CadQuery `Sketch.py` geometry-container parity (non-planegcs part).
|
|
3
|
+
*
|
|
4
|
+
* Phase 2 of the cq-compat max-cadquery plan: expose a public Sketch API whose
|
|
5
|
+
* geometry-declaration segment (rect/circle/ellipse/polygon + modes a/s/i/c/r +
|
|
6
|
+
* faces/wires/edges/vertices selectors) mirrors upstream `Sketch.py` without the
|
|
7
|
+
* constraint solver (planegcs licensing is pending legal review; constraints are
|
|
8
|
+
* intentionally out of scope here).
|
|
9
|
+
*
|
|
10
|
+
* The constraint segment (`constrain`/`solve`) stays blocked until the
|
|
11
|
+
* LGPL-2.0-or-later verdict; this module implements everything that does not
|
|
12
|
+
* depend on it.
|
|
13
|
+
*
|
|
14
|
+
* Faces are OCCT brep faces living in the z=0 plane (kernel `makeRectangle`,
|
|
15
|
+
* `makeCircleEdge`/`makeWire`/`makeFace`, ...). Boolean modes use the kernel's
|
|
16
|
+
* face-level fuse/cut/common (verified working on faces, see probe_2d).
|
|
17
|
+
*/
|
|
18
|
+
import type { ShapeHandle } from 'occt-wasm';
|
|
19
|
+
/** Sketch face-container state. */
|
|
20
|
+
export interface Sketch {
|
|
21
|
+
/** Current effective faces (upstream `_faces`). */
|
|
22
|
+
faces: ShapeHandle[];
|
|
23
|
+
/** Construction faces stored under their tag (mode "c"). */
|
|
24
|
+
tags: Map<string, ShapeHandle[]>;
|
|
25
|
+
/** Selected entities (faces/wires/edges/vertices) feeding the next each(). */
|
|
26
|
+
selected: ShapeHandle[];
|
|
27
|
+
/** Pushed iteration locations (push/selection-derived). */
|
|
28
|
+
locs: Array<[number, number]>;
|
|
29
|
+
}
|
|
30
|
+
/** Sketch geometry-declaration mode (CadQuery Modes): a=additive, s=subtract, i=intersect, c=construction+tag, r=replace. */
|
|
31
|
+
export type SketchMode = 'a' | 's' | 'i' | 'c' | 'r';
|
|
32
|
+
/** Options for a geometry declaration: mode/tag/angle (CadQuery keyword args). */
|
|
33
|
+
export interface SketchOpts {
|
|
34
|
+
mode?: SketchMode;
|
|
35
|
+
tag?: string;
|
|
36
|
+
angle?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create an empty Sketch.
|
|
40
|
+
* @returns an empty Sketch
|
|
41
|
+
*/
|
|
42
|
+
export declare function sketch(): Sketch;
|
|
43
|
+
/**
|
|
44
|
+
* rect — CadQuery `Sketch.rect(w, h, angle, mode, tag)` parity.
|
|
45
|
+
* @param sk - Sketch
|
|
46
|
+
* @param w - width along X
|
|
47
|
+
* @param h - height along Y
|
|
48
|
+
* @param opts - mode/tag/angle
|
|
49
|
+
* @returns Sketch
|
|
50
|
+
*/
|
|
51
|
+
export declare function rect(sk: Sketch, w: number, h: number, opts?: SketchOpts): Sketch;
|
|
52
|
+
/**
|
|
53
|
+
* circle — CadQuery `Sketch.circle(r, mode, tag)` parity.
|
|
54
|
+
* @param sk - Sketch
|
|
55
|
+
* @param r - radius
|
|
56
|
+
* @param opts - mode/tag
|
|
57
|
+
* @returns Sketch
|
|
58
|
+
*/
|
|
59
|
+
export declare function circle(sk: Sketch, r: number, opts?: SketchOpts): Sketch;
|
|
60
|
+
/**
|
|
61
|
+
* ellipse — CadQuery `Sketch.ellipse(a1, a2, angle, mode, tag)` parity.
|
|
62
|
+
* @param sk - Sketch
|
|
63
|
+
* @param a1 - radius along X
|
|
64
|
+
* @param a2 - radius along Y
|
|
65
|
+
* @param opts - mode/tag/angle
|
|
66
|
+
* @returns Sketch
|
|
67
|
+
*/
|
|
68
|
+
export declare function ellipse(sk: Sketch, a1: number, a2: number, opts?: SketchOpts): Sketch;
|
|
69
|
+
/**
|
|
70
|
+
* polygon — CadQuery `Sketch.polygon(pts, angle, mode, tag)` parity.
|
|
71
|
+
* @param sk - Sketch
|
|
72
|
+
* @param pts - closed point list [[x,y],...]
|
|
73
|
+
* @param opts - mode/tag/angle
|
|
74
|
+
* @returns Sketch
|
|
75
|
+
*/
|
|
76
|
+
export declare function polygon(sk: Sketch, pts: Array<[number, number]>, opts?: SketchOpts): Sketch;
|
|
77
|
+
/**
|
|
78
|
+
* regularPolygon — CadQuery `Sketch.regularPolygon(r, n, angle, mode, tag)`
|
|
79
|
+
* parity: n-gon inscribed in radius r, first vertex at the +Y direction.
|
|
80
|
+
* @param sk - Sketch
|
|
81
|
+
* @param r - circumradius
|
|
82
|
+
* @param n - number of sides
|
|
83
|
+
* @param opts - mode/tag/angle
|
|
84
|
+
* @returns Sketch
|
|
85
|
+
*/
|
|
86
|
+
export declare function regularPolygon(sk: Sketch, r: number, n: number, opts?: SketchOpts): Sketch;
|
|
87
|
+
/**
|
|
88
|
+
* slot — CadQuery `Sketch.slot(w, h, angle, mode, tag)` parity: stadium / long
|
|
89
|
+
* slot face of length w and width h, centred at origin.
|
|
90
|
+
* @param sk - Sketch
|
|
91
|
+
* @param w - slot length along X
|
|
92
|
+
* @param h - slot width along Y
|
|
93
|
+
* @param opts - mode/tag/angle
|
|
94
|
+
* @returns Sketch
|
|
95
|
+
*/
|
|
96
|
+
export declare function slot(sk: Sketch, w: number, h: number, opts?: SketchOpts): Sketch;
|
|
97
|
+
/**
|
|
98
|
+
* trapezoid — CadQuery `Sketch.trapezoid(w, h, a1, a2, angle, mode, tag)`
|
|
99
|
+
* parity: isosceles-or-not trapezoid; a1/a2 are the base angles in degrees.
|
|
100
|
+
* @param sk - Sketch
|
|
101
|
+
* @param w - bottom width
|
|
102
|
+
* @param h - height
|
|
103
|
+
* @param a1 - bottom-left base angle (degrees)
|
|
104
|
+
* @param a2 - bottom-right base angle (degrees); defaults to a1
|
|
105
|
+
* @param opts - mode/tag/angle
|
|
106
|
+
* @returns Sketch
|
|
107
|
+
*/
|
|
108
|
+
export declare function trapezoid(sk: Sketch, w: number, h: number, a1: number, a2?: number, opts?: SketchOpts): Sketch;
|
|
109
|
+
/**
|
|
110
|
+
* offset — CadQuery `Sketch.offset(d, mode, tag)` parity: offset each selected
|
|
111
|
+
* wire by d and feed the resulting faces through the given mode. Requires a
|
|
112
|
+
* selection (wires()/edges()).
|
|
113
|
+
* @param sk - Sketch
|
|
114
|
+
* @param d - signed offset distance
|
|
115
|
+
* @param opts - mode/tag
|
|
116
|
+
* @returns Sketch
|
|
117
|
+
*/
|
|
118
|
+
export declare function offset(sk: Sketch, d: number, opts?: SketchOpts): Sketch;
|
|
119
|
+
/**
|
|
120
|
+
* faces — CadQuery `Sketch.faces()` selector parity: select current faces.
|
|
121
|
+
* @param sk - Sketch
|
|
122
|
+
* @returns Sketch (selected faces feed the next geometric declaration)
|
|
123
|
+
*/
|
|
124
|
+
export declare function faces(sk: Sketch): Sketch;
|
|
125
|
+
/**
|
|
126
|
+
* wires — CadQuery `Sketch.wires()` selector parity: select boundary wires of
|
|
127
|
+
* the current faces.
|
|
128
|
+
* @param sk - Sketch
|
|
129
|
+
* @returns Sketch
|
|
130
|
+
*/
|
|
131
|
+
export declare function wires(sk: Sketch): Sketch;
|
|
132
|
+
/**
|
|
133
|
+
* edges — CadQuery `Sketch.edges()` selector parity: select all edges of the
|
|
134
|
+
* current faces.
|
|
135
|
+
* @param sk - Sketch
|
|
136
|
+
* @returns Sketch
|
|
137
|
+
*/
|
|
138
|
+
export declare function edges(sk: Sketch): Sketch;
|
|
139
|
+
/**
|
|
140
|
+
* vertices — CadQuery `Sketch.vertices()` selector parity: select all vertices
|
|
141
|
+
* of the current faces.
|
|
142
|
+
* @param sk - Sketch
|
|
143
|
+
* @returns Sketch
|
|
144
|
+
*/
|
|
145
|
+
export declare function vertices(sk: Sketch): Sketch;
|
|
146
|
+
/**
|
|
147
|
+
* reset — CadQuery `Sketch.reset()` parity: clear the selection so the next
|
|
148
|
+
* geometric declaration applies to the whole sketch.
|
|
149
|
+
* @param sk - Sketch
|
|
150
|
+
* @returns Sketch
|
|
151
|
+
*/
|
|
152
|
+
export declare function reset(sk: Sketch): Sketch;
|
|
153
|
+
/**
|
|
154
|
+
* val — CadQuery `Sketch.val()` parity: first effective face as a Shape.
|
|
155
|
+
* @param sk - Sketch
|
|
156
|
+
* @returns Shape
|
|
157
|
+
*/
|
|
158
|
+
export declare function val(sk: Sketch): ShapeHandle;
|
|
159
|
+
/**
|
|
160
|
+
* vals — CadQuery `Sketch.vals()` parity: the current selection, or the
|
|
161
|
+
* flattened topological faces when nothing is selected (upstream returns the
|
|
162
|
+
* `_faces` faces; a fused handle may hold several).
|
|
163
|
+
* @param sk - Sketch
|
|
164
|
+
* @returns Shape[]
|
|
165
|
+
*/
|
|
166
|
+
export declare function vals(sk: Sketch): ShapeHandle[];
|
|
167
|
+
/**
|
|
168
|
+
* tag — CadQuery `Sketch.tag(name)` parity: store the current selection (or all
|
|
169
|
+
* faces when nothing selected) under a name for later `.select()`.
|
|
170
|
+
* @param sk - Sketch
|
|
171
|
+
* @param name - tag name
|
|
172
|
+
* @returns Sketch
|
|
173
|
+
*/
|
|
174
|
+
export declare function tag(sk: Sketch, name: string): Sketch;
|
|
175
|
+
/**
|
|
176
|
+
* select — CadQuery `Sketch.select(tag)` parity: select the faces stored under
|
|
177
|
+
* a tag.
|
|
178
|
+
* @param sk - Sketch
|
|
179
|
+
* @param name - tag name
|
|
180
|
+
* @returns Sketch
|
|
181
|
+
*/
|
|
182
|
+
export declare function select(sk: Sketch, name: string): Sketch;
|
|
183
|
+
/**
|
|
184
|
+
* area — total surface area of the effective faces (upstream `_faces.Area()`).
|
|
185
|
+
* @param sk - Sketch
|
|
186
|
+
* @returns number
|
|
187
|
+
*/
|
|
188
|
+
export declare function area(sk: Sketch): number;
|
|
189
|
+
/**
|
|
190
|
+
* faceCount — number of effective faces (upstream `_faces.Faces()` length).
|
|
191
|
+
* @param sk - Sketch
|
|
192
|
+
* @returns number
|
|
193
|
+
*/
|
|
194
|
+
export declare function faceCount(sk: Sketch): number;
|
|
195
|
+
/**
|
|
196
|
+
* extrude — CadQuery `Sketch` → solid via extrusion along +Z. Phase 2 action 3:
|
|
197
|
+
* sketch → extrude/revolve dual-chain outlet. This is the brep side
|
|
198
|
+
* (kernel.extrude on each effective face, fused into one solid).
|
|
199
|
+
* @param sk - Sketch
|
|
200
|
+
* @param height - extrusion height
|
|
201
|
+
* @returns Shape (solid)
|
|
202
|
+
*/
|
|
203
|
+
export declare function extrude(sk: Sketch, height: number): ShapeHandle;
|
|
204
|
+
/**
|
|
205
|
+
* Release all handles held by a Sketch (run at end of script/unit test).
|
|
206
|
+
* @param sk - Sketch whose kernel handles are released
|
|
207
|
+
*/
|
|
208
|
+
export declare function dispose(sk: Sketch): void;
|
|
209
|
+
//# sourceMappingURL=sketch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch.d.ts","sourceRoot":"","sources":["../src/sketch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAc,WAAW,EAAQ,MAAM,WAAW,CAAA;AAE9D,mCAAmC;AACnC,MAAM,WAAW,MAAM;IACrB,mDAAmD;IACnD,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,4DAA4D;IAC5D,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;IAChC,8EAA8E;IAC9E,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,2DAA2D;I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