@bitbybit-dev/mcp 1.5.0-rc.0 → 1.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/descriptions.d.ts.map +1 -1
- package/dist/descriptions.js +1 -0
- package/dist/descriptions.js.map +1 -1
- package/dist/guides.generated.js +18 -18
- package/dist/guides.generated.js.map +1 -1
- package/dist/tools/get-guide.js +1 -1
- package/dist/tools/get-guide.js.map +1 -1
- package/package.json +6 -6
- package/server.json +2 -2
- package/src/descriptions.ts +1 -0
- package/src/guides.generated.ts +18 -18
- package/src/tools/get-guide.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bitbybit-dev/mcp: the Bitbybit CAD MCP server
|
|
2
2
|
|
|
3
|
-
An [MCP](https://modelcontextprotocol.io) server that documents the [Bitbybit](https://bitbybit.dev) 3D CAD API for AI coding agents: every function, its parameters, defaults, return type and examples, for the exact version your project uses. Bitbybit has
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server that documents the [Bitbybit](https://bitbybit.dev) 3D CAD API for AI coding agents: every function, its parameters, defaults, return type and examples, for the exact version your project uses. Bitbybit has 2205 functions across three CAD kernels - more than any model holds in memory - so an agent working from memory invents plausible names that do not exist. An agent with this server looks each one up instead, and writes code that compiles the first time.
|
|
4
4
|
|
|
5
5
|
It answers from the API index Bitbybit publishes with every release (`https://git-cdn.bitbybit.dev/v<version>/ai-context/index.json`), never from memory, and never from a moving "latest".
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,UAAU,uGAAwG,CAAC;AAEhI,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAIvD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA6C3F,CAAC;AAEF,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,UAAU,uGAAwG,CAAC;AAEhI,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAIvD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA6C3F,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAQ0H,CAAC"}
|
package/dist/descriptions.js
CHANGED
|
@@ -44,6 +44,7 @@ export const DESCRIPTIONS = {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
export const SERVER_INSTRUCTIONS = "This is the Bitbybit CAD MCP: it documents the Bitbybit 3D CAD API (OpenCascade, JSCAD and Manifold kernels, with Babylon.js, three.js and PlayCanvas renderers, and the IFC library for building models) for one exact version. " +
|
|
47
|
+
"The version it documents is in this server's info and in every answer's metadata. Before relying on an answer, check which @bitbybit-dev version the project has installed (its package.json or lockfile); when it differs, pass that version as `version` to search_api, describe, list_namespace and get_examples, so the code you write uses only what that version has. " +
|
|
47
48
|
"Always describe a member before using it: names, parameters and defaults come from the index, not from memory. " +
|
|
48
49
|
"Tiers matter: oss members are in the MIT npm packages and run anywhere; platform-pro members exist only inside bitbybit.dev; cloud-pro members run only on Bitbybit CAD Cloud with an API key. " +
|
|
49
50
|
"When asked where geometry should run, read get_guide(\"integrate\") first: the packages alone are the default, and CAD Cloud is the answer only for algorithms that exist only there or for compute the caller cannot provide. " +
|
package/dist/descriptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAIhI,MAAM,CAAC,MAAM,YAAY,GAAmC;IACxD,GAAG,EAAE,yFAAyF;IAC9F,cAAc,EAAE,iEAAiE;IACjF,WAAW,EAAE,kEAAkE;CAClF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAuE;IAC5F,UAAU,EAAE;QACR,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACP,gIAAgI;YAChI,sIAAsI;YACtI,oGAAoG;KAC3G;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACP,yJAAyJ;YACzJ,oHAAoH;YACpH,qKAAqK;YACrK,wGAAwG;KAC/G;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACP,mJAAmJ;YACnJ,8DAA8D;KACrE;IACD,YAAY,EAAE;QACV,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACP,8KAA8K;YAC9K,4DAA4D;KACnE;IACD,SAAS,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACP,qhBAAqhB;YACrhB,yOAAyO;YACzO,uIAAuI;KAC9I;IACD,MAAM,EAAE;QACJ,KAAK,E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AAgJ;KACvJ;IACD,KAAK,EAAE;QACH,KAAK,EAAE,OAAO;QACd,WAAW,EACP,+IAA+I;KACtJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAC5B,mOAAmO;IACnO,8WAA8W;IAC9W,iHAAiH;IACjH,iMAAiM;IACjM,iOAAiO;IACjO,4KAA4K;IAC5K,8IAA8I;IAC9I,sJAAsJ,CAAC"}
|
package/dist/guides.generated.js
CHANGED
|
@@ -10,7 +10,7 @@ export const GUIDES = [
|
|
|
10
10
|
"id": "what-we-believe",
|
|
11
11
|
"title": "What we believe",
|
|
12
12
|
"level": 2,
|
|
13
|
-
"body": "Agents write the code. Bitbybit provides verified geometry algorithms and, where it is needed, hosted compute. The
|
|
13
|
+
"body": "Agents write the code. Bitbybit provides verified geometry algorithms and, where it is needed, hosted compute. The free packages are the vocabulary that everyone learns, human or agent: one dotted API (`bitbybit.occt.shapes.solid.createBox`, `bitbybit.manifold.booleans.union`, ...) that reads the same in a browser, on a server and in the online editors.\n\nAn agent that knows the API from memory guesses. An agent that looks it up gets the exact signature, defaults and examples for the version your project has installed. That lookup is what the MCP server is for.",
|
|
14
14
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -24,14 +24,14 @@ export const GUIDES = [
|
|
|
24
24
|
"id": "how-an-agent-should-integrate-bitbybit",
|
|
25
25
|
"title": "How an agent should integrate Bitbybit",
|
|
26
26
|
"level": 2,
|
|
27
|
-
"body": "```mermaid\n%%{init: {\"flowchart\": {\"wrappingWidth\": 420}}}%%\nflowchart TD\n Q1{\"Can your users' browsers or<br/>your own Node servers run the kernels?\"}\n Q2{\"Do you need a Pro algorithm,<br/>or a backend that cannot host a kernel?\"}\n P[\"The npm packages, in the browser or in Node.<br/>Free, and
|
|
27
|
+
"body": "```mermaid\n%%{init: {\"flowchart\": {\"wrappingWidth\": 420}}}%%\nflowchart TD\n Q1{\"Can your users' browsers or<br/>your own Node servers run the kernels?\"}\n Q2{\"Do you need a Pro algorithm,<br/>or a backend that cannot host a kernel?\"}\n P[\"The npm packages, in the browser or in Node.<br/>Free, and no service of ours in the loop.\"]\n C[\"CAD Cloud: one pipeline per model from your backend,<br/>or the CAD Cloud MCP when an agent does the work.\"]\n Q1 -->|yes| Q2\n Q1 -->|no: edge or serverless| C\n Q2 -->|no| P\n Q2 -->|yes| C\n```\n\n### The honest default\n\nIf public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and no service of ours sits in the loop. Start there, and move a step only for a reason named below.\n\n### Browser apps\n\nUse the packages, or the runner bundle for a page that only needs a script. The kernels run inside the tab: the user's device does the work, results appear without a network round trip, and your geometry logic ships with your app. This is how the Bitbybit editors themselves work. A model that takes seconds on a laptop is fine here; a model that takes minutes is not, and belongs on a server.\n\n### Lightweight backends\n\nCloudflare Workers, serverless functions and edge runtimes do not have the memory or the CPU time to run the CAD kernels. Do not try. Call CAD Cloud instead, with one pipeline per model so a request is one round trip, keep the API key in the backend and never in the client, and cache results by their input parameters, because identical inputs always produce identical geometry.\n\n### Node servers with headroom\n\nA Node server can run the packages in-process; `@bitbybit-dev/occt` loads the same kernel a browser does. That is the right choice for moderate load and for logic you want to keep private on your own machines. Move to CAD Cloud when you need scale without managing kernels, when you need a Pro algorithm, or when you convert files at volume and would rather not run that work yourself.\n\n### Inside the Bitbybit editors\n\nScripts written in the editors at bitbybit.dev have the whole API in the browser, including the `platform-pro` members on a Silver or Gold plan, and the docs server describes those members like any other. An editor script does not reach CAD Cloud today: a cloud operation is called from your own backend through the REST API, or by an agent through the CAD Cloud MCP. Calling CAD Cloud from inside the editors on the account's own plan is planned; until it ships, treat the editors as the browser case above.\n\n### What runs where\n\n| Question | Packages in the browser | Packages in Node | CAD Cloud |\n|---|---|---|---|\n| Whose compute | your users' devices, free | your servers | Bitbybit's servers, metered |\n| Memory and CPU | the tab's limits | your machine's | sized per plan |\n| Latency | none beyond the computation | none beyond the computation | one HTTPS round trip plus queueing |\n| Concurrency | one user per tab | what you provision | per plan |\n| Privacy of your logic | ships to the client | stays on your servers | stays in your backend; the geometry passes through Bitbybit |\n| Pro algorithms | no | no | yes |\n\nThe only work that must run on Bitbybit's servers is a Pro algorithm, or compute you cannot provide.",
|
|
28
28
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"id": "the-honest-default",
|
|
32
32
|
"title": "The honest default",
|
|
33
33
|
"level": 3,
|
|
34
|
-
"body": "If public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and
|
|
34
|
+
"body": "If public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and no service of ours sits in the loop. Start there, and move a step only for a reason named below.",
|
|
35
35
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
@@ -122,14 +122,14 @@ export const GUIDES = [
|
|
|
122
122
|
"id": "two-ways-to-call-a-kernel",
|
|
123
123
|
"title": "Two ways to call a kernel",
|
|
124
124
|
"level": 2,
|
|
125
|
-
"body": "The methods have the same paths and the same inputs everywhere. What differs is how they answer.\n\n- **In the browser, through the renderer packages, and in scripts in the Bitbybit editors**, each kernel runs in a web worker as `bitbybit.occt`, `bitbybit.manifold` and `bitbybit.jscad`. Every call is asynchronous, and a shape is a small handle, `{ hash, type }`, to the shape the worker holds. Pass it to the next call; it cannot be read or changed.\n\n ```typescript\n const box = await bitbybit.occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 2 });\n ```\n\n- **In Node, with the package alone**, the kernel runs in the process and its methods are synchronous:\n\n ```typescript\n import initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\n import { OCCTService
|
|
125
|
+
"body": "The methods have the same paths and the same inputs everywhere. What differs is how they answer.\n\n- **In the browser, through the renderer packages, and in scripts in the Bitbybit editors**, each kernel runs in a web worker as `bitbybit.occt`, `bitbybit.manifold` and `bitbybit.jscad`. Every call is asynchronous, and a shape is a small handle, `{ hash, type }`, to the shape the worker holds. Pass it to the next call; it cannot be read or changed.\n\n ```typescript\n const box = await bitbybit.occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 2 });\n ```\n\n- **In Node, with the package alone**, the kernel runs in the process and its methods are synchronous:\n\n ```typescript\n import initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\n import { OCCTService } from \"@bitbybit-dev/occt\";\n\n const occ = await initOpenCascade({ print: () => undefined });\n const occt = new OCCTService(occ);\n const box = occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n ```\n\n `print` keeps the kernel's progress lines, such as a STEP writer's statistics, off the console. Run the TypeScript with `tsx` (`npx tsx part.ts`): the package's own imports leave out file extensions, as bundlers expect, so plain `node` cannot load them.\n\nWrite geometry so it runs both ways: `await` every call, as the projects `npm init @bitbybit-dev/app` creates do. Their `src/model.ts` holds a `buildModel(occt, params)` that the page calls with `bitbybit.occt` and the Node smoke test calls with the in-process service, typed as the worker's API through one cast.\n\nA few members differ between the two. Only the worker has `occt.deleteShape`, `occt.deleteShapes` and `occt.cleanAllCache`, which free the shapes it holds; in Node a shape is freed with its own `.delete()`. Through the worker `io.saveShapeSTEP` starts a browser download and `io.saveShapeSTEPAndReturn` returns the text; in Node `io.saveShapeSTEP` returns the text, so call it on the service itself rather than through code typed as the worker's API, which sees it return nothing. The worker also remembers results: the same call with the same inputs gives back the same handle without running again.\n\n`describe` shows the worker form, `createBox(inputs: Inputs.OCCT.BoxDto): Promise<Inputs.OCCT.TopoDSSolidPointer>`; in Node the same method returns the shape itself. A method's answer also names the types it returns, such as `Models.OCCT.SolidDebugInfo` for `occt.shapes.solid.debugInfo`; `describe` with that name lists their fields.",
|
|
126
126
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
|
-
"id": "how-the-occt-kernel-thinks",
|
|
130
|
-
"title": "How the OCCT
|
|
129
|
+
"id": "how-the-bitbybit-occt-kernel-thinks",
|
|
130
|
+
"title": "How the Bitbybit OCCT Kernel thinks",
|
|
131
131
|
"level": 2,
|
|
132
|
-
"body": "- **Y is up.** The ground is the XZ plane. A box's `height` runs along Y, a cylinder grows along its `direction`, `[0, 1, 0]` unless given, and a rectangle or circle wire lies flat on the ground unless its `direction`, the normal of its plane, says otherwise. Manifold and JSCAD build along Z instead: their cylinders stand on the XY plane.\n- **Shapes nest.** A vertex is a point, an edge a curve between vertices, a wire a chain of edges, a face a surface bounded by wires, a shell faces joined at their edges, a solid the volume a closed shell bounds, and a compound a group of shapes kept apart. Each method says which kinds it takes and gives: `operations.extrude` turns a face into a solid, but a wire only into a shell.\n- **Units are plain numbers.**
|
|
132
|
+
"body": "- **Y is up.** The ground is the XZ plane. A box's `height` runs along Y, a cylinder grows along its `direction`, `[0, 1, 0]` unless given, and a rectangle or circle wire lies flat on the ground unless its `direction`, the normal of its plane, says otherwise. Manifold and JSCAD build along Z instead: their cylinders stand on the XY plane.\n- **Shapes nest.** A vertex is a point, an edge a curve between vertices, a wire a chain of edges, a face a surface bounded by wires, a shell faces joined at their edges, a solid the volume a closed shell bounds, and a compound a group of shapes kept apart. Each method says which kinds it takes and gives: `operations.extrude` turns a face into a solid, but a wire only into a shell.\n- **Units are plain numbers.** Model in whichever unit the part is drawn in; angles are degrees, and tolerances are in the model's units. A file says its unit only when told it: give `io.saveShapeSTEP` the `unit` the part is modelled in (`Bit.Inputs.Base.unitOfLengthEnum.inch`, say) and it is written at its true size, in millimetres; `io.loadSTEPorIGES` takes the `unit` to bring a file in at, and `io.fileLengthUnit` tells the unit a STEP or IGES file states.\n- **Right-handed.** OpenCascade is right-handed, as three.js and PlayCanvas are. A Babylon.js scene is left-handed, and shows every part mirrored, unless `scene.useRightHandedSystem` is set when it is created.\n- **Colours** are hex strings such as `\"#ff8000\"`, or arrays of three numbers from 0 to 1.",
|
|
133
133
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
134
134
|
},
|
|
135
135
|
{
|
|
@@ -143,7 +143,7 @@ export const GUIDES = [
|
|
|
143
143
|
"id": "a-part-to-start-from",
|
|
144
144
|
"title": "A part to start from",
|
|
145
145
|
"level": 2,
|
|
146
|
-
"body": "A mounting bracket: a plate with rounded corners, a boss with a bore, a fillet where the boss meets the plate, and four holes. It follows the order above, chooses the edge to fillet by where it is, and runs unchanged in the browser and in Node:\n\n```typescript\nimport type { BitByBitBase, Inputs } from \"@bitbybit-dev/threejs\";\n\ntype Occt = BitByBitBase[\"occt\"];\ntype Shape = Awaited<ReturnType<Occt[\"booleans\"][\"difference\"]>>;\n\nconst PLATE = { width: 80, length: 50, thickness: 8, cornerRadius: 6 };\nconst BOSS = { radius: 12, height: 20, bore: 6 };\nconst HOLE = { radius: 3.5, inset: 10 };\nconst ROOT_FILLET = 3;\nconst TOLERANCE = 1e-6;\nconst UP: Inputs.Base.Vector3 = [0, 1, 0];\n\nfunction isAt(point: Inputs.Base.Point3 | undefined, target: Inputs.Base.Point3): boolean {\n return point !== undefined && Math.hypot(point[0] - target[0], point[1] - target[1], point[2] - target[2]) < TOLERANCE;\n}\n\nexport async function buildBracket(occt: Occt): Promise<Shape> {\n const outline = await occt.shapes.wire.createRectangleWire({ width: PLATE.width, length: PLATE.length, center: [0, 0, 0], direction: UP });\n const rounded = await occt.fillets.fillet2d({ shape: outline, radius: PLATE.cornerRadius });\n const face = await occt.shapes.face.createFaceFromWire({ shape: rounded, planar: true });\n const plate = await occt.operations.extrude({ shape: face, direction: [0, PLATE.thickness, 0] });\n const boss = await occt.shapes.solid.createCylinder({ radius: BOSS.radius, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n const body = await occt.booleans.union({ shapes: [plate, boss] });\n\n const edges = await occt.shapes.edge.getEdges({ shape: body });\n const centers = await occt.shapes.edge.getEdgesCentersOfMass({ shapes: edges });\n const root = edges.filter((_edge, index) => isAt(centers[index], [0, PLATE.thickness, 0]));\n const filleted = await occt.fillets.filletEdgesListOneRadius({ shape: body, edges: root, radius: ROOT_FILLET });\n\n const x = PLATE.width / 2 - HOLE.inset;\n const z = PLATE.length / 2 - HOLE.inset;\n const corners: Inputs.Base.Point3[] = [[x, 0, z], [-x, 0, z], [-x, 0, -z], [x, 0, -z]];\n const holes = await Promise.all(corners.map((center) => occt.shapes.solid.createCylinder({ radius: HOLE.radius, height: PLATE.thickness, center, direction: UP })));\n const bore = await occt.shapes.solid.createCylinder({ radius: BOSS.bore, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n return occt.booleans.difference({ shape: filleted, shapes: [...holes, bore] });\n}\n```\n\nThe result is a valid solid of 18 faces, 80 by 28 by 50 mm, of about 36,556 mm³. The plate lies on the ground and the boss rises along Y. The only circle centred on the boss's axis at the plate's top is where the boss meets the plate, so that is the edge the fillet rounds, whatever number the kernel gave it. In a scaffolded project the function goes into `src/model.ts`, whose `Occt` and `Shape` types are the same; in a script in the editors, make the same calls on `bitbybit.occt`. In Node, hand it the in-process service through one cast and write a STEP file standing upright for a Z-up CAD tool:\n\n```typescript\nimport { writeFileSync } from \"node:fs\";\nimport initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\nimport { OCCTService
|
|
146
|
+
"body": "A mounting bracket: a plate with rounded corners, a boss with a bore, a fillet where the boss meets the plate, and four holes. It follows the order above, chooses the edge to fillet by where it is, and runs unchanged in the browser and in Node:\n\n```typescript\nimport type { BitByBitBase, Inputs } from \"@bitbybit-dev/threejs\";\n\ntype Occt = BitByBitBase[\"occt\"];\ntype Shape = Awaited<ReturnType<Occt[\"booleans\"][\"difference\"]>>;\n\nconst PLATE = { width: 80, length: 50, thickness: 8, cornerRadius: 6 };\nconst BOSS = { radius: 12, height: 20, bore: 6 };\nconst HOLE = { radius: 3.5, inset: 10 };\nconst ROOT_FILLET = 3;\nconst TOLERANCE = 1e-6;\nconst UP: Inputs.Base.Vector3 = [0, 1, 0];\n\nfunction isAt(point: Inputs.Base.Point3 | undefined, target: Inputs.Base.Point3): boolean {\n return point !== undefined && Math.hypot(point[0] - target[0], point[1] - target[1], point[2] - target[2]) < TOLERANCE;\n}\n\nexport async function buildBracket(occt: Occt): Promise<Shape> {\n const outline = await occt.shapes.wire.createRectangleWire({ width: PLATE.width, length: PLATE.length, center: [0, 0, 0], direction: UP });\n const rounded = await occt.fillets.fillet2d({ shape: outline, radius: PLATE.cornerRadius });\n const face = await occt.shapes.face.createFaceFromWire({ shape: rounded, planar: true });\n const plate = await occt.operations.extrude({ shape: face, direction: [0, PLATE.thickness, 0] });\n const boss = await occt.shapes.solid.createCylinder({ radius: BOSS.radius, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n const body = await occt.booleans.union({ shapes: [plate, boss] });\n\n const edges = await occt.shapes.edge.getEdges({ shape: body });\n const centers = await occt.shapes.edge.getEdgesCentersOfMass({ shapes: edges });\n const root = edges.filter((_edge, index) => isAt(centers[index], [0, PLATE.thickness, 0]));\n const filleted = await occt.fillets.filletEdgesListOneRadius({ shape: body, edges: root, radius: ROOT_FILLET });\n\n const x = PLATE.width / 2 - HOLE.inset;\n const z = PLATE.length / 2 - HOLE.inset;\n const corners: Inputs.Base.Point3[] = [[x, 0, z], [-x, 0, z], [-x, 0, -z], [x, 0, -z]];\n const holes = await Promise.all(corners.map((center) => occt.shapes.solid.createCylinder({ radius: HOLE.radius, height: PLATE.thickness, center, direction: UP })));\n const bore = await occt.shapes.solid.createCylinder({ radius: BOSS.bore, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n return occt.booleans.difference({ shape: filleted, shapes: [...holes, bore] });\n}\n```\n\nThe result is a valid solid of 18 faces, 80 by 28 by 50 mm, of about 36,556 mm³. The plate lies on the ground and the boss rises along Y. The only circle centred on the boss's axis at the plate's top is where the boss meets the plate, so that is the edge the fillet rounds, whatever number the kernel gave it. In a scaffolded project the function goes into `src/model.ts`, whose `Occt` and `Shape` types are the same; in a script in the editors, make the same calls on `bitbybit.occt`. In Node, hand it the in-process service through one cast and write a STEP file standing upright for a Z-up CAD tool:\n\n```typescript\nimport { writeFileSync } from \"node:fs\";\nimport initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\nimport { OCCTService } from \"@bitbybit-dev/occt\";\nimport { buildBracket } from \"./bracket.ts\";\n\ntype Occt = Parameters<typeof buildBracket>[0];\ntype KernelShape = Parameters<OCCTService[\"io\"][\"saveShapeSTEP\"]>[0][\"shape\"];\n\nfunction asWorkerApi(service: object): Occt {\n return service as Occt;\n}\n\nfunction asKernelShape(shape: object): KernelShape {\n return shape as KernelShape;\n}\n\nconst occ = await initOpenCascade({ print: () => undefined });\nconst service = new OCCTService(occ);\nconst bracket = asKernelShape(await buildBracket(asWorkerApi(service)));\nconst upright = service.transforms.rotate({ shape: bracket, axis: [1, 0, 0], angle: 90 });\nwriteFileSync(\"bracket.step\", service.io.saveShapeSTEP({ shape: upright, fileName: \"bracket.step\" }));\n```",
|
|
147
147
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
148
148
|
},
|
|
149
149
|
{
|
|
@@ -164,7 +164,7 @@ export const GUIDES = [
|
|
|
164
164
|
"id": "drawing-and-exporting-a-part",
|
|
165
165
|
"title": "Drawing and exporting a part",
|
|
166
166
|
"level": 2,
|
|
167
|
-
"body": "- **Drawing.** In the browser and in the editors, `draw.drawAnyAsync({ entity: shape, options })` draws any shape, mesh or point list; for OpenCascade shapes `options` is an `Inputs.Draw.DrawOcctShapeOptions`, with `faceColour`, `edgeColour`, `edgeWidth` and `precision`, the meshing tolerance. Draw the finished part rather than every step.\n- **STEP**, the exact format other CAD tools open: `io.saveShapeSTEPAndReturn` through the worker, `io.saveShapeSTEP` on the in-process service in Node, both giving the file's text in millimetres. Most CAD tools are Z-up: turn the part first with `transforms.rotate({ shape, axis: [1, 0, 0], angle: 90 })`, which takes Y up to Z and keeps the part as it was built. The `adjustYtoZ` option swaps Y and Z instead, which mirrors the part: it matches what a left-handed Babylon.js scene shows.\n- **STL** for printing: `io.saveShapeStlAndReturn` through the worker, `io.saveShapeStl` in Node, with `precision` as the meshing tolerance and `binary` for the smaller form. Turn the part as for STEP.\n- **Drawings and assemblies.** `io.shapeToDxfPaths` and `io.dxfCreate` write a DXF of flat geometry, and the documents of `occt.assembly.manager` hold several parts with names, colours and placements, written to one STEP file with `occt.assembly.manager.exportDocumentToStep`.",
|
|
167
|
+
"body": "- **Drawing.** In the browser and in the editors, `draw.drawAnyAsync({ entity: shape, options })` draws any shape, mesh or point list; for OpenCascade shapes `options` is an `Inputs.Draw.DrawOcctShapeOptions`, with `faceColour`, `edgeColour`, `edgeWidth` and `precision`, the meshing tolerance. Draw the finished part rather than every step.\n- **STEP**, the exact format other CAD tools open: `io.saveShapeSTEPAndReturn` through the worker, `io.saveShapeSTEP` on the in-process service in Node, both giving the file's text in millimetres, the shape scaled from the `unit` it is modelled in when one is given. Most CAD tools are Z-up: turn the part first with `transforms.rotate({ shape, axis: [1, 0, 0], angle: 90 })`, which takes Y up to Z and keeps the part as it was built. The `adjustYtoZ` option swaps Y and Z instead, which mirrors the part: it matches what a left-handed Babylon.js scene shows.\n- **STL** for printing: `io.saveShapeStlAndReturn` through the worker, `io.saveShapeStl` in Node, with `precision` as the meshing tolerance and `binary` for the smaller form. Turn the part as for STEP.\n- **Drawings and assemblies.** `io.shapeToDxfPaths` and `io.dxfCreate` write a DXF of flat geometry, and the documents of `occt.assembly.manager` hold several parts with names, colours and placements, written to one STEP file with `occt.assembly.manager.exportDocumentToStep`.",
|
|
168
168
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
169
169
|
},
|
|
170
170
|
{
|
|
@@ -199,7 +199,7 @@ export const GUIDES = [
|
|
|
199
199
|
"id": "a-first-document",
|
|
200
200
|
"title": "A first document",
|
|
201
201
|
"level": 2,
|
|
202
|
-
"body": "A plate with two holes and rounded top edges, made of aluminium, with a part number written from its size:\n\n```json title=\"bracket.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.
|
|
202
|
+
"body": "A plate with two holes and rounded top edges, made of aluminium, with a part number written from its size:\n\n```json title=\"bracket.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.6.0-rc.0/schemas/design-document/experimental.json\",\n \"schemaVersion\": 1,\n \"id\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\",\n \"meta\": { \"name\": \"Bracket\" },\n \"parameters\": {\n \"width\": { \"value\": 60, \"min\": 30, \"unit\": \"mm\" },\n \"depth\": { \"value\": 40, \"min\": 20, \"unit\": \"mm\" },\n \"thickness\": { \"value\": 6, \"min\": 2, \"unit\": \"mm\" },\n \"hole\": { \"value\": 6, \"min\": 2, \"max\": 12, \"unit\": \"mm\" }\n },\n \"features\": [\n {\n \"id\": \"base\", \"type\": \"sketch\", \"on\": { \"plane\": \"XY\" }, \"start\": [0, 0],\n \"pen\": [\n { \"type\": \"hLine\", \"id\": \"south\", \"length\": \"width\" },\n { \"type\": \"vLine\", \"id\": \"east\", \"length\": \"depth\" },\n { \"type\": \"hLine\", \"id\": \"north\", \"length\": \"-width\" },\n { \"type\": \"close\", \"id\": \"west\" }\n ]\n },\n { \"id\": \"plate\", \"type\": \"extrude\", \"profile\": \"base\", \"distance\": \"thickness\" },\n {\n \"id\": \"holes\", \"type\": \"hole\", \"body\": \"plate\",\n \"on\": { \"of\": \"plate\", \"role\": \"end\", \"count\": 1 },\n \"at\": [{ \"id\": \"left\", \"x\": 10, \"y\": \"depth / 2\" }, { \"id\": \"right\", \"x\": \"width - 10\", \"y\": \"depth / 2\" }],\n \"diameter\": \"hole\"\n },\n {\n \"id\": \"round\", \"type\": \"fillet\", \"body\": \"plate\", \"radius\": 2,\n \"edges\": { \"between\": [{ \"of\": \"plate\", \"role\": \"end\" }, { \"of\": \"plate\", \"role\": \"side\" }], \"count\": 4 }\n }\n ],\n \"materials\": [\n { \"id\": \"aluminium\", \"density\": 2700, \"appearance\": { \"color\": \"#b0b4b8\", \"metallic\": 0.8, \"roughness\": 0.4 } }\n ],\n \"parts\": [\n {\n \"id\": \"bracket\", \"name\": \"Bracket\", \"body\": \"plate\", \"material\": \"aluminium\",\n \"properties\": { \"partNumber\": \"BRK-{width}x{depth}\" },\n \"connectors\": [\n { \"id\": \"pivotTop\", \"on\": { \"of\": \"plate\", \"role\": \"end\", \"count\": 1 }, \"axis\": { \"of\": \"holes\", \"role\": \"wall\", \"from\": \"left\" } },\n { \"id\": \"pivotBottom\", \"on\": { \"of\": \"plate\", \"role\": \"start\", \"count\": 1 }, \"axis\": { \"of\": \"holes\", \"role\": \"wall\", \"from\": \"left\" } }\n ]\n }\n ]\n}\n```\n\n- The sketch draws a rectangle with a pen: each command moves from where the last one ended, and `close` returns to `start`. The command ids name the four side faces the extrude sweeps from them.\n- The extrude starts a body named `plate`. Its bottom face is `start`, its top `end` and its walls `side`.\n- The holes are placed on the face the reference `{ \"of\": \"plate\", \"role\": \"end\", \"count\": 1 }` names, at x and y on that face. Each position has an id, so a later reference can name one hole's wall.\n- The fillet rounds the edges between the top and the walls: exactly 4, or the build reports otherwise.\n- The connectors are frames where an assembly fastens the part: on the top and the bottom face, at the left hole's axis.",
|
|
203
203
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
204
204
|
},
|
|
205
205
|
{
|
|
@@ -213,14 +213,14 @@ export const GUIDES = [
|
|
|
213
213
|
"id": "sketches",
|
|
214
214
|
"title": "Sketches",
|
|
215
215
|
"level": 2,
|
|
216
|
-
"body": "- `on` places the sketch: `{ \"plane\": \"XY\" }` (or `XZ`, `YZ`, with an `offset`), `{ \"frame\": { \"origin\", \"normal\", \"direction\" } }`, or `{ \"face\": <face reference>, \"origin\": [...], \"direction\": [...] }` on a flat face of a body. A sketch on a face follows the face when parameters move it.\n- `pen` draws one outline from `start`: `line` (to a point), `hLine` and `vLine` (a length along x or y, negative for the other way), `polarLine`, `tangentLine`, `threePointArc`, `tangentArc`, `sagittaArc`, `bulgeArc`, `quadratic`, `cubic`, `close`, and `filletCorner` and `chamferCorner`, which round or bevel the corner between the commands before and after them.\n- A sketch with no `pen` and no `loops` draws nothing yet: it is only its plane, which an editor draws on, and a feature that uses it fails until it draws something.\n- An outline that ends with `close`, or back at its `start`, is closed, and a closed outline is a face. `\"face\": false` keeps it a wire, such as a closed path to sweep along; an open outline is always a wire.\n- `circle` draws an exact circle as one closed edge: `{ \"type\": \"circle\", \"id\": \"bore\", \"centre\": [0, 0], \"radius\": 5 }`.\n- `loops` draws several outlines in one sketch, the first the outside and each further one a hole in it, so one sketch makes a washer: `\"loops\": [{ \"start\": [-15, -15], \"pen\": [...] }, { \"pen\": [{ \"type\": \"circle\", ... }] }]`.\n- **Give an id to every command a later feature refers to.** A side face is named after the command it was swept from; a command without an id has no name a reference can use.",
|
|
216
|
+
"body": "- `on` places the sketch: `{ \"plane\": \"XY\" }` (or `XZ`, `YZ`, with an `offset`), `{ \"frame\": { \"origin\", \"normal\", \"direction\" } }`, or `{ \"face\": <face reference>, \"origin\": [...], \"direction\": [...] }` on a flat face of a body. A sketch on a face follows the face when parameters move it.\n- `pen` draws one outline from `start`: `line` (to a point), `hLine` and `vLine` (a length along x or y, negative for the other way), `polarLine`, `tangentLine`, `threePointArc`, `tangentArc`, `sagittaArc`, `bulgeArc`, `quadratic`, `cubic`, `close`, and `filletCorner` and `chamferCorner`, which round or bevel the corner between the commands before and after them.\n- A sketch with no `pen` and no `loops` draws nothing yet: it is only its plane, which an editor draws on, and a feature that uses it fails until it draws something.\n- An outline that ends with `close`, or back at its `start`, is closed, and a closed outline is a face. `\"face\": false` keeps it a wire, such as a closed path to sweep along; an open outline is always a wire.\n- `circle` draws an exact circle as one closed edge: `{ \"type\": \"circle\", \"id\": \"bore\", \"centre\": [0, 0], \"radius\": 5 }`.\n- `gear` draws an involute spur gear's outline as `occt.parts.mechanical.gears.spurGearProfile` does: `{ \"type\": \"gear\", \"id\": \"teeth\", \"centre\": [0, 0], \"module\": 2, \"teeth\": 24 }`, with `pressureAngle`, `profileShift`, `backlash`, `addendum`, `dedendum`, `rootFillet` and `rotation` (in degrees) when the defaults do not fit. Like a circle it is a loop by itself. Its side faces are named by its id and their part: `\"from\": \"profile.teeth.tip\"`, `\"profile.teeth.flank\"` or `\"profile.teeth.root\"`. Two gears mesh when they share `module` and `pressureAngle` and stand `module * (teeth + otherTeeth) / 2` apart. With `\"internal\": true` it draws the teeth of a ring gear instead, pointing in toward `centre` as `occt.parts.mechanical.gears.ringGearProfile` draws them, so it belongs in a hole loop inside a larger circle; a ring takes no `profileShift`, needs about 34 teeth or more at 20 degrees, and holds a gear `module * (teeth - otherTeeth) / 2` from its centre.\n- `rack` draws an involute rack as `occt.parts.mechanical.gears.rackProfile` does: `{ \"type\": \"rack\", \"id\": \"rack\", \"start\": [0, 0], \"module\": 2, \"teeth\": 12, \"height\": 6 }`, with `angle` (in degrees, turning it from running along +x), `pressureAngle`, `backlash`, `addendum`, `dedendum` and `rootFillet` when the defaults do not fit. `start` is where the first tooth's middle sits on the pitch line, and the teeth point to the left of the rack's run. It is a loop by itself, and its side faces are named by its id and their part: `\"profile.rack.tip\"`, `.flank`, `.root`, `.back` and `.side` (its two ends). A gear of the same module meshes with its centre `module * teeth / 2` from the pitch line, and turning it by `a` degrees moves the rack `pi * module * teeth / 2 * a / 180`.\n- `loops` draws several outlines in one sketch, the first the outside and each further one a hole in it, so one sketch makes a washer: `\"loops\": [{ \"start\": [-15, -15], \"pen\": [...] }, { \"pen\": [{ \"type\": \"circle\", ... }] }]`.\n- **Give an id to every command a later feature refers to.** A side face is named after the command it was swept from; a command without an id has no name a reference can use.",
|
|
217
217
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
220
|
"id": "features",
|
|
221
221
|
"title": "Features",
|
|
222
222
|
"level": 2,
|
|
223
|
-
"body": "| Feature | What it does | Faces it names |\n|---|---|---|\n| `extrude` | sweeps a sketch `distance` along its normal | `start`, `end`, `side` (per command) |\n| `revolve` | turns a sketch about an `axis` | `start`, `end`, `side` |\n| `sweep` | sweeps a profile along a `path` sketch | `start`, `end`, `side` |\n| `loft` | skins two or more sketches in order | `start`, `end`, `side` |\n| `boolean` | `union`, `difference` or `intersection` of `body` with `tools` | `new` for faces no input had |\n| `fillet` | rounds the `edges` a reference names | `round` |\n| `chamfer` | bevels them | `bevel` |\n| `shell` | hollows a body, leaving the `open` faces open, including bodies rounded all round when the open faces are flat | `rim`, `inner` |\n| `hole` | drills holes `at` positions on a face, with counterbores or countersinks | `wall` (per position id) |\n| `boss` | raises a sketch on a face | `side`, `end` |\n| `pocket` | sinks a sketch into a face, a `distance`, `until` a face or `through` | `side`, `end` |\n| `linearPattern`, `polarPattern` | repeats a body `count` times | copies picked with `copy` |\n| `mirror` | mirrors a body across a plane | the image is copy 1 |\n| `pushPull` | moves a face of a body along its normal: out when `distance` is above 0, in when below; `mode` `extrude`, the default, sweeps one flat face straight and adds or cuts the swept solid, `offset` moves the faces themselves, flat or curved, the faces around them stretching to follow, and with a `count` the reference may name several faces | `end` (the moved faces, which keep their names), `side` (the faces an extrude sweeps out) |\n| `removeFaces` | removes the `count` faces a reference names and closes the gap from the faces around them: a hole's wall fills the hole, a round sharpens its edge | keeps every name the faces that stay had |\n| `transform` | moves a body: turns it `rotate` degrees about X, Y and Z through a `pivot`, then shifts it by `translate` | keeps every name it had |\n| `import` | starts a body from a STEP, IGES or BREP asset pinned by its SHA-256 | `face` (per index) |\n| `operation` | calls any method of the package by its path, such as `\"occt.shapes.shape.unifySameDomain\"` | carried through history, otherwise `face` |\n| `script` | runs code from an asset pinned by its SHA-256, outside the kernel, on bodies, references and values | the roles the script returns, otherwise `face` |\n\nFeatures that make a solid start a body named by their id, or join the body they name with `\"body\": \"<id>\"` and `\"join\": \"add\"`, `\"cut\"` or `\"intersect\"`.",
|
|
223
|
+
"body": "| Feature | What it does | Faces it names |\n|---|---|---|\n| `extrude` | sweeps a sketch `distance` along its normal | `start`, `end`, `side` (per command) |\n| `revolve` | turns a sketch about an `axis` | `start`, `end`, `side` |\n| `sweep` | sweeps a profile along a `path` sketch | `start`, `end`, `side` |\n| `loft` | skins two or more sketches in order | `start`, `end`, `side` |\n| `boolean` | `union`, `difference` or `intersection` of `body` with `tools` | `new` for faces no input had |\n| `fillet` | rounds the `edges` a reference names | `round` |\n| `chamfer` | bevels them | `bevel` |\n| `shell` | hollows a body, leaving the `open` faces open, including bodies rounded all round when the open faces are flat | `rim`, `inner` |\n| `hole` | drills holes `at` positions on a face, `diameter` across or sized by a `fastener` such as `{ \"size\": \"M6\", \"fit\": \"tapped\" }` or, for an inch screw, `{ \"standard\": \"ansi\", \"size\": \"1/4\", \"series\": \"UNC\", \"fit\": \"tapped\" }` (`close`, `normal`, `loose` or `tapped`; `\"head\": \"socket\"` adds the counterbore for a socket head cap screw), in the document's unit whichever standard it is, with counterbores or countersinks | `wall` (per position id); a tapped hole's walls are also `thread`, and `design.clashes` leaves out a fastener's thread resting on them |\n| `boss` | raises a sketch on a face | `side`, `end` |\n| `pocket` | sinks a sketch into a face, a `distance`, `until` a face or `through` | `side`, `end` |\n| `keyway`, `flat`, `ringGroove`, `knurl`, `spline`, `thread` | machine the one cylindrical face `on` names, `at` a distance along its axis from its start (the end the nearest world axis points away from; `flip` starts from the other): a `keyway` in a shaft or through a hub's bore, a `flat` `depth` deep, the groove a retaining ring sits in, a `knurl` (`straight`, `left`, `right` or `diamond`), `spline` teeth in a bore, a `thread` outside a shaft of its size or inside a bore drilled for its tap (`size` such as `\"M8\"` or `\"1/4\"` is found from the diameter when left out). `standard` picks the tables: `din` (DIN 6885 keys, DIN 471 and 472 rings, DIN 82 knurls by `pitch`, DIN 5480 splines by `module`) or `ansi` (B17.1 keys, B18.27 rings, B94.6 knurls by `diametralPitch`, B92.1 splines by `pitch` such as `\"16/32\"` and `teeth`), and for a thread `iso` or `ansi` (Unified, with `series` `UNC` or `UNF`, or `threadsPerInch`); `angle` turns a keyway or flat about the axis from world X (world Y on an axis along X); all sized for the face's diameter | `keyway`, `flat`, `groove`, `knurl`, `spline`, `thread` |\n| `linearPattern`, `polarPattern` | repeats a body `count` times | copies picked with `copy` |\n| `mirror` | mirrors a body across a plane | the image is copy 1 |\n| `pushPull` | moves a face of a body along its normal: out when `distance` is above 0, in when below; `mode` `extrude`, the default, sweeps one flat face straight and adds or cuts the swept solid, `offset` moves the faces themselves, flat or curved, the faces around them stretching to follow, and with a `count` the reference may name several faces | `end` (the moved faces, which keep their names), `side` (the faces an extrude sweeps out) |\n| `removeFaces` | removes the `count` faces a reference names and closes the gap from the faces around them: a hole's wall fills the hole, a round sharpens its edge | keeps every name the faces that stay had |\n| `transform` | moves a body: turns it `rotate` degrees about X, Y and Z through a `pivot`, then shifts it by `translate` | keeps every name it had |\n| `import` | starts a body from a STEP, IGES or BREP asset pinned by its SHA-256; `child` takes one shape of a compound, such as one part of the shapes file `fromStep` writes | `face` (per index) |\n| `operation` | calls any method of the package by its path, such as `\"occt.shapes.shape.unifySameDomain\"`, `\"occt.parts.mechanical.gears.spurGear\"`, `\"occt.parts.mechanical.fasteners.iso.socketHeadCapScrew\"` (or `fasteners.ansi` for an inch one), `\"occt.parts.mechanical.springs.compressionSpring\"` or `\"occt.parts.mechanical.bearings.iso.ballBearing\"`; a method that takes a `unit` builds in the document's, so leave `unit` out | the roles a part names, such as a gear's `tip`, `flank`, `root`, `bore`, `rim`, `start` and `end`, a screw's `head`, `recess`, `seat`, `shank`, `thread` and `end`, or a bearing's `bore`, `outside`, `innerStart`, `innerEnd`, `outerStart` and `outerEnd`; otherwise carried through history, otherwise `face`. `{ \"expr\": ... }` in `params` passes a number, or text such as a choice parameter's `\"M8\"` |\n| `script` | runs code from an asset pinned by its SHA-256, outside the kernel, on bodies, references and values | the roles the script returns, otherwise `face` |\n\nFeatures that make a solid start a body named by their id, or join the body they name with `\"body\": \"<id>\"` and `\"join\": \"add\"`, `\"cut\"` or `\"intersect\"`.",
|
|
224
224
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
225
225
|
},
|
|
226
226
|
{
|
|
@@ -248,14 +248,14 @@ export const GUIDES = [
|
|
|
248
248
|
"id": "assemblies",
|
|
249
249
|
"title": "Assemblies",
|
|
250
250
|
"level": 2,
|
|
251
|
-
"body": "An assembly places parts of other documents. The documents are given to the build beside it, keyed by their `id`; the runner fetches nothing.\n\n```json title=\"hinge.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.
|
|
251
|
+
"body": "An assembly places parts of other documents. The documents are given to the build beside it, keyed by their `id`; the runner fetches nothing.\n\n```json title=\"hinge.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.6.0-rc.0/schemas/design-document/experimental.json\",\n \"schemaVersion\": 1,\n \"kind\": \"assembly\",\n \"meta\": { \"name\": \"Swivel pair\" },\n \"parameters\": {\n \"swing\": { \"value\": 30, \"min\": 0, \"max\": 90, \"unit\": \"deg\" }\n },\n \"components\": [\n { \"id\": \"lower\", \"source\": { \"document\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\", \"part\": \"bracket\" } },\n { \"id\": \"upper\", \"source\": { \"document\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\", \"part\": \"bracket\", \"parameters\": { \"width\": 80 } } }\n ],\n \"joints\": [\n {\n \"id\": \"pivot\", \"type\": \"revolute\", \"component\": \"upper\", \"connector\": \"pivotBottom\",\n \"to\": { \"component\": \"lower\", \"connector\": \"pivotTop\" },\n \"angle\": \"swing\", \"limits\": { \"angle\": [0, 90] }\n }\n ]\n}\n```\n\n- Build it with the documents it places: `build({ document: hinge, documents: [bracket] })`. The result has the parts, every placed occurrence with its matrix, the bill of materials, and the structure that `assembly.manager.buildAssemblyDocument` exports to STEP and glTF.\n- **Joints** put a component's connector against another's, faces meeting and facing each other: `fastened` moves nothing, `revolute` turns by `angle` about the shared axis, `slider` moves by `offset` along it, `cylindrical` does both. `flip` makes the faces face the same way, `limits` bound what may move, and joints form a tree.\n- **`replicate`** places a component on every member of a connector set, such as a bolt in every hole of a flange: `\"replicate\": { \"connector\": \"seat\", \"to\": { \"component\": \"flange\", \"connector\": \"bolts\" } }`.\n- **`pattern`** places copies of a component where it is placed, turned about an axis or stepped along a direction, such as the blades of a fan: `\"pattern\": { \"polar\": { \"axis\": { \"origin\": [0, 0, 0], \"direction\": [1, 0, 0] }, \"count\": \"blades\" } }`, or `{ \"linear\": { \"direction\": [1, 0, 0], \"spacing\": 25, \"count\": 4 } }`. A polar pattern spaces its copies as the `polarPattern` feature does: a whole turn shared out, a part of one (`angle`) with both ends included, the first turned by `start`. Each copy is an occurrence of its own, `blade.1`, `blade.2` and so on, counted in the bill of materials. A patterned component is not moved by a joint or joined to; to turn a row of blades, pattern them inside a sub-assembly and join that.\n- A component's `source.parameters` drive the placed document's values from the assembly's own, so one parameter can size several parts.\n- **A gear pair** is one gear part document placed twice: its `module`, `teeth`, `width`, `bore` and `backlash` parameters feed a `gear` loop and a `circle` bore, an extrude, and a connector `{ \"id\": \"axis\", \"on\": { \"of\": \"gear\", \"role\": \"start\" } }`. Each component sets its `teeth` in `source.parameters`, and a revolute joint per gear holds its `axis` against a frame or a plate, `module * (teeth + otherTeeth) / 2` apart. Drive both angles from one parameter: `\"turn\"` on the first, `\"180 / 30 - turn * 20 / 30\"` on a 30-tooth second for a 20-tooth first, so the teeth fall into each other's gaps; `design.clashes` at a few values of `turn` through one tooth of the first proves they mesh.\n- **A standard part document** is one `operation` feature of `occt.parts` sized by its parameters, such as `{ \"id\": \"screw\", \"type\": \"operation\", \"operation\": \"occt.parts.mechanical.fasteners.iso.socketHeadCapScrew\", \"params\": { \"size\": { \"expr\": \"size\" }, \"length\": { \"expr\": \"length\" } } }` with `size` a choice parameter of `\"M3\"`, `\"M4\"` and so on (`fasteners.ansi` takes `\"#10\"`, `\"1/4\"` and a `series`), built in the document's unit, and connectors on the roles it names: a screw's `{ \"on\": { \"of\": \"screw\", \"role\": \"seat\" }, \"axis\": { \"of\": \"screw\", \"role\": \"thread\" } }`, a nut's or a washer's `seat` and `top`, a bearing's `innerStart` or `outerStart` with the `bore` or `outside` axis, a spring's `bottom` and `top`. Each component sets its own size, so one document places every screw of an assembly, and `replicate` puts one in every hole of a set.\n- An assembly may publish `connectors` of its components, so a larger assembly can join it as one unit.\n- **From a STEP file:** `occt.design.fromStep({ step, name })` writes an assembly document per assembly and a part document per part, placed `at` the file's frames, with names and colours, every part importing one shapes file by `child`. Store `assets[0].data` at its `uri`, then build the `root` document with `documents` and `assets: { [assets[0].id]: assets[0].data }`; `report.notes` says what changed on the way, such as a mirrored placement built into a part of its own.\n- **Section a build:** `occt.design.section({ build, frame })` cuts what `build` returned with the plane of a frame, taking away what lies on the side its normal points to, and gives a cap for each part the plane passes through, the faces it cuts with their `area`. With `cut: true` the pieces behind the plane and the parts wholly behind it come too, each with its `volume`. The result is placed like the build's parts, so `draw.drawAnyAsync({ entity: section })` draws it, and the same frame given to `operations.hiddenLines` looks at the cut.",
|
|
252
252
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
255
|
"id": "mistakes-to-avoid",
|
|
256
256
|
"title": "Mistakes to avoid",
|
|
257
257
|
"level": 2,
|
|
258
|
-
"body": "- **Indexes in references.** Never write a face or edge by its number. Name it by the feature and role that made it.\n- **Missing command and position ids.** A side or a hole wall that a later feature names needs an id where it was drawn.\n- **Edge references without `count`.** They are refused; count the edges you mean.\n- **Operations without the kernel.** An `operation` path starts with the kernel: `\"occt.fillets.filletEdges\"`, not `\"fillets.filletEdges\"`. Look its inputs up with the MCP's `describe` before writing them, and pass bodies as `{ \"body\": \"<id>\" }`.\n- **Guessed units.** Lengths are in the document's `units.length`, millimetres when left out, and angles in degrees.\n- **Fields that do not exist.** The schema and `validate` refuse unknown properties. Check them rather than inventing a plausible one.\n- **Building before validating.** `validate` reports every problem at once with a pointer to it; a build stops at the first feature that fails and skips what depends on it.",
|
|
258
|
+
"body": "- **Indexes in references.** Never write a face or edge by its number. Name it by the feature and role that made it.\n- **Missing command and position ids.** A side or a hole wall that a later feature names needs an id where it was drawn.\n- **Edge references without `count`.** They are refused; count the edges you mean.\n- **Operations without the kernel.** An `operation` path starts with the kernel: `\"occt.fillets.filletEdges\"`, not `\"fillets.filletEdges\"`. Look its inputs up with the MCP's `describe` before writing them, and pass bodies as `{ \"body\": \"<id>\" }`.\n- **Guessed units.** Lengths are in the document's `units.length` (`mm`, `cm`, `m` or `in`), millimetres when left out, and angles in degrees. An inch document holds inch numbers: a 1/4 inch plate is `0.25` thick, and its standard parts and fastener holes are sized in inches, ISO and ANSI alike. A STEP export states the document's unit; a glTF one holds the numbers as they are unless it is given the unit (`unit` on `exportDocumentToGltf`, `outputs.unit` on CAD Cloud), when it is written in metres, the unit glTF viewers assume.\n- **Fields that do not exist.** The schema and `validate` refuse unknown properties. Check them rather than inventing a plausible one.\n- **Building before validating.** `validate` reports every problem at once with a pointer to it; a build stops at the first feature that fails and skips what depends on it.",
|
|
259
259
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
260
260
|
},
|
|
261
261
|
{
|
|
@@ -283,7 +283,7 @@ export const GUIDES = [
|
|
|
283
283
|
"id": "the-order-to-write-a-building-in",
|
|
284
284
|
"title": "The order to write a building in",
|
|
285
285
|
"level": 2,
|
|
286
|
-
"body": "Later calls refer to what earlier calls made, so this order avoids every \"not found\" error:\n\n1. **The model and its storeys**: `model.create`, then `spatial.addStorey` per floor with its `elevation`.\n2. **Materials and layer sets**: `materials.add` (a name, an optional `color` such as `\"#b5651d\"`), then `materials.addLayerSet` with `layers: [{ material: \"Brick\", thickness: 235 }, { material: \"Plaster\", thickness: 15 }]`. Walls, wall types, slabs and roofs refer to a layer set by its name; a layer set's thicknesses add up to the element's thickness.\n3. **Types**: `walls.addType`, `doors.addType` and `windows.addType`. A door or window type is placed many times through shared geometry, so define each size once.\n4. **Walls**: `walls.add` per straight wall, from `start` to `end`, with a `height` and a `layerSet` or a `thickness`. `alignment` says which side of the axis the layers lie on, looking from `start` to `end`: walls drawn counterclockwise around a plan lie inside it with `left` and outside with `right`, so with `left` the plan's corners are the building's outer faces.\n5. **Joins**: `walls.connect` for every pair of walls that meet, at a corner or where one ends against another's side. Unjoined walls overlap or leave gaps at the corners. A wall that ends against another, such as a partition against an outside wall, may end anywhere within that wall's thickness: the join cuts it back to the face.\n6. **Doors, windows and openings**: `doors.add` and `windows.add` place a type in a wall `offset` along its axis from its start, and cut their own opening; do not add an opening for them as well. `openings.add` cuts an empty opening. A window's `sill` defaults to 900 mm above the wall's base, a door's to 0. Keep an opening at least the wall's thickness away from a mitred corner: the offset runs along the axis, and the face on the other side of a corner is shorter by the thickness. A door type's `operation` names its hinges as IFC does, seen from the wall's right side, its start on your left: `singleSwingLeft` is hinged toward the wall's start, `singleSwingRight` toward its end, and the handle is on the other edge.\n7. **Slabs**: `slabs.add` with an `outline`, `thickness` or `layerSet` and `topOffset` above the storey's floor; `holes` or `openings.addInSlab` for stairwells and shafts. A floor over a storey whose walls run up to it fits between their inner faces: an outline at the outer faces puts the slab and the top of the walls in the same space.\n8. **Roofs**: `roofs.add` over a rectangle of four corners (`kind`: `flat`, `monoPitch`, `gable`, `hip`), with `baseOffset` the height of the walls under it and an `overhang`. A mono-pitch roof rises from the outline's first side and a gable's ridge runs along it. Then `walls.clipByRoof` for each wall it covers. A wall under a slope is added taller than `baseOffset`, up to the ridge at most, and clipping cuts it to the slope, a gable wall to its triangle; a wall added exactly at `baseOffset` is left square, with a wedge open under the slope.\n9. **Structure and detail**: `columns.add`, `beams.add` and `members.add` with a `profile` (`rectangle`, `circle`, `iShape`); `assemblies.add` to group parts such as a facade's cladding boards.\n10. **Rooms**: `spaces.add` per room, with its `name` (the room number), `longName` and `height`.\n11. **Data**: `properties.addSet`, such as `Pset_WallCommon` with `IsExternal: true` shared by every outside wall. A property's value is written as a label, boolean, integer or real as it is, or as the `type` it names: any of IFC4's `IfcValue` types, such as `IfcText`, `IfcLengthMeasure` or `IfcThermalTransmittanceMeasure` for a U-value.\n12. **Quantities last**: `quantities.compute` measures every element as it is now; compute again after any later change.\n13. **Write**: `model.writeBytes` (any size) or `model.write` (the text).",
|
|
286
|
+
"body": "Later calls refer to what earlier calls made, so this order avoids every \"not found\" error:\n\n1. **The model and its storeys**: `model.create`, then `spatial.addStorey` per floor with its `elevation`.\n2. **Materials and layer sets**: `materials.add` (a name, an optional `color` such as `\"#b5651d\"`), then `materials.addLayerSet` with `layers: [{ material: \"Brick\", thickness: 235 }, { material: \"Plaster\", thickness: 15 }]`. Walls, wall types, slabs and roofs refer to a layer set by its name; a layer set's thicknesses add up to the element's thickness.\n3. **Types**: `walls.addType`, `doors.addType` and `windows.addType`. A door or window type is placed many times through shared geometry, so define each size once.\n4. **Walls**: `walls.add` per straight wall, from `start` to `end`, with a `height` and a `layerSet` or a `thickness`. `alignment` says which side of the axis the layers lie on, looking from `start` to `end`: walls drawn counterclockwise around a plan lie inside it with `left` and outside with `right`, so with `left` the plan's corners are the building's outer faces.\n5. **Joins**: `walls.connect` for every pair of walls that meet, at a corner or where one ends against another's side. Unjoined walls overlap or leave gaps at the corners. A wall that ends against another, such as a partition against an outside wall, may end anywhere within that wall's thickness: the join cuts it back to the face.\n6. **Doors, windows and openings**: `doors.add` and `windows.add` place a type in a wall `offset` along its axis from its start, and cut their own opening; do not add an opening for them as well. `openings.add` cuts an empty opening. A window's `sill` defaults to 900 mm above the wall's base, a door's to 0. Keep an opening at least the wall's thickness away from a mitred corner: the offset runs along the axis, and the face on the other side of a corner is shorter by the thickness. A door type's `operation` names its hinges as IFC does, seen from the wall's right side, its start on your left: `singleSwingLeft` is hinged toward the wall's start, `singleSwingRight` toward its end, and the handle is on the other edge.\n7. **Slabs**: `slabs.add` with an `outline`, `thickness` or `layerSet` and `topOffset` above the storey's floor; `holes` or `openings.addInSlab` for stairwells and shafts. A floor over a storey whose walls run up to it fits between their inner faces: an outline at the outer faces puts the slab and the top of the walls in the same space.\n8. **Roofs**: `roofs.add` over a rectangle of four corners (`kind`: `flat`, `monoPitch`, `gable`, `hip`), with `baseOffset` the height of the walls under it and an `overhang`. A mono-pitch roof rises from the outline's first side and a gable's ridge runs along it. Then `walls.clipByRoof` for each wall it covers. A wall under a slope is added taller than `baseOffset`, up to the ridge at most, and clipping cuts it to the slope, a gable wall to its triangle; a wall added exactly at `baseOffset` is left square, with a wedge open under the slope.\n9. **Structure and detail**: `columns.add`, `beams.add` and `members.add` with a `profile` (`rectangle`, `circle`, `iShape`); `assemblies.add` to group parts such as a facade's cladding boards; `elements.add` for anything else, its body an OpenCascade shape described with `occt.recipes.describe({ shape, ifcSurfaces: true })` or a mesh.\n10. **Rooms**: `spaces.add` per room, with its `name` (the room number), `longName` and `height`.\n11. **Data**: `properties.addSet`, such as `Pset_WallCommon` with `IsExternal: true` shared by every outside wall. A property's value is written as a label, boolean, integer or real as it is, or as the `type` it names: any of IFC4's `IfcValue` types, such as `IfcText`, `IfcLengthMeasure` or `IfcThermalTransmittanceMeasure` for a U-value.\n12. **Quantities last**: `quantities.compute` measures every element as it is now; compute again after any later change.\n13. **Write**: `model.writeBytes` (any size) or `model.write` (the text).",
|
|
287
287
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
288
288
|
},
|
|
289
289
|
{
|
|
@@ -304,21 +304,21 @@ export const GUIDES = [
|
|
|
304
304
|
"id": "reading-and-changing-ifc-files",
|
|
305
305
|
"title": "Reading and changing IFC files",
|
|
306
306
|
"level": 2,
|
|
307
|
-
"body": "- `model.read` takes the text or the bytes of an `.ifc` file, such as `readFileSync(\"in.ifc\")` or `await file.arrayBuffer()`. It indexes the file without decoding it, so files of hundreds of megabytes open in seconds.\n- `model.elements` lists objects by IFC type, its subtypes included (`IfcWall`, `IfcBuildingElement`, or `IfcElement` for every element), optionally of one storey; `model.element` describes one; `model.getAttribute` and `model.setAttribute` read and set one attribute such as `Name` or `Tag`.\n- `properties.getSets` reads an object's property sets; `properties.setValues` changes one object's values, copying a set it shares with others first, so the others keep theirs.\n- `walls.parameters` and `walls.edit` read and change walls other tools wrote with an axis and layers; joined walls are trimmed again and the wall's openings move with it. `model.move` moves and turns any element, and `model.remove` takes it away with what only it uses.\n- **IFC2X3 files** are read, queried and written back, but not changed: `model.upgradeToIfc4` gives a model that can be.\n- `model.writeBytes` writes untouched entities back byte for byte, so a small change to a large file stays small. Prefer it to `model.write` for files read from elsewhere: a JavaScript string holds about 512 MB.",
|
|
307
|
+
"body": "- `model.read` takes the text or the bytes of an `.ifc` file, or the bytes of an `.ifczip` archive, such as `readFileSync(\"in.ifc\")` or `await file.arrayBuffer()`. It indexes the file without decoding it, so files of hundreds of megabytes open in seconds.\n- `model.elements` lists objects by IFC type, its subtypes included (`IfcWall`, `IfcBuildingElement`, or `IfcElement` for every element), optionally of one storey; `model.element` describes one; `model.getAttribute` and `model.setAttribute` read and set one attribute such as `Name` or `Tag`.\n- `properties.getSets` reads an object's property sets; `properties.setValues` changes one object's values, copying a set it shares with others first, so the others keep theirs.\n- `walls.parameters` and `walls.edit` read and change walls other tools wrote with an axis and layers; joined walls are trimmed again and the wall's openings move with it. `model.move` moves and turns any element, and `model.remove` takes it away with what only it uses.\n- **IFC2X3 files** are read, queried and written back, but not changed: `model.upgradeToIfc4` gives a model that can be.\n- **IFC4X3 files** are read with their own schema, queried, drawn and written back, but not changed. `model.summary` gives `editable` false for both.\n- `model.georeference` reads a model's map conversion (`crs`, `eastings`, `northings`) and its site's latitude and longitude.\n- `model.writeBytes` writes untouched entities back byte for byte, so a small change to a large file stays small. Prefer it to `model.write` for files read from elsewhere: a JavaScript string holds about 512 MB.",
|
|
308
308
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
309
309
|
},
|
|
310
310
|
{
|
|
311
311
|
"id": "drawing-an-ifc-model-and-exporting-step",
|
|
312
312
|
"title": "Drawing an IFC model and exporting STEP",
|
|
313
313
|
"level": 2,
|
|
314
|
-
"body": "In the browser, a model's recipe is built by a kernel and drawn:\n\n```typescript\nconst recipe = await bitbybit.ifc.geometry.recipe({ model });\nconst solids = await bitbybit.manifold.recipes.build({ recipe, adjustZtoY: true });\nawait bitbybit.draw.drawAnyAsync({ entity: solids });\n```\n\nThe solids come back one per root of the recipe, and `recipe.roots[i].tag` carries the element's `globalId`, `type`, `name` and, when its material has a colour, `rgba`. With the OpenCascade worker enabled as well, `ifc.geometry.toShapes` gives exact shapes and `ifc.geometry.toStep` the bytes of a STEP file, nested by site, building, storey and IFC class: `await bitbybit.ifc.geometry.toStep({ model, name: \"House\", fileName: \"house.step\" })`. A Babylon.js scene is left-handed unless told otherwise; set `scene.useRightHandedSystem = true` before drawing, or the building is mirrored.",
|
|
314
|
+
"body": "In the browser, a model's recipe is built by a kernel and drawn:\n\n```typescript\nconst recipe = await bitbybit.ifc.geometry.recipe({ model });\nconst solids = await bitbybit.manifold.recipes.build({ recipe, adjustZtoY: true });\nawait bitbybit.draw.drawAnyAsync({ entity: solids });\n```\n\nThe solids come back one per root of the recipe, and `recipe.roots[i].tag` carries the element's `globalId`, `type`, `name` and, when its material has a colour, `rgba`; `propertySets: true` adds its property set values, named like `Pset_WallCommon.IsExternal`. With the OpenCascade worker enabled as well, `ifc.geometry.toShapes` gives exact shapes and `ifc.geometry.toStep` the bytes of a STEP file, nested by site, building, storey and IFC class, each product carrying its property sets: `await bitbybit.ifc.geometry.toStep({ model, name: \"House\", fileName: \"house.step\" })`. A Babylon.js scene is left-handed unless told otherwise; set `scene.useRightHandedSystem = true` before drawing, or the building is mirrored.",
|
|
315
315
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
"id": "mistakes-to-avoid-in-ifc-models",
|
|
319
319
|
"title": "Mistakes to avoid in IFC models",
|
|
320
320
|
"level": 2,
|
|
321
|
-
"body": "- **Dropping the returned model.** `ifc.walls.add({ model, ... })` without `model =` changes nothing; the next call starts from the model before it.\n- **Mixing the two call forms.** In Node the package's methods are synchronous; `bitbybit.ifc` in the browser and in the editors is asynchronous and needs `await` on every call.\n- **Guessed units.** A wall `height: 3` in a millimetre model is 3 mm high. Give lengths in the model's unit, millimetres unless the model says otherwise.\n- **Y as up.** Plans are `[x, y]` and up is Z. A point written as `[x, height, y]` puts the building on its side.\n- **Unjoined walls.** Every corner and T junction needs `walls.connect`. Without it the walls overlap or leave a gap there, and other BIM tools show them as walls that do not meet.\n- **An opening for a door or window.** `doors.add` and `windows.add` cut their own; an extra `openings.add` in the same place is a second hole.\n- **Openings that do not fit.** An opening past the end of its wall is refused, but two that overlap, or one whose `sill` plus height rises above the wall, are not: keep the openings of a wall apart and under its top.\n- **The roof before its walls are clipped, or a roof that is not a rectangle.** `roofs.add` takes four corners, and walls are clipped with `walls.clipByRoof` after the roof exists.\n- **Quantities computed too early.** They are a snapshot; compute them once the model is finished, or again after a change.\n- **An assembly of a user-defined kind without words.** `assemblies.add` with `predefinedType` `userDefined` needs an `objectType` that says what it is, such as `\"Cladding\"`.\n- **Changing an IFC2X3 model.**
|
|
321
|
+
"body": "- **Dropping the returned model.** `ifc.walls.add({ model, ... })` without `model =` changes nothing; the next call starts from the model before it.\n- **Mixing the two call forms.** In Node the package's methods are synchronous; `bitbybit.ifc` in the browser and in the editors is asynchronous and needs `await` on every call.\n- **Guessed units.** A wall `height: 3` in a millimetre model is 3 mm high. Give lengths in the model's unit, millimetres unless the model says otherwise.\n- **Y as up.** Plans are `[x, y]` and up is Z. A point written as `[x, height, y]` puts the building on its side.\n- **Unjoined walls.** Every corner and T junction needs `walls.connect`. Without it the walls overlap or leave a gap there, and other BIM tools show them as walls that do not meet.\n- **An opening for a door or window.** `doors.add` and `windows.add` cut their own; an extra `openings.add` in the same place is a second hole.\n- **Openings that do not fit.** An opening past the end of its wall is refused, but two that overlap, or one whose `sill` plus height rises above the wall, are not: keep the openings of a wall apart and under its top.\n- **The roof before its walls are clipped, or a roof that is not a rectangle.** `roofs.add` takes four corners, and walls are clipped with `walls.clipByRoof` after the roof exists.\n- **Quantities computed too early.** They are a snapshot; compute them once the model is finished, or again after a change.\n- **An assembly of a user-defined kind without words.** `assemblies.add` with `predefinedType` `userDefined` needs an `objectType` that says what it is, such as `\"Cladding\"`.\n- **Changing an IFC2X3 or IFC4X3 model.** An IFC2X3 model refuses every change until `model.upgradeToIfc4`; an IFC4X3 model refuses every change.\n- **Fields that do not exist.** Look each method up with `describe`; its inputs, defaults and ranges come from the index, not from memory.",
|
|
322
322
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
323
323
|
}
|
|
324
324
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.generated.js","sourceRoot":"","sources":["../src/guides.generated.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,qEAAqE,CAAC;AAEpG;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAA4B;IAC3C;QACI,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"guides.generated.js","sourceRoot":"","sources":["../src/guides.generated.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,qEAAqE,CAAC;AAEpG;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAA4B;IAC3C;QACI,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,iBAAiB;QAC1B,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QACI,IAAI,EAAE,iCAAiC;QACvC,OAAO,EAAE,iCAAiC;QAC1C,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,83DAA83D;QACt4D,MAAM,EAAE,oEAAoE;KAC/E;CACJ,CAAC"}
|
package/dist/tools/get-guide.js
CHANGED
|
@@ -33,7 +33,7 @@ export const GUIDE_ALIASES = {
|
|
|
33
33
|
"design-mistakes": "mistakes-to-avoid",
|
|
34
34
|
geometry: "geometry-in-bitbybit",
|
|
35
35
|
cad: "geometry-in-bitbybit",
|
|
36
|
-
occt: "how-the-occt-kernel-thinks",
|
|
36
|
+
occt: "how-the-bitbybit-occt-kernel-thinks",
|
|
37
37
|
kernels: "which-kernel-to-use",
|
|
38
38
|
manifold: "manifold-and-jscad",
|
|
39
39
|
jscad: "manifold-and-jscad",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-guide.js","sourceRoot":"","sources":["../../src/tools/get-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAqC;IAC3D,SAAS,EAAE,wCAAwC;IACnD,MAAM,EAAE,wCAAwC;IAChD,UAAU,EAAE,wCAAwC;IACpD,aAAa,EAAE,4BAA4B;IAC3C,MAAM,EAAE,4BAA4B;IACpC,OAAO,EAAE,sBAAsB;IAC/B,UAAU,EAAE,sBAAsB;IAClC,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,cAAc;IACvB,cAAc,EAAE,4BAA4B;IAC5C,OAAO,EAAE,6BAA6B;IACtC,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE,gBAAgB;IACvB,KAAK,EAAE,aAAa;IACpB,iBAAiB,EAAE,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AO,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,EAAE,CAAC,6BAA6B,IAAI,CAAC,KAAK,gBAAgB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/L,CAAC;QACD,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QAC/C,OAAO,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,OAAO,OAAO,CAAC,IAAI,eAAe,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACvK,CAAC;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbybit-dev/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-rc.0",
|
|
4
4
|
"description": "MCP server for the Bitbybit 3D CAD API: version-exact lookups of every function, its parameters, defaults and examples, for AI coding agents",
|
|
5
5
|
"author": "Bit By Bit Developers",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,14 +89,14 @@
|
|
|
89
89
|
},
|
|
90
90
|
"homepage": "https://bitbybit.dev",
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@modelcontextprotocol/server": "2.
|
|
93
|
-
"zod": "4.6.
|
|
92
|
+
"@modelcontextprotocol/server": "2.3.1",
|
|
93
|
+
"zod": "4.6.7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@modelcontextprotocol/client": "2.
|
|
96
|
+
"@modelcontextprotocol/client": "2.3.1",
|
|
97
97
|
"@types/node": "^22.10.2",
|
|
98
|
-
"@vitest/coverage-v8": "4.1.
|
|
98
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
99
99
|
"typescript": "5.9.3",
|
|
100
|
-
"vitest": "4.1.
|
|
100
|
+
"vitest": "4.1.12"
|
|
101
101
|
}
|
|
102
102
|
}
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "dev.bitbybit/cad",
|
|
4
4
|
"title": "Bitbybit CAD MCP",
|
|
5
5
|
"description": "Bitbybit 3D parametric CAD API, version-exact, for coding agents: search, describe, examples, guide",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.6.0-rc.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "https://github.com/bitbybit-dev/bitbybit",
|
|
9
9
|
"source": "github",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
20
20
|
"identifier": "@bitbybit-dev/mcp",
|
|
21
21
|
"runtimeHint": "npx",
|
|
22
|
-
"version": "1.
|
|
22
|
+
"version": "1.6.0-rc.0",
|
|
23
23
|
"transport": {
|
|
24
24
|
"type": "stdio"
|
|
25
25
|
}
|
package/src/descriptions.ts
CHANGED
|
@@ -59,6 +59,7 @@ export const DESCRIPTIONS: Readonly<Record<ToolName, { title: string; descriptio
|
|
|
59
59
|
|
|
60
60
|
export const SERVER_INSTRUCTIONS =
|
|
61
61
|
"This is the Bitbybit CAD MCP: it documents the Bitbybit 3D CAD API (OpenCascade, JSCAD and Manifold kernels, with Babylon.js, three.js and PlayCanvas renderers, and the IFC library for building models) for one exact version. " +
|
|
62
|
+
"The version it documents is in this server's info and in every answer's metadata. Before relying on an answer, check which @bitbybit-dev version the project has installed (its package.json or lockfile); when it differs, pass that version as `version` to search_api, describe, list_namespace and get_examples, so the code you write uses only what that version has. " +
|
|
62
63
|
"Always describe a member before using it: names, parameters and defaults come from the index, not from memory. " +
|
|
63
64
|
"Tiers matter: oss members are in the MIT npm packages and run anywhere; platform-pro members exist only inside bitbybit.dev; cloud-pro members run only on Bitbybit CAD Cloud with an API key. " +
|
|
64
65
|
"When asked where geometry should run, read get_guide(\"integrate\") first: the packages alone are the default, and CAD Cloud is the answer only for algorithms that exist only there or for compute the caller cannot provide. " +
|
package/src/guides.generated.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
13
13
|
"id": "what-we-believe",
|
|
14
14
|
"title": "What we believe",
|
|
15
15
|
"level": 2,
|
|
16
|
-
"body": "Agents write the code. Bitbybit provides verified geometry algorithms and, where it is needed, hosted compute. The
|
|
16
|
+
"body": "Agents write the code. Bitbybit provides verified geometry algorithms and, where it is needed, hosted compute. The free packages are the vocabulary that everyone learns, human or agent: one dotted API (`bitbybit.occt.shapes.solid.createBox`, `bitbybit.manifold.booleans.union`, ...) that reads the same in a browser, on a server and in the online editors.\n\nAn agent that knows the API from memory guesses. An agent that looks it up gets the exact signature, defaults and examples for the version your project has installed. That lookup is what the MCP server is for.",
|
|
17
17
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
@@ -27,14 +27,14 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
27
27
|
"id": "how-an-agent-should-integrate-bitbybit",
|
|
28
28
|
"title": "How an agent should integrate Bitbybit",
|
|
29
29
|
"level": 2,
|
|
30
|
-
"body": "```mermaid\n%%{init: {\"flowchart\": {\"wrappingWidth\": 420}}}%%\nflowchart TD\n Q1{\"Can your users' browsers or<br/>your own Node servers run the kernels?\"}\n Q2{\"Do you need a Pro algorithm,<br/>or a backend that cannot host a kernel?\"}\n P[\"The npm packages, in the browser or in Node.<br/>Free, and
|
|
30
|
+
"body": "```mermaid\n%%{init: {\"flowchart\": {\"wrappingWidth\": 420}}}%%\nflowchart TD\n Q1{\"Can your users' browsers or<br/>your own Node servers run the kernels?\"}\n Q2{\"Do you need a Pro algorithm,<br/>or a backend that cannot host a kernel?\"}\n P[\"The npm packages, in the browser or in Node.<br/>Free, and no service of ours in the loop.\"]\n C[\"CAD Cloud: one pipeline per model from your backend,<br/>or the CAD Cloud MCP when an agent does the work.\"]\n Q1 -->|yes| Q2\n Q1 -->|no: edge or serverless| C\n Q2 -->|no| P\n Q2 -->|yes| C\n```\n\n### The honest default\n\nIf public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and no service of ours sits in the loop. Start there, and move a step only for a reason named below.\n\n### Browser apps\n\nUse the packages, or the runner bundle for a page that only needs a script. The kernels run inside the tab: the user's device does the work, results appear without a network round trip, and your geometry logic ships with your app. This is how the Bitbybit editors themselves work. A model that takes seconds on a laptop is fine here; a model that takes minutes is not, and belongs on a server.\n\n### Lightweight backends\n\nCloudflare Workers, serverless functions and edge runtimes do not have the memory or the CPU time to run the CAD kernels. Do not try. Call CAD Cloud instead, with one pipeline per model so a request is one round trip, keep the API key in the backend and never in the client, and cache results by their input parameters, because identical inputs always produce identical geometry.\n\n### Node servers with headroom\n\nA Node server can run the packages in-process; `@bitbybit-dev/occt` loads the same kernel a browser does. That is the right choice for moderate load and for logic you want to keep private on your own machines. Move to CAD Cloud when you need scale without managing kernels, when you need a Pro algorithm, or when you convert files at volume and would rather not run that work yourself.\n\n### Inside the Bitbybit editors\n\nScripts written in the editors at bitbybit.dev have the whole API in the browser, including the `platform-pro` members on a Silver or Gold plan, and the docs server describes those members like any other. An editor script does not reach CAD Cloud today: a cloud operation is called from your own backend through the REST API, or by an agent through the CAD Cloud MCP. Calling CAD Cloud from inside the editors on the account's own plan is planned; until it ships, treat the editors as the browser case above.\n\n### What runs where\n\n| Question | Packages in the browser | Packages in Node | CAD Cloud |\n|---|---|---|---|\n| Whose compute | your users' devices, free | your servers | Bitbybit's servers, metered |\n| Memory and CPU | the tab's limits | your machine's | sized per plan |\n| Latency | none beyond the computation | none beyond the computation | one HTTPS round trip plus queueing |\n| Concurrency | one user per tab | what you provision | per plan |\n| Privacy of your logic | ships to the client | stays on your servers | stays in your backend; the geometry passes through Bitbybit |\n| Pro algorithms | no | no | yes |\n\nThe only work that must run on Bitbybit's servers is a Pro algorithm, or compute you cannot provide.",
|
|
31
31
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"id": "the-honest-default",
|
|
35
35
|
"title": "The honest default",
|
|
36
36
|
"level": 3,
|
|
37
|
-
"body": "If public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and
|
|
37
|
+
"body": "If public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and no service of ours sits in the loop. Start there, and move a step only for a reason named below.",
|
|
38
38
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
@@ -125,14 +125,14 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
125
125
|
"id": "two-ways-to-call-a-kernel",
|
|
126
126
|
"title": "Two ways to call a kernel",
|
|
127
127
|
"level": 2,
|
|
128
|
-
"body": "The methods have the same paths and the same inputs everywhere. What differs is how they answer.\n\n- **In the browser, through the renderer packages, and in scripts in the Bitbybit editors**, each kernel runs in a web worker as `bitbybit.occt`, `bitbybit.manifold` and `bitbybit.jscad`. Every call is asynchronous, and a shape is a small handle, `{ hash, type }`, to the shape the worker holds. Pass it to the next call; it cannot be read or changed.\n\n ```typescript\n const box = await bitbybit.occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 2 });\n ```\n\n- **In Node, with the package alone**, the kernel runs in the process and its methods are synchronous:\n\n ```typescript\n import initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\n import { OCCTService
|
|
128
|
+
"body": "The methods have the same paths and the same inputs everywhere. What differs is how they answer.\n\n- **In the browser, through the renderer packages, and in scripts in the Bitbybit editors**, each kernel runs in a web worker as `bitbybit.occt`, `bitbybit.manifold` and `bitbybit.jscad`. Every call is asynchronous, and a shape is a small handle, `{ hash, type }`, to the shape the worker holds. Pass it to the next call; it cannot be read or changed.\n\n ```typescript\n const box = await bitbybit.occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 2 });\n ```\n\n- **In Node, with the package alone**, the kernel runs in the process and its methods are synchronous:\n\n ```typescript\n import initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\n import { OCCTService } from \"@bitbybit-dev/occt\";\n\n const occ = await initOpenCascade({ print: () => undefined });\n const occt = new OCCTService(occ);\n const box = occt.shapes.solid.createBox({ width: 80, length: 50, height: 8 });\n ```\n\n `print` keeps the kernel's progress lines, such as a STEP writer's statistics, off the console. Run the TypeScript with `tsx` (`npx tsx part.ts`): the package's own imports leave out file extensions, as bundlers expect, so plain `node` cannot load them.\n\nWrite geometry so it runs both ways: `await` every call, as the projects `npm init @bitbybit-dev/app` creates do. Their `src/model.ts` holds a `buildModel(occt, params)` that the page calls with `bitbybit.occt` and the Node smoke test calls with the in-process service, typed as the worker's API through one cast.\n\nA few members differ between the two. Only the worker has `occt.deleteShape`, `occt.deleteShapes` and `occt.cleanAllCache`, which free the shapes it holds; in Node a shape is freed with its own `.delete()`. Through the worker `io.saveShapeSTEP` starts a browser download and `io.saveShapeSTEPAndReturn` returns the text; in Node `io.saveShapeSTEP` returns the text, so call it on the service itself rather than through code typed as the worker's API, which sees it return nothing. The worker also remembers results: the same call with the same inputs gives back the same handle without running again.\n\n`describe` shows the worker form, `createBox(inputs: Inputs.OCCT.BoxDto): Promise<Inputs.OCCT.TopoDSSolidPointer>`; in Node the same method returns the shape itself. A method's answer also names the types it returns, such as `Models.OCCT.SolidDebugInfo` for `occt.shapes.solid.debugInfo`; `describe` with that name lists their fields.",
|
|
129
129
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
|
-
"id": "how-the-occt-kernel-thinks",
|
|
133
|
-
"title": "How the OCCT
|
|
132
|
+
"id": "how-the-bitbybit-occt-kernel-thinks",
|
|
133
|
+
"title": "How the Bitbybit OCCT Kernel thinks",
|
|
134
134
|
"level": 2,
|
|
135
|
-
"body": "- **Y is up.** The ground is the XZ plane. A box's `height` runs along Y, a cylinder grows along its `direction`, `[0, 1, 0]` unless given, and a rectangle or circle wire lies flat on the ground unless its `direction`, the normal of its plane, says otherwise. Manifold and JSCAD build along Z instead: their cylinders stand on the XY plane.\n- **Shapes nest.** A vertex is a point, an edge a curve between vertices, a wire a chain of edges, a face a surface bounded by wires, a shell faces joined at their edges, a solid the volume a closed shell bounds, and a compound a group of shapes kept apart. Each method says which kinds it takes and gives: `operations.extrude` turns a face into a solid, but a wire only into a shell.\n- **Units are plain numbers.**
|
|
135
|
+
"body": "- **Y is up.** The ground is the XZ plane. A box's `height` runs along Y, a cylinder grows along its `direction`, `[0, 1, 0]` unless given, and a rectangle or circle wire lies flat on the ground unless its `direction`, the normal of its plane, says otherwise. Manifold and JSCAD build along Z instead: their cylinders stand on the XY plane.\n- **Shapes nest.** A vertex is a point, an edge a curve between vertices, a wire a chain of edges, a face a surface bounded by wires, a shell faces joined at their edges, a solid the volume a closed shell bounds, and a compound a group of shapes kept apart. Each method says which kinds it takes and gives: `operations.extrude` turns a face into a solid, but a wire only into a shell.\n- **Units are plain numbers.** Model in whichever unit the part is drawn in; angles are degrees, and tolerances are in the model's units. A file says its unit only when told it: give `io.saveShapeSTEP` the `unit` the part is modelled in (`Bit.Inputs.Base.unitOfLengthEnum.inch`, say) and it is written at its true size, in millimetres; `io.loadSTEPorIGES` takes the `unit` to bring a file in at, and `io.fileLengthUnit` tells the unit a STEP or IGES file states.\n- **Right-handed.** OpenCascade is right-handed, as three.js and PlayCanvas are. A Babylon.js scene is left-handed, and shows every part mirrored, unless `scene.useRightHandedSystem` is set when it is created.\n- **Colours** are hex strings such as `\"#ff8000\"`, or arrays of three numbers from 0 to 1.",
|
|
136
136
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
@@ -146,7 +146,7 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
146
146
|
"id": "a-part-to-start-from",
|
|
147
147
|
"title": "A part to start from",
|
|
148
148
|
"level": 2,
|
|
149
|
-
"body": "A mounting bracket: a plate with rounded corners, a boss with a bore, a fillet where the boss meets the plate, and four holes. It follows the order above, chooses the edge to fillet by where it is, and runs unchanged in the browser and in Node:\n\n```typescript\nimport type { BitByBitBase, Inputs } from \"@bitbybit-dev/threejs\";\n\ntype Occt = BitByBitBase[\"occt\"];\ntype Shape = Awaited<ReturnType<Occt[\"booleans\"][\"difference\"]>>;\n\nconst PLATE = { width: 80, length: 50, thickness: 8, cornerRadius: 6 };\nconst BOSS = { radius: 12, height: 20, bore: 6 };\nconst HOLE = { radius: 3.5, inset: 10 };\nconst ROOT_FILLET = 3;\nconst TOLERANCE = 1e-6;\nconst UP: Inputs.Base.Vector3 = [0, 1, 0];\n\nfunction isAt(point: Inputs.Base.Point3 | undefined, target: Inputs.Base.Point3): boolean {\n return point !== undefined && Math.hypot(point[0] - target[0], point[1] - target[1], point[2] - target[2]) < TOLERANCE;\n}\n\nexport async function buildBracket(occt: Occt): Promise<Shape> {\n const outline = await occt.shapes.wire.createRectangleWire({ width: PLATE.width, length: PLATE.length, center: [0, 0, 0], direction: UP });\n const rounded = await occt.fillets.fillet2d({ shape: outline, radius: PLATE.cornerRadius });\n const face = await occt.shapes.face.createFaceFromWire({ shape: rounded, planar: true });\n const plate = await occt.operations.extrude({ shape: face, direction: [0, PLATE.thickness, 0] });\n const boss = await occt.shapes.solid.createCylinder({ radius: BOSS.radius, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n const body = await occt.booleans.union({ shapes: [plate, boss] });\n\n const edges = await occt.shapes.edge.getEdges({ shape: body });\n const centers = await occt.shapes.edge.getEdgesCentersOfMass({ shapes: edges });\n const root = edges.filter((_edge, index) => isAt(centers[index], [0, PLATE.thickness, 0]));\n const filleted = await occt.fillets.filletEdgesListOneRadius({ shape: body, edges: root, radius: ROOT_FILLET });\n\n const x = PLATE.width / 2 - HOLE.inset;\n const z = PLATE.length / 2 - HOLE.inset;\n const corners: Inputs.Base.Point3[] = [[x, 0, z], [-x, 0, z], [-x, 0, -z], [x, 0, -z]];\n const holes = await Promise.all(corners.map((center) => occt.shapes.solid.createCylinder({ radius: HOLE.radius, height: PLATE.thickness, center, direction: UP })));\n const bore = await occt.shapes.solid.createCylinder({ radius: BOSS.bore, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n return occt.booleans.difference({ shape: filleted, shapes: [...holes, bore] });\n}\n```\n\nThe result is a valid solid of 18 faces, 80 by 28 by 50 mm, of about 36,556 mm³. The plate lies on the ground and the boss rises along Y. The only circle centred on the boss's axis at the plate's top is where the boss meets the plate, so that is the edge the fillet rounds, whatever number the kernel gave it. In a scaffolded project the function goes into `src/model.ts`, whose `Occt` and `Shape` types are the same; in a script in the editors, make the same calls on `bitbybit.occt`. In Node, hand it the in-process service through one cast and write a STEP file standing upright for a Z-up CAD tool:\n\n```typescript\nimport { writeFileSync } from \"node:fs\";\nimport initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\nimport { OCCTService
|
|
149
|
+
"body": "A mounting bracket: a plate with rounded corners, a boss with a bore, a fillet where the boss meets the plate, and four holes. It follows the order above, chooses the edge to fillet by where it is, and runs unchanged in the browser and in Node:\n\n```typescript\nimport type { BitByBitBase, Inputs } from \"@bitbybit-dev/threejs\";\n\ntype Occt = BitByBitBase[\"occt\"];\ntype Shape = Awaited<ReturnType<Occt[\"booleans\"][\"difference\"]>>;\n\nconst PLATE = { width: 80, length: 50, thickness: 8, cornerRadius: 6 };\nconst BOSS = { radius: 12, height: 20, bore: 6 };\nconst HOLE = { radius: 3.5, inset: 10 };\nconst ROOT_FILLET = 3;\nconst TOLERANCE = 1e-6;\nconst UP: Inputs.Base.Vector3 = [0, 1, 0];\n\nfunction isAt(point: Inputs.Base.Point3 | undefined, target: Inputs.Base.Point3): boolean {\n return point !== undefined && Math.hypot(point[0] - target[0], point[1] - target[1], point[2] - target[2]) < TOLERANCE;\n}\n\nexport async function buildBracket(occt: Occt): Promise<Shape> {\n const outline = await occt.shapes.wire.createRectangleWire({ width: PLATE.width, length: PLATE.length, center: [0, 0, 0], direction: UP });\n const rounded = await occt.fillets.fillet2d({ shape: outline, radius: PLATE.cornerRadius });\n const face = await occt.shapes.face.createFaceFromWire({ shape: rounded, planar: true });\n const plate = await occt.operations.extrude({ shape: face, direction: [0, PLATE.thickness, 0] });\n const boss = await occt.shapes.solid.createCylinder({ radius: BOSS.radius, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n const body = await occt.booleans.union({ shapes: [plate, boss] });\n\n const edges = await occt.shapes.edge.getEdges({ shape: body });\n const centers = await occt.shapes.edge.getEdgesCentersOfMass({ shapes: edges });\n const root = edges.filter((_edge, index) => isAt(centers[index], [0, PLATE.thickness, 0]));\n const filleted = await occt.fillets.filletEdgesListOneRadius({ shape: body, edges: root, radius: ROOT_FILLET });\n\n const x = PLATE.width / 2 - HOLE.inset;\n const z = PLATE.length / 2 - HOLE.inset;\n const corners: Inputs.Base.Point3[] = [[x, 0, z], [-x, 0, z], [-x, 0, -z], [x, 0, -z]];\n const holes = await Promise.all(corners.map((center) => occt.shapes.solid.createCylinder({ radius: HOLE.radius, height: PLATE.thickness, center, direction: UP })));\n const bore = await occt.shapes.solid.createCylinder({ radius: BOSS.bore, height: PLATE.thickness + BOSS.height, center: [0, 0, 0], direction: UP });\n return occt.booleans.difference({ shape: filleted, shapes: [...holes, bore] });\n}\n```\n\nThe result is a valid solid of 18 faces, 80 by 28 by 50 mm, of about 36,556 mm³. The plate lies on the ground and the boss rises along Y. The only circle centred on the boss's axis at the plate's top is where the boss meets the plate, so that is the edge the fillet rounds, whatever number the kernel gave it. In a scaffolded project the function goes into `src/model.ts`, whose `Occt` and `Shape` types are the same; in a script in the editors, make the same calls on `bitbybit.occt`. In Node, hand it the in-process service through one cast and write a STEP file standing upright for a Z-up CAD tool:\n\n```typescript\nimport { writeFileSync } from \"node:fs\";\nimport initOpenCascade from \"@bitbybit-dev/occt/bitbybit-dev-occt/index.js\";\nimport { OCCTService } from \"@bitbybit-dev/occt\";\nimport { buildBracket } from \"./bracket.ts\";\n\ntype Occt = Parameters<typeof buildBracket>[0];\ntype KernelShape = Parameters<OCCTService[\"io\"][\"saveShapeSTEP\"]>[0][\"shape\"];\n\nfunction asWorkerApi(service: object): Occt {\n return service as Occt;\n}\n\nfunction asKernelShape(shape: object): KernelShape {\n return shape as KernelShape;\n}\n\nconst occ = await initOpenCascade({ print: () => undefined });\nconst service = new OCCTService(occ);\nconst bracket = asKernelShape(await buildBracket(asWorkerApi(service)));\nconst upright = service.transforms.rotate({ shape: bracket, axis: [1, 0, 0], angle: 90 });\nwriteFileSync(\"bracket.step\", service.io.saveShapeSTEP({ shape: upright, fileName: \"bracket.step\" }));\n```",
|
|
150
150
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
151
151
|
},
|
|
152
152
|
{
|
|
@@ -167,7 +167,7 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
167
167
|
"id": "drawing-and-exporting-a-part",
|
|
168
168
|
"title": "Drawing and exporting a part",
|
|
169
169
|
"level": 2,
|
|
170
|
-
"body": "- **Drawing.** In the browser and in the editors, `draw.drawAnyAsync({ entity: shape, options })` draws any shape, mesh or point list; for OpenCascade shapes `options` is an `Inputs.Draw.DrawOcctShapeOptions`, with `faceColour`, `edgeColour`, `edgeWidth` and `precision`, the meshing tolerance. Draw the finished part rather than every step.\n- **STEP**, the exact format other CAD tools open: `io.saveShapeSTEPAndReturn` through the worker, `io.saveShapeSTEP` on the in-process service in Node, both giving the file's text in millimetres. Most CAD tools are Z-up: turn the part first with `transforms.rotate({ shape, axis: [1, 0, 0], angle: 90 })`, which takes Y up to Z and keeps the part as it was built. The `adjustYtoZ` option swaps Y and Z instead, which mirrors the part: it matches what a left-handed Babylon.js scene shows.\n- **STL** for printing: `io.saveShapeStlAndReturn` through the worker, `io.saveShapeStl` in Node, with `precision` as the meshing tolerance and `binary` for the smaller form. Turn the part as for STEP.\n- **Drawings and assemblies.** `io.shapeToDxfPaths` and `io.dxfCreate` write a DXF of flat geometry, and the documents of `occt.assembly.manager` hold several parts with names, colours and placements, written to one STEP file with `occt.assembly.manager.exportDocumentToStep`.",
|
|
170
|
+
"body": "- **Drawing.** In the browser and in the editors, `draw.drawAnyAsync({ entity: shape, options })` draws any shape, mesh or point list; for OpenCascade shapes `options` is an `Inputs.Draw.DrawOcctShapeOptions`, with `faceColour`, `edgeColour`, `edgeWidth` and `precision`, the meshing tolerance. Draw the finished part rather than every step.\n- **STEP**, the exact format other CAD tools open: `io.saveShapeSTEPAndReturn` through the worker, `io.saveShapeSTEP` on the in-process service in Node, both giving the file's text in millimetres, the shape scaled from the `unit` it is modelled in when one is given. Most CAD tools are Z-up: turn the part first with `transforms.rotate({ shape, axis: [1, 0, 0], angle: 90 })`, which takes Y up to Z and keeps the part as it was built. The `adjustYtoZ` option swaps Y and Z instead, which mirrors the part: it matches what a left-handed Babylon.js scene shows.\n- **STL** for printing: `io.saveShapeStlAndReturn` through the worker, `io.saveShapeStl` in Node, with `precision` as the meshing tolerance and `binary` for the smaller form. Turn the part as for STEP.\n- **Drawings and assemblies.** `io.shapeToDxfPaths` and `io.dxfCreate` write a DXF of flat geometry, and the documents of `occt.assembly.manager` hold several parts with names, colours and placements, written to one STEP file with `occt.assembly.manager.exportDocumentToStep`.",
|
|
171
171
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/cad-geometry"
|
|
172
172
|
},
|
|
173
173
|
{
|
|
@@ -202,7 +202,7 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
202
202
|
"id": "a-first-document",
|
|
203
203
|
"title": "A first document",
|
|
204
204
|
"level": 2,
|
|
205
|
-
"body": "A plate with two holes and rounded top edges, made of aluminium, with a part number written from its size:\n\n```json title=\"bracket.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.
|
|
205
|
+
"body": "A plate with two holes and rounded top edges, made of aluminium, with a part number written from its size:\n\n```json title=\"bracket.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.6.0-rc.0/schemas/design-document/experimental.json\",\n \"schemaVersion\": 1,\n \"id\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\",\n \"meta\": { \"name\": \"Bracket\" },\n \"parameters\": {\n \"width\": { \"value\": 60, \"min\": 30, \"unit\": \"mm\" },\n \"depth\": { \"value\": 40, \"min\": 20, \"unit\": \"mm\" },\n \"thickness\": { \"value\": 6, \"min\": 2, \"unit\": \"mm\" },\n \"hole\": { \"value\": 6, \"min\": 2, \"max\": 12, \"unit\": \"mm\" }\n },\n \"features\": [\n {\n \"id\": \"base\", \"type\": \"sketch\", \"on\": { \"plane\": \"XY\" }, \"start\": [0, 0],\n \"pen\": [\n { \"type\": \"hLine\", \"id\": \"south\", \"length\": \"width\" },\n { \"type\": \"vLine\", \"id\": \"east\", \"length\": \"depth\" },\n { \"type\": \"hLine\", \"id\": \"north\", \"length\": \"-width\" },\n { \"type\": \"close\", \"id\": \"west\" }\n ]\n },\n { \"id\": \"plate\", \"type\": \"extrude\", \"profile\": \"base\", \"distance\": \"thickness\" },\n {\n \"id\": \"holes\", \"type\": \"hole\", \"body\": \"plate\",\n \"on\": { \"of\": \"plate\", \"role\": \"end\", \"count\": 1 },\n \"at\": [{ \"id\": \"left\", \"x\": 10, \"y\": \"depth / 2\" }, { \"id\": \"right\", \"x\": \"width - 10\", \"y\": \"depth / 2\" }],\n \"diameter\": \"hole\"\n },\n {\n \"id\": \"round\", \"type\": \"fillet\", \"body\": \"plate\", \"radius\": 2,\n \"edges\": { \"between\": [{ \"of\": \"plate\", \"role\": \"end\" }, { \"of\": \"plate\", \"role\": \"side\" }], \"count\": 4 }\n }\n ],\n \"materials\": [\n { \"id\": \"aluminium\", \"density\": 2700, \"appearance\": { \"color\": \"#b0b4b8\", \"metallic\": 0.8, \"roughness\": 0.4 } }\n ],\n \"parts\": [\n {\n \"id\": \"bracket\", \"name\": \"Bracket\", \"body\": \"plate\", \"material\": \"aluminium\",\n \"properties\": { \"partNumber\": \"BRK-{width}x{depth}\" },\n \"connectors\": [\n { \"id\": \"pivotTop\", \"on\": { \"of\": \"plate\", \"role\": \"end\", \"count\": 1 }, \"axis\": { \"of\": \"holes\", \"role\": \"wall\", \"from\": \"left\" } },\n { \"id\": \"pivotBottom\", \"on\": { \"of\": \"plate\", \"role\": \"start\", \"count\": 1 }, \"axis\": { \"of\": \"holes\", \"role\": \"wall\", \"from\": \"left\" } }\n ]\n }\n ]\n}\n```\n\n- The sketch draws a rectangle with a pen: each command moves from where the last one ended, and `close` returns to `start`. The command ids name the four side faces the extrude sweeps from them.\n- The extrude starts a body named `plate`. Its bottom face is `start`, its top `end` and its walls `side`.\n- The holes are placed on the face the reference `{ \"of\": \"plate\", \"role\": \"end\", \"count\": 1 }` names, at x and y on that face. Each position has an id, so a later reference can name one hole's wall.\n- The fillet rounds the edges between the top and the walls: exactly 4, or the build reports otherwise.\n- The connectors are frames where an assembly fastens the part: on the top and the bottom face, at the left hole's axis.",
|
|
206
206
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
@@ -216,14 +216,14 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
216
216
|
"id": "sketches",
|
|
217
217
|
"title": "Sketches",
|
|
218
218
|
"level": 2,
|
|
219
|
-
"body": "- `on` places the sketch: `{ \"plane\": \"XY\" }` (or `XZ`, `YZ`, with an `offset`), `{ \"frame\": { \"origin\", \"normal\", \"direction\" } }`, or `{ \"face\": <face reference>, \"origin\": [...], \"direction\": [...] }` on a flat face of a body. A sketch on a face follows the face when parameters move it.\n- `pen` draws one outline from `start`: `line` (to a point), `hLine` and `vLine` (a length along x or y, negative for the other way), `polarLine`, `tangentLine`, `threePointArc`, `tangentArc`, `sagittaArc`, `bulgeArc`, `quadratic`, `cubic`, `close`, and `filletCorner` and `chamferCorner`, which round or bevel the corner between the commands before and after them.\n- A sketch with no `pen` and no `loops` draws nothing yet: it is only its plane, which an editor draws on, and a feature that uses it fails until it draws something.\n- An outline that ends with `close`, or back at its `start`, is closed, and a closed outline is a face. `\"face\": false` keeps it a wire, such as a closed path to sweep along; an open outline is always a wire.\n- `circle` draws an exact circle as one closed edge: `{ \"type\": \"circle\", \"id\": \"bore\", \"centre\": [0, 0], \"radius\": 5 }`.\n- `loops` draws several outlines in one sketch, the first the outside and each further one a hole in it, so one sketch makes a washer: `\"loops\": [{ \"start\": [-15, -15], \"pen\": [...] }, { \"pen\": [{ \"type\": \"circle\", ... }] }]`.\n- **Give an id to every command a later feature refers to.** A side face is named after the command it was swept from; a command without an id has no name a reference can use.",
|
|
219
|
+
"body": "- `on` places the sketch: `{ \"plane\": \"XY\" }` (or `XZ`, `YZ`, with an `offset`), `{ \"frame\": { \"origin\", \"normal\", \"direction\" } }`, or `{ \"face\": <face reference>, \"origin\": [...], \"direction\": [...] }` on a flat face of a body. A sketch on a face follows the face when parameters move it.\n- `pen` draws one outline from `start`: `line` (to a point), `hLine` and `vLine` (a length along x or y, negative for the other way), `polarLine`, `tangentLine`, `threePointArc`, `tangentArc`, `sagittaArc`, `bulgeArc`, `quadratic`, `cubic`, `close`, and `filletCorner` and `chamferCorner`, which round or bevel the corner between the commands before and after them.\n- A sketch with no `pen` and no `loops` draws nothing yet: it is only its plane, which an editor draws on, and a feature that uses it fails until it draws something.\n- An outline that ends with `close`, or back at its `start`, is closed, and a closed outline is a face. `\"face\": false` keeps it a wire, such as a closed path to sweep along; an open outline is always a wire.\n- `circle` draws an exact circle as one closed edge: `{ \"type\": \"circle\", \"id\": \"bore\", \"centre\": [0, 0], \"radius\": 5 }`.\n- `gear` draws an involute spur gear's outline as `occt.parts.mechanical.gears.spurGearProfile` does: `{ \"type\": \"gear\", \"id\": \"teeth\", \"centre\": [0, 0], \"module\": 2, \"teeth\": 24 }`, with `pressureAngle`, `profileShift`, `backlash`, `addendum`, `dedendum`, `rootFillet` and `rotation` (in degrees) when the defaults do not fit. Like a circle it is a loop by itself. Its side faces are named by its id and their part: `\"from\": \"profile.teeth.tip\"`, `\"profile.teeth.flank\"` or `\"profile.teeth.root\"`. Two gears mesh when they share `module` and `pressureAngle` and stand `module * (teeth + otherTeeth) / 2` apart. With `\"internal\": true` it draws the teeth of a ring gear instead, pointing in toward `centre` as `occt.parts.mechanical.gears.ringGearProfile` draws them, so it belongs in a hole loop inside a larger circle; a ring takes no `profileShift`, needs about 34 teeth or more at 20 degrees, and holds a gear `module * (teeth - otherTeeth) / 2` from its centre.\n- `rack` draws an involute rack as `occt.parts.mechanical.gears.rackProfile` does: `{ \"type\": \"rack\", \"id\": \"rack\", \"start\": [0, 0], \"module\": 2, \"teeth\": 12, \"height\": 6 }`, with `angle` (in degrees, turning it from running along +x), `pressureAngle`, `backlash`, `addendum`, `dedendum` and `rootFillet` when the defaults do not fit. `start` is where the first tooth's middle sits on the pitch line, and the teeth point to the left of the rack's run. It is a loop by itself, and its side faces are named by its id and their part: `\"profile.rack.tip\"`, `.flank`, `.root`, `.back` and `.side` (its two ends). A gear of the same module meshes with its centre `module * teeth / 2` from the pitch line, and turning it by `a` degrees moves the rack `pi * module * teeth / 2 * a / 180`.\n- `loops` draws several outlines in one sketch, the first the outside and each further one a hole in it, so one sketch makes a washer: `\"loops\": [{ \"start\": [-15, -15], \"pen\": [...] }, { \"pen\": [{ \"type\": \"circle\", ... }] }]`.\n- **Give an id to every command a later feature refers to.** A side face is named after the command it was swept from; a command without an id has no name a reference can use.",
|
|
220
220
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
"id": "features",
|
|
224
224
|
"title": "Features",
|
|
225
225
|
"level": 2,
|
|
226
|
-
"body": "| Feature | What it does | Faces it names |\n|---|---|---|\n| `extrude` | sweeps a sketch `distance` along its normal | `start`, `end`, `side` (per command) |\n| `revolve` | turns a sketch about an `axis` | `start`, `end`, `side` |\n| `sweep` | sweeps a profile along a `path` sketch | `start`, `end`, `side` |\n| `loft` | skins two or more sketches in order | `start`, `end`, `side` |\n| `boolean` | `union`, `difference` or `intersection` of `body` with `tools` | `new` for faces no input had |\n| `fillet` | rounds the `edges` a reference names | `round` |\n| `chamfer` | bevels them | `bevel` |\n| `shell` | hollows a body, leaving the `open` faces open, including bodies rounded all round when the open faces are flat | `rim`, `inner` |\n| `hole` | drills holes `at` positions on a face, with counterbores or countersinks | `wall` (per position id) |\n| `boss` | raises a sketch on a face | `side`, `end` |\n| `pocket` | sinks a sketch into a face, a `distance`, `until` a face or `through` | `side`, `end` |\n| `linearPattern`, `polarPattern` | repeats a body `count` times | copies picked with `copy` |\n| `mirror` | mirrors a body across a plane | the image is copy 1 |\n| `pushPull` | moves a face of a body along its normal: out when `distance` is above 0, in when below; `mode` `extrude`, the default, sweeps one flat face straight and adds or cuts the swept solid, `offset` moves the faces themselves, flat or curved, the faces around them stretching to follow, and with a `count` the reference may name several faces | `end` (the moved faces, which keep their names), `side` (the faces an extrude sweeps out) |\n| `removeFaces` | removes the `count` faces a reference names and closes the gap from the faces around them: a hole's wall fills the hole, a round sharpens its edge | keeps every name the faces that stay had |\n| `transform` | moves a body: turns it `rotate` degrees about X, Y and Z through a `pivot`, then shifts it by `translate` | keeps every name it had |\n| `import` | starts a body from a STEP, IGES or BREP asset pinned by its SHA-256 | `face` (per index) |\n| `operation` | calls any method of the package by its path, such as `\"occt.shapes.shape.unifySameDomain\"` | carried through history, otherwise `face` |\n| `script` | runs code from an asset pinned by its SHA-256, outside the kernel, on bodies, references and values | the roles the script returns, otherwise `face` |\n\nFeatures that make a solid start a body named by their id, or join the body they name with `\"body\": \"<id>\"` and `\"join\": \"add\"`, `\"cut\"` or `\"intersect\"`.",
|
|
226
|
+
"body": "| Feature | What it does | Faces it names |\n|---|---|---|\n| `extrude` | sweeps a sketch `distance` along its normal | `start`, `end`, `side` (per command) |\n| `revolve` | turns a sketch about an `axis` | `start`, `end`, `side` |\n| `sweep` | sweeps a profile along a `path` sketch | `start`, `end`, `side` |\n| `loft` | skins two or more sketches in order | `start`, `end`, `side` |\n| `boolean` | `union`, `difference` or `intersection` of `body` with `tools` | `new` for faces no input had |\n| `fillet` | rounds the `edges` a reference names | `round` |\n| `chamfer` | bevels them | `bevel` |\n| `shell` | hollows a body, leaving the `open` faces open, including bodies rounded all round when the open faces are flat | `rim`, `inner` |\n| `hole` | drills holes `at` positions on a face, `diameter` across or sized by a `fastener` such as `{ \"size\": \"M6\", \"fit\": \"tapped\" }` or, for an inch screw, `{ \"standard\": \"ansi\", \"size\": \"1/4\", \"series\": \"UNC\", \"fit\": \"tapped\" }` (`close`, `normal`, `loose` or `tapped`; `\"head\": \"socket\"` adds the counterbore for a socket head cap screw), in the document's unit whichever standard it is, with counterbores or countersinks | `wall` (per position id); a tapped hole's walls are also `thread`, and `design.clashes` leaves out a fastener's thread resting on them |\n| `boss` | raises a sketch on a face | `side`, `end` |\n| `pocket` | sinks a sketch into a face, a `distance`, `until` a face or `through` | `side`, `end` |\n| `keyway`, `flat`, `ringGroove`, `knurl`, `spline`, `thread` | machine the one cylindrical face `on` names, `at` a distance along its axis from its start (the end the nearest world axis points away from; `flip` starts from the other): a `keyway` in a shaft or through a hub's bore, a `flat` `depth` deep, the groove a retaining ring sits in, a `knurl` (`straight`, `left`, `right` or `diamond`), `spline` teeth in a bore, a `thread` outside a shaft of its size or inside a bore drilled for its tap (`size` such as `\"M8\"` or `\"1/4\"` is found from the diameter when left out). `standard` picks the tables: `din` (DIN 6885 keys, DIN 471 and 472 rings, DIN 82 knurls by `pitch`, DIN 5480 splines by `module`) or `ansi` (B17.1 keys, B18.27 rings, B94.6 knurls by `diametralPitch`, B92.1 splines by `pitch` such as `\"16/32\"` and `teeth`), and for a thread `iso` or `ansi` (Unified, with `series` `UNC` or `UNF`, or `threadsPerInch`); `angle` turns a keyway or flat about the axis from world X (world Y on an axis along X); all sized for the face's diameter | `keyway`, `flat`, `groove`, `knurl`, `spline`, `thread` |\n| `linearPattern`, `polarPattern` | repeats a body `count` times | copies picked with `copy` |\n| `mirror` | mirrors a body across a plane | the image is copy 1 |\n| `pushPull` | moves a face of a body along its normal: out when `distance` is above 0, in when below; `mode` `extrude`, the default, sweeps one flat face straight and adds or cuts the swept solid, `offset` moves the faces themselves, flat or curved, the faces around them stretching to follow, and with a `count` the reference may name several faces | `end` (the moved faces, which keep their names), `side` (the faces an extrude sweeps out) |\n| `removeFaces` | removes the `count` faces a reference names and closes the gap from the faces around them: a hole's wall fills the hole, a round sharpens its edge | keeps every name the faces that stay had |\n| `transform` | moves a body: turns it `rotate` degrees about X, Y and Z through a `pivot`, then shifts it by `translate` | keeps every name it had |\n| `import` | starts a body from a STEP, IGES or BREP asset pinned by its SHA-256; `child` takes one shape of a compound, such as one part of the shapes file `fromStep` writes | `face` (per index) |\n| `operation` | calls any method of the package by its path, such as `\"occt.shapes.shape.unifySameDomain\"`, `\"occt.parts.mechanical.gears.spurGear\"`, `\"occt.parts.mechanical.fasteners.iso.socketHeadCapScrew\"` (or `fasteners.ansi` for an inch one), `\"occt.parts.mechanical.springs.compressionSpring\"` or `\"occt.parts.mechanical.bearings.iso.ballBearing\"`; a method that takes a `unit` builds in the document's, so leave `unit` out | the roles a part names, such as a gear's `tip`, `flank`, `root`, `bore`, `rim`, `start` and `end`, a screw's `head`, `recess`, `seat`, `shank`, `thread` and `end`, or a bearing's `bore`, `outside`, `innerStart`, `innerEnd`, `outerStart` and `outerEnd`; otherwise carried through history, otherwise `face`. `{ \"expr\": ... }` in `params` passes a number, or text such as a choice parameter's `\"M8\"` |\n| `script` | runs code from an asset pinned by its SHA-256, outside the kernel, on bodies, references and values | the roles the script returns, otherwise `face` |\n\nFeatures that make a solid start a body named by their id, or join the body they name with `\"body\": \"<id>\"` and `\"join\": \"add\"`, `\"cut\"` or `\"intersect\"`.",
|
|
227
227
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
228
228
|
},
|
|
229
229
|
{
|
|
@@ -251,14 +251,14 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
251
251
|
"id": "assemblies",
|
|
252
252
|
"title": "Assemblies",
|
|
253
253
|
"level": 2,
|
|
254
|
-
"body": "An assembly places parts of other documents. The documents are given to the build beside it, keyed by their `id`; the runner fetches nothing.\n\n```json title=\"hinge.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.
|
|
254
|
+
"body": "An assembly places parts of other documents. The documents are given to the build beside it, keyed by their `id`; the runner fetches nothing.\n\n```json title=\"hinge.design.json\"\n{\n \"$schema\": \"https://git-cdn.bitbybit.dev/v1.6.0-rc.0/schemas/design-document/experimental.json\",\n \"schemaVersion\": 1,\n \"kind\": \"assembly\",\n \"meta\": { \"name\": \"Swivel pair\" },\n \"parameters\": {\n \"swing\": { \"value\": 30, \"min\": 0, \"max\": 90, \"unit\": \"deg\" }\n },\n \"components\": [\n { \"id\": \"lower\", \"source\": { \"document\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\", \"part\": \"bracket\" } },\n { \"id\": \"upper\", \"source\": { \"document\": \"3f1c2a7e-8b4d-4c1a-9e2f-5d6b7a8c9e01\", \"part\": \"bracket\", \"parameters\": { \"width\": 80 } } }\n ],\n \"joints\": [\n {\n \"id\": \"pivot\", \"type\": \"revolute\", \"component\": \"upper\", \"connector\": \"pivotBottom\",\n \"to\": { \"component\": \"lower\", \"connector\": \"pivotTop\" },\n \"angle\": \"swing\", \"limits\": { \"angle\": [0, 90] }\n }\n ]\n}\n```\n\n- Build it with the documents it places: `build({ document: hinge, documents: [bracket] })`. The result has the parts, every placed occurrence with its matrix, the bill of materials, and the structure that `assembly.manager.buildAssemblyDocument` exports to STEP and glTF.\n- **Joints** put a component's connector against another's, faces meeting and facing each other: `fastened` moves nothing, `revolute` turns by `angle` about the shared axis, `slider` moves by `offset` along it, `cylindrical` does both. `flip` makes the faces face the same way, `limits` bound what may move, and joints form a tree.\n- **`replicate`** places a component on every member of a connector set, such as a bolt in every hole of a flange: `\"replicate\": { \"connector\": \"seat\", \"to\": { \"component\": \"flange\", \"connector\": \"bolts\" } }`.\n- **`pattern`** places copies of a component where it is placed, turned about an axis or stepped along a direction, such as the blades of a fan: `\"pattern\": { \"polar\": { \"axis\": { \"origin\": [0, 0, 0], \"direction\": [1, 0, 0] }, \"count\": \"blades\" } }`, or `{ \"linear\": { \"direction\": [1, 0, 0], \"spacing\": 25, \"count\": 4 } }`. A polar pattern spaces its copies as the `polarPattern` feature does: a whole turn shared out, a part of one (`angle`) with both ends included, the first turned by `start`. Each copy is an occurrence of its own, `blade.1`, `blade.2` and so on, counted in the bill of materials. A patterned component is not moved by a joint or joined to; to turn a row of blades, pattern them inside a sub-assembly and join that.\n- A component's `source.parameters` drive the placed document's values from the assembly's own, so one parameter can size several parts.\n- **A gear pair** is one gear part document placed twice: its `module`, `teeth`, `width`, `bore` and `backlash` parameters feed a `gear` loop and a `circle` bore, an extrude, and a connector `{ \"id\": \"axis\", \"on\": { \"of\": \"gear\", \"role\": \"start\" } }`. Each component sets its `teeth` in `source.parameters`, and a revolute joint per gear holds its `axis` against a frame or a plate, `module * (teeth + otherTeeth) / 2` apart. Drive both angles from one parameter: `\"turn\"` on the first, `\"180 / 30 - turn * 20 / 30\"` on a 30-tooth second for a 20-tooth first, so the teeth fall into each other's gaps; `design.clashes` at a few values of `turn` through one tooth of the first proves they mesh.\n- **A standard part document** is one `operation` feature of `occt.parts` sized by its parameters, such as `{ \"id\": \"screw\", \"type\": \"operation\", \"operation\": \"occt.parts.mechanical.fasteners.iso.socketHeadCapScrew\", \"params\": { \"size\": { \"expr\": \"size\" }, \"length\": { \"expr\": \"length\" } } }` with `size` a choice parameter of `\"M3\"`, `\"M4\"` and so on (`fasteners.ansi` takes `\"#10\"`, `\"1/4\"` and a `series`), built in the document's unit, and connectors on the roles it names: a screw's `{ \"on\": { \"of\": \"screw\", \"role\": \"seat\" }, \"axis\": { \"of\": \"screw\", \"role\": \"thread\" } }`, a nut's or a washer's `seat` and `top`, a bearing's `innerStart` or `outerStart` with the `bore` or `outside` axis, a spring's `bottom` and `top`. Each component sets its own size, so one document places every screw of an assembly, and `replicate` puts one in every hole of a set.\n- An assembly may publish `connectors` of its components, so a larger assembly can join it as one unit.\n- **From a STEP file:** `occt.design.fromStep({ step, name })` writes an assembly document per assembly and a part document per part, placed `at` the file's frames, with names and colours, every part importing one shapes file by `child`. Store `assets[0].data` at its `uri`, then build the `root` document with `documents` and `assets: { [assets[0].id]: assets[0].data }`; `report.notes` says what changed on the way, such as a mirrored placement built into a part of its own.\n- **Section a build:** `occt.design.section({ build, frame })` cuts what `build` returned with the plane of a frame, taking away what lies on the side its normal points to, and gives a cap for each part the plane passes through, the faces it cuts with their `area`. With `cut: true` the pieces behind the plane and the parts wholly behind it come too, each with its `volume`. The result is placed like the build's parts, so `draw.drawAnyAsync({ entity: section })` draws it, and the same frame given to `operations.hiddenLines` looks at the cut.",
|
|
255
255
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
258
|
"id": "mistakes-to-avoid",
|
|
259
259
|
"title": "Mistakes to avoid",
|
|
260
260
|
"level": 2,
|
|
261
|
-
"body": "- **Indexes in references.** Never write a face or edge by its number. Name it by the feature and role that made it.\n- **Missing command and position ids.** A side or a hole wall that a later feature names needs an id where it was drawn.\n- **Edge references without `count`.** They are refused; count the edges you mean.\n- **Operations without the kernel.** An `operation` path starts with the kernel: `\"occt.fillets.filletEdges\"`, not `\"fillets.filletEdges\"`. Look its inputs up with the MCP's `describe` before writing them, and pass bodies as `{ \"body\": \"<id>\" }`.\n- **Guessed units.** Lengths are in the document's `units.length`, millimetres when left out, and angles in degrees.\n- **Fields that do not exist.** The schema and `validate` refuse unknown properties. Check them rather than inventing a plausible one.\n- **Building before validating.** `validate` reports every problem at once with a pointer to it; a build stops at the first feature that fails and skips what depends on it.",
|
|
261
|
+
"body": "- **Indexes in references.** Never write a face or edge by its number. Name it by the feature and role that made it.\n- **Missing command and position ids.** A side or a hole wall that a later feature names needs an id where it was drawn.\n- **Edge references without `count`.** They are refused; count the edges you mean.\n- **Operations without the kernel.** An `operation` path starts with the kernel: `\"occt.fillets.filletEdges\"`, not `\"fillets.filletEdges\"`. Look its inputs up with the MCP's `describe` before writing them, and pass bodies as `{ \"body\": \"<id>\" }`.\n- **Guessed units.** Lengths are in the document's `units.length` (`mm`, `cm`, `m` or `in`), millimetres when left out, and angles in degrees. An inch document holds inch numbers: a 1/4 inch plate is `0.25` thick, and its standard parts and fastener holes are sized in inches, ISO and ANSI alike. A STEP export states the document's unit; a glTF one holds the numbers as they are unless it is given the unit (`unit` on `exportDocumentToGltf`, `outputs.unit` on CAD Cloud), when it is written in metres, the unit glTF viewers assume.\n- **Fields that do not exist.** The schema and `validate` refuse unknown properties. Check them rather than inventing a plausible one.\n- **Building before validating.** `validate` reports every problem at once with a pointer to it; a build stops at the first feature that fails and skips what depends on it.",
|
|
262
262
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/design-documents"
|
|
263
263
|
},
|
|
264
264
|
{
|
|
@@ -286,7 +286,7 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
286
286
|
"id": "the-order-to-write-a-building-in",
|
|
287
287
|
"title": "The order to write a building in",
|
|
288
288
|
"level": 2,
|
|
289
|
-
"body": "Later calls refer to what earlier calls made, so this order avoids every \"not found\" error:\n\n1. **The model and its storeys**: `model.create`, then `spatial.addStorey` per floor with its `elevation`.\n2. **Materials and layer sets**: `materials.add` (a name, an optional `color` such as `\"#b5651d\"`), then `materials.addLayerSet` with `layers: [{ material: \"Brick\", thickness: 235 }, { material: \"Plaster\", thickness: 15 }]`. Walls, wall types, slabs and roofs refer to a layer set by its name; a layer set's thicknesses add up to the element's thickness.\n3. **Types**: `walls.addType`, `doors.addType` and `windows.addType`. A door or window type is placed many times through shared geometry, so define each size once.\n4. **Walls**: `walls.add` per straight wall, from `start` to `end`, with a `height` and a `layerSet` or a `thickness`. `alignment` says which side of the axis the layers lie on, looking from `start` to `end`: walls drawn counterclockwise around a plan lie inside it with `left` and outside with `right`, so with `left` the plan's corners are the building's outer faces.\n5. **Joins**: `walls.connect` for every pair of walls that meet, at a corner or where one ends against another's side. Unjoined walls overlap or leave gaps at the corners. A wall that ends against another, such as a partition against an outside wall, may end anywhere within that wall's thickness: the join cuts it back to the face.\n6. **Doors, windows and openings**: `doors.add` and `windows.add` place a type in a wall `offset` along its axis from its start, and cut their own opening; do not add an opening for them as well. `openings.add` cuts an empty opening. A window's `sill` defaults to 900 mm above the wall's base, a door's to 0. Keep an opening at least the wall's thickness away from a mitred corner: the offset runs along the axis, and the face on the other side of a corner is shorter by the thickness. A door type's `operation` names its hinges as IFC does, seen from the wall's right side, its start on your left: `singleSwingLeft` is hinged toward the wall's start, `singleSwingRight` toward its end, and the handle is on the other edge.\n7. **Slabs**: `slabs.add` with an `outline`, `thickness` or `layerSet` and `topOffset` above the storey's floor; `holes` or `openings.addInSlab` for stairwells and shafts. A floor over a storey whose walls run up to it fits between their inner faces: an outline at the outer faces puts the slab and the top of the walls in the same space.\n8. **Roofs**: `roofs.add` over a rectangle of four corners (`kind`: `flat`, `monoPitch`, `gable`, `hip`), with `baseOffset` the height of the walls under it and an `overhang`. A mono-pitch roof rises from the outline's first side and a gable's ridge runs along it. Then `walls.clipByRoof` for each wall it covers. A wall under a slope is added taller than `baseOffset`, up to the ridge at most, and clipping cuts it to the slope, a gable wall to its triangle; a wall added exactly at `baseOffset` is left square, with a wedge open under the slope.\n9. **Structure and detail**: `columns.add`, `beams.add` and `members.add` with a `profile` (`rectangle`, `circle`, `iShape`); `assemblies.add` to group parts such as a facade's cladding boards.\n10. **Rooms**: `spaces.add` per room, with its `name` (the room number), `longName` and `height`.\n11. **Data**: `properties.addSet`, such as `Pset_WallCommon` with `IsExternal: true` shared by every outside wall. A property's value is written as a label, boolean, integer or real as it is, or as the `type` it names: any of IFC4's `IfcValue` types, such as `IfcText`, `IfcLengthMeasure` or `IfcThermalTransmittanceMeasure` for a U-value.\n12. **Quantities last**: `quantities.compute` measures every element as it is now; compute again after any later change.\n13. **Write**: `model.writeBytes` (any size) or `model.write` (the text).",
|
|
289
|
+
"body": "Later calls refer to what earlier calls made, so this order avoids every \"not found\" error:\n\n1. **The model and its storeys**: `model.create`, then `spatial.addStorey` per floor with its `elevation`.\n2. **Materials and layer sets**: `materials.add` (a name, an optional `color` such as `\"#b5651d\"`), then `materials.addLayerSet` with `layers: [{ material: \"Brick\", thickness: 235 }, { material: \"Plaster\", thickness: 15 }]`. Walls, wall types, slabs and roofs refer to a layer set by its name; a layer set's thicknesses add up to the element's thickness.\n3. **Types**: `walls.addType`, `doors.addType` and `windows.addType`. A door or window type is placed many times through shared geometry, so define each size once.\n4. **Walls**: `walls.add` per straight wall, from `start` to `end`, with a `height` and a `layerSet` or a `thickness`. `alignment` says which side of the axis the layers lie on, looking from `start` to `end`: walls drawn counterclockwise around a plan lie inside it with `left` and outside with `right`, so with `left` the plan's corners are the building's outer faces.\n5. **Joins**: `walls.connect` for every pair of walls that meet, at a corner or where one ends against another's side. Unjoined walls overlap or leave gaps at the corners. A wall that ends against another, such as a partition against an outside wall, may end anywhere within that wall's thickness: the join cuts it back to the face.\n6. **Doors, windows and openings**: `doors.add` and `windows.add` place a type in a wall `offset` along its axis from its start, and cut their own opening; do not add an opening for them as well. `openings.add` cuts an empty opening. A window's `sill` defaults to 900 mm above the wall's base, a door's to 0. Keep an opening at least the wall's thickness away from a mitred corner: the offset runs along the axis, and the face on the other side of a corner is shorter by the thickness. A door type's `operation` names its hinges as IFC does, seen from the wall's right side, its start on your left: `singleSwingLeft` is hinged toward the wall's start, `singleSwingRight` toward its end, and the handle is on the other edge.\n7. **Slabs**: `slabs.add` with an `outline`, `thickness` or `layerSet` and `topOffset` above the storey's floor; `holes` or `openings.addInSlab` for stairwells and shafts. A floor over a storey whose walls run up to it fits between their inner faces: an outline at the outer faces puts the slab and the top of the walls in the same space.\n8. **Roofs**: `roofs.add` over a rectangle of four corners (`kind`: `flat`, `monoPitch`, `gable`, `hip`), with `baseOffset` the height of the walls under it and an `overhang`. A mono-pitch roof rises from the outline's first side and a gable's ridge runs along it. Then `walls.clipByRoof` for each wall it covers. A wall under a slope is added taller than `baseOffset`, up to the ridge at most, and clipping cuts it to the slope, a gable wall to its triangle; a wall added exactly at `baseOffset` is left square, with a wedge open under the slope.\n9. **Structure and detail**: `columns.add`, `beams.add` and `members.add` with a `profile` (`rectangle`, `circle`, `iShape`); `assemblies.add` to group parts such as a facade's cladding boards; `elements.add` for anything else, its body an OpenCascade shape described with `occt.recipes.describe({ shape, ifcSurfaces: true })` or a mesh.\n10. **Rooms**: `spaces.add` per room, with its `name` (the room number), `longName` and `height`.\n11. **Data**: `properties.addSet`, such as `Pset_WallCommon` with `IsExternal: true` shared by every outside wall. A property's value is written as a label, boolean, integer or real as it is, or as the `type` it names: any of IFC4's `IfcValue` types, such as `IfcText`, `IfcLengthMeasure` or `IfcThermalTransmittanceMeasure` for a U-value.\n12. **Quantities last**: `quantities.compute` measures every element as it is now; compute again after any later change.\n13. **Write**: `model.writeBytes` (any size) or `model.write` (the text).",
|
|
290
290
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
291
291
|
},
|
|
292
292
|
{
|
|
@@ -307,21 +307,21 @@ export const GUIDES: readonly GuideSection[] = [
|
|
|
307
307
|
"id": "reading-and-changing-ifc-files",
|
|
308
308
|
"title": "Reading and changing IFC files",
|
|
309
309
|
"level": 2,
|
|
310
|
-
"body": "- `model.read` takes the text or the bytes of an `.ifc` file, such as `readFileSync(\"in.ifc\")` or `await file.arrayBuffer()`. It indexes the file without decoding it, so files of hundreds of megabytes open in seconds.\n- `model.elements` lists objects by IFC type, its subtypes included (`IfcWall`, `IfcBuildingElement`, or `IfcElement` for every element), optionally of one storey; `model.element` describes one; `model.getAttribute` and `model.setAttribute` read and set one attribute such as `Name` or `Tag`.\n- `properties.getSets` reads an object's property sets; `properties.setValues` changes one object's values, copying a set it shares with others first, so the others keep theirs.\n- `walls.parameters` and `walls.edit` read and change walls other tools wrote with an axis and layers; joined walls are trimmed again and the wall's openings move with it. `model.move` moves and turns any element, and `model.remove` takes it away with what only it uses.\n- **IFC2X3 files** are read, queried and written back, but not changed: `model.upgradeToIfc4` gives a model that can be.\n- `model.writeBytes` writes untouched entities back byte for byte, so a small change to a large file stays small. Prefer it to `model.write` for files read from elsewhere: a JavaScript string holds about 512 MB.",
|
|
310
|
+
"body": "- `model.read` takes the text or the bytes of an `.ifc` file, or the bytes of an `.ifczip` archive, such as `readFileSync(\"in.ifc\")` or `await file.arrayBuffer()`. It indexes the file without decoding it, so files of hundreds of megabytes open in seconds.\n- `model.elements` lists objects by IFC type, its subtypes included (`IfcWall`, `IfcBuildingElement`, or `IfcElement` for every element), optionally of one storey; `model.element` describes one; `model.getAttribute` and `model.setAttribute` read and set one attribute such as `Name` or `Tag`.\n- `properties.getSets` reads an object's property sets; `properties.setValues` changes one object's values, copying a set it shares with others first, so the others keep theirs.\n- `walls.parameters` and `walls.edit` read and change walls other tools wrote with an axis and layers; joined walls are trimmed again and the wall's openings move with it. `model.move` moves and turns any element, and `model.remove` takes it away with what only it uses.\n- **IFC2X3 files** are read, queried and written back, but not changed: `model.upgradeToIfc4` gives a model that can be.\n- **IFC4X3 files** are read with their own schema, queried, drawn and written back, but not changed. `model.summary` gives `editable` false for both.\n- `model.georeference` reads a model's map conversion (`crs`, `eastings`, `northings`) and its site's latitude and longitude.\n- `model.writeBytes` writes untouched entities back byte for byte, so a small change to a large file stays small. Prefer it to `model.write` for files read from elsewhere: a JavaScript string holds about 512 MB.",
|
|
311
311
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
"id": "drawing-an-ifc-model-and-exporting-step",
|
|
315
315
|
"title": "Drawing an IFC model and exporting STEP",
|
|
316
316
|
"level": 2,
|
|
317
|
-
"body": "In the browser, a model's recipe is built by a kernel and drawn:\n\n```typescript\nconst recipe = await bitbybit.ifc.geometry.recipe({ model });\nconst solids = await bitbybit.manifold.recipes.build({ recipe, adjustZtoY: true });\nawait bitbybit.draw.drawAnyAsync({ entity: solids });\n```\n\nThe solids come back one per root of the recipe, and `recipe.roots[i].tag` carries the element's `globalId`, `type`, `name` and, when its material has a colour, `rgba`. With the OpenCascade worker enabled as well, `ifc.geometry.toShapes` gives exact shapes and `ifc.geometry.toStep` the bytes of a STEP file, nested by site, building, storey and IFC class: `await bitbybit.ifc.geometry.toStep({ model, name: \"House\", fileName: \"house.step\" })`. A Babylon.js scene is left-handed unless told otherwise; set `scene.useRightHandedSystem = true` before drawing, or the building is mirrored.",
|
|
317
|
+
"body": "In the browser, a model's recipe is built by a kernel and drawn:\n\n```typescript\nconst recipe = await bitbybit.ifc.geometry.recipe({ model });\nconst solids = await bitbybit.manifold.recipes.build({ recipe, adjustZtoY: true });\nawait bitbybit.draw.drawAnyAsync({ entity: solids });\n```\n\nThe solids come back one per root of the recipe, and `recipe.roots[i].tag` carries the element's `globalId`, `type`, `name` and, when its material has a colour, `rgba`; `propertySets: true` adds its property set values, named like `Pset_WallCommon.IsExternal`. With the OpenCascade worker enabled as well, `ifc.geometry.toShapes` gives exact shapes and `ifc.geometry.toStep` the bytes of a STEP file, nested by site, building, storey and IFC class, each product carrying its property sets: `await bitbybit.ifc.geometry.toStep({ model, name: \"House\", fileName: \"house.step\" })`. A Babylon.js scene is left-handed unless told otherwise; set `scene.useRightHandedSystem = true` before drawing, or the building is mirrored.",
|
|
318
318
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
319
319
|
},
|
|
320
320
|
{
|
|
321
321
|
"id": "mistakes-to-avoid-in-ifc-models",
|
|
322
322
|
"title": "Mistakes to avoid in IFC models",
|
|
323
323
|
"level": 2,
|
|
324
|
-
"body": "- **Dropping the returned model.** `ifc.walls.add({ model, ... })` without `model =` changes nothing; the next call starts from the model before it.\n- **Mixing the two call forms.** In Node the package's methods are synchronous; `bitbybit.ifc` in the browser and in the editors is asynchronous and needs `await` on every call.\n- **Guessed units.** A wall `height: 3` in a millimetre model is 3 mm high. Give lengths in the model's unit, millimetres unless the model says otherwise.\n- **Y as up.** Plans are `[x, y]` and up is Z. A point written as `[x, height, y]` puts the building on its side.\n- **Unjoined walls.** Every corner and T junction needs `walls.connect`. Without it the walls overlap or leave a gap there, and other BIM tools show them as walls that do not meet.\n- **An opening for a door or window.** `doors.add` and `windows.add` cut their own; an extra `openings.add` in the same place is a second hole.\n- **Openings that do not fit.** An opening past the end of its wall is refused, but two that overlap, or one whose `sill` plus height rises above the wall, are not: keep the openings of a wall apart and under its top.\n- **The roof before its walls are clipped, or a roof that is not a rectangle.** `roofs.add` takes four corners, and walls are clipped with `walls.clipByRoof` after the roof exists.\n- **Quantities computed too early.** They are a snapshot; compute them once the model is finished, or again after a change.\n- **An assembly of a user-defined kind without words.** `assemblies.add` with `predefinedType` `userDefined` needs an `objectType` that says what it is, such as `\"Cladding\"`.\n- **Changing an IFC2X3 model.**
|
|
324
|
+
"body": "- **Dropping the returned model.** `ifc.walls.add({ model, ... })` without `model =` changes nothing; the next call starts from the model before it.\n- **Mixing the two call forms.** In Node the package's methods are synchronous; `bitbybit.ifc` in the browser and in the editors is asynchronous and needs `await` on every call.\n- **Guessed units.** A wall `height: 3` in a millimetre model is 3 mm high. Give lengths in the model's unit, millimetres unless the model says otherwise.\n- **Y as up.** Plans are `[x, y]` and up is Z. A point written as `[x, height, y]` puts the building on its side.\n- **Unjoined walls.** Every corner and T junction needs `walls.connect`. Without it the walls overlap or leave a gap there, and other BIM tools show them as walls that do not meet.\n- **An opening for a door or window.** `doors.add` and `windows.add` cut their own; an extra `openings.add` in the same place is a second hole.\n- **Openings that do not fit.** An opening past the end of its wall is refused, but two that overlap, or one whose `sill` plus height rises above the wall, are not: keep the openings of a wall apart and under its top.\n- **The roof before its walls are clipped, or a roof that is not a rectangle.** `roofs.add` takes four corners, and walls are clipped with `walls.clipByRoof` after the roof exists.\n- **Quantities computed too early.** They are a snapshot; compute them once the model is finished, or again after a change.\n- **An assembly of a user-defined kind without words.** `assemblies.add` with `predefinedType` `userDefined` needs an `objectType` that says what it is, such as `\"Cladding\"`.\n- **Changing an IFC2X3 or IFC4X3 model.** An IFC2X3 model refuses every change until `model.upgradeToIfc4`; an IFC4X3 model refuses every change.\n- **Fields that do not exist.** Look each method up with `describe`; its inputs, defaults and ranges come from the index, not from memory.",
|
|
325
325
|
"page": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/ifc-models"
|
|
326
326
|
}
|
|
327
327
|
];
|
package/src/tools/get-guide.ts
CHANGED
|
@@ -37,7 +37,7 @@ export const GUIDE_ALIASES: Readonly<Record<string, string>> = {
|
|
|
37
37
|
"design-mistakes": "mistakes-to-avoid",
|
|
38
38
|
geometry: "geometry-in-bitbybit",
|
|
39
39
|
cad: "geometry-in-bitbybit",
|
|
40
|
-
occt: "how-the-occt-kernel-thinks",
|
|
40
|
+
occt: "how-the-bitbybit-occt-kernel-thinks",
|
|
41
41
|
kernels: "which-kernel-to-use",
|
|
42
42
|
manifold: "manifold-and-jscad",
|
|
43
43
|
jscad: "manifold-and-jscad",
|