@indispec/fs-compat 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +56 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -13,12 +13,65 @@ not a geometry kernel: translating that tree into exact B-rep is a separate conc
13
13
  > *geometric identity* (same sketch and features producing the same faces as Onshape), is **not
14
14
  > claimed**.
15
15
 
16
+ **Companion:** [`@indispec/cad-kernel`](https://www.npmjs.com/package/@indispec/cad-kernel) turns
17
+ this package's recorded scene into exact OCCT B-rep, metrics and STEP/STL. Pairing the two is the
18
+ supported path — see *Using them together* below.
19
+
16
20
  ## Install
17
21
 
18
22
  ```bash
23
+ # The front end alone: parsing, recording, feature tree, BOM.
19
24
  npm install @indispec/fs-compat
25
+
26
+ # The recommended pairing: recorded scene -> exact B-rep, metrics, STEP/STL.
27
+ npm install @indispec/fs-compat @indispec/cad-kernel
28
+ ```
29
+
30
+ ## Using them together (recommended)
31
+
32
+ This package is the front end: it records what an `.fs` program builds, it does not make faces.
33
+ Exact geometry is the other package's job, and the hand-off is `interp.scene` — a recorded `Scene`
34
+ of typed nodes (`Box`, `Prism`, `Union`, `Moved`, …). No glue code is needed on either side:
35
+
36
+ ```js
37
+ import { runFeature } from '@indispec/fs-compat'
38
+ import { initKernel, translateScene, evaluateBodies, exportSceneStep } from '@indispec/cad-kernel'
39
+
40
+ await initKernel() // OCCT wasm, once per process
41
+ const { interp } = runFeature(source, null, null, { includes }) // record
42
+ const bodies = translateScene(interp.scene) // record -> exact B-rep
43
+ const result = evaluateBodies(bodies, { chordMm: 0.5, angleDeg: 15 }) // exact metrics + display mesh
44
+ result.bodies[0].volumeMm3 // from the B-rep, not the mesh
45
+ const step = await exportSceneStep(bodies) // STEP bytes, millimetres
20
46
  ```
21
47
 
48
+ The two packages are released independently, and the kernel declares the `@indispec/fs-compat` range
49
+ it was built and tested against — so installing the pair is enough, there is no version to pin by
50
+ hand.
51
+
52
+ In a browser module Worker the pairing is **one call, and one package to import**:
53
+ [`@indispec/cad-kernel/browser`](https://www.npmjs.com/package/@indispec/cad-kernel) runs the
54
+ interpreter, translates, measures and tessellates in the worker, and writes STEP/STL there too:
55
+
56
+ ```ts
57
+ import wasmUrl from 'replicad-opencascadejs/wasm?url'
58
+ import { initBrowserKernel, evaluateBrowser } from '@indispec/cad-kernel/browser'
59
+
60
+ await initBrowserKernel({ wasmUrl })
61
+ const result = await evaluateBrowser({ source, includes, overrides: ['plateLen=240mm'], trace: true })
62
+ // result.positions / result.indices are transferable typed arrays
63
+ ```
64
+
65
+ Both hosts take the same document inputs — `source`, `includes`, `featureName`, `sourceName` and
66
+ `overrides` (the Node host through `parseOverrides`) — plus `trace` and `stopAfter` where history or
67
+ a rollback view is wanted, so authored defaults, project value bindings and rollback behave
68
+ identically on a server and in a worker.
69
+
70
+ **When this package alone is the right tool:** syntax checking, parameter binding, a feature tree or
71
+ BOM (`projectFeatureList`, `assemblyBom`), sketch regions, or an editor that renders the trace — any
72
+ use that reads the language and the recording rather than the solid. The first time you need a
73
+ volume, a watertight mesh or a STEP file, add the kernel.
74
+
22
75
  ## Quickstart
23
76
 
24
77
  ```js
@@ -125,8 +178,9 @@ MIT — see [LICENSE](LICENSE).
125
178
 
126
179
  The engine originated in the `featurescript-studio` project (itself split out of `nitrate-producer`)
127
180
  and was extracted into the IndiSpec monorepo. Two deliberate departures from that origin: the
128
- geometry kernel is not included (only the recorded node tree), and the GLSL emitter, clip algebra and
129
- tessellation code are not carried over.
181
+ geometry kernel is not included (only the recorded node tree — pair it with
182
+ [`@indispec/cad-kernel`](https://www.npmjs.com/package/@indispec/cad-kernel) for exact geometry), and
183
+ the GLSL emitter, clip algebra and tessellation code are not carried over.
130
184
 
131
185
  No third-party code is bundled. The FeatureScript standard library is *not* included; when it is
132
186
  vendored it is MIT-licensed (© PTC Inc.) and its notice will ship with it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indispec/fs-compat",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "FeatureScript-compatible lexer, parser, value model and interpreter for a documented language subset.",
5
5
  "license": "MIT",
6
6
  "author": "TheTechCompany",
@@ -46,4 +46,4 @@
46
46
  "test": "node --test test/*.test.mjs",
47
47
  "prepublishOnly": "node --test test/*.test.mjs"
48
48
  }
49
- }
49
+ }