forgecad 0.9.2 → 0.9.3
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/LICENSE +7 -5
- package/README.md +1 -1
- package/README.public.md +24 -2
- package/dist/assets/{AdminPage-Bs4PiK00.js → AdminPage-4jihcEk_.js} +1 -1
- package/dist/assets/{BlogPage-DVmgN0ma.js → BlogPage-BvzruKtw.js} +1 -1
- package/dist/assets/{DocsPage-BP6wlsBN.js → DocsPage-DHbd-WS-.js} +13 -13
- package/dist/assets/{EditorApp-Arw2NnGJ.js → EditorApp-C5P2rBfh.js} +433 -84
- package/dist/assets/{EditorApp-VY9lXx0N.css → EditorApp-DS0AIUrZ.css} +25 -0
- package/dist/assets/{EmbedViewer-qgQiOahL.js → EmbedViewer-B70wQwlE.js} +2 -2
- package/dist/assets/{LandingPageProofDriven-DvhtmWOz.js → LandingPageProofDriven-DIsYTnep.js} +1 -1
- package/dist/assets/{PricingPage-Ck3CP2ti.css → PricingPage-BMedqFef.css} +48 -0
- package/dist/assets/{PricingPage-657oLvWh.js → PricingPage-YPOr12pP.js} +34 -6
- package/dist/assets/{SettingsPage-wNy3_2yn.js → SettingsPage-rntoyJ3b.js} +10 -13
- package/dist/assets/{app-BdBoMQeO.js → app-CWucmnLZ.js} +801 -1208
- package/dist/assets/cli/{render-Ci3jjyT1.js → render-DZHmUySW.js} +214 -23
- package/dist/assets/copy-CQKQppF-.js +8 -0
- package/dist/assets/{evalWorker-CMCAbK8r.js → evalWorker-C3dKxi9Y.js} +1117 -95
- package/dist/assets/{manifold-BMn-8Vf8.js → manifold-CQ3FhfWB.js} +1 -1
- package/dist/assets/{manifold-jlYQ6E5R.js → manifold-CU0G1yYL.js} +1 -1
- package/dist/assets/{manifold-DbyILno4.js → manifold-CYWZMfjB.js} +2 -2
- package/dist/assets/{renderSceneState-DAnqvxSt.js → renderSceneState-BBUrnsUN.js} +1 -1
- package/dist/assets/{reportWorker-BcRVMHK-.js → reportWorker-BhZ7DjxQ.js} +1091 -95
- package/dist/assets/{sectionPlaneMath-DXJ_TdIW.js → sectionPlaneMath-BxfokaJE.js} +1091 -95
- package/dist/cli/render.html +1 -1
- package/dist/docs/index.html +2 -2
- package/dist/docs-raw/AI/usage.md +182 -89
- package/dist/docs-raw/API/core/concepts.md +26 -0
- package/dist/docs-raw/CLI.md +58 -37
- package/dist/docs-raw/INDEX.md +81 -64
- package/dist/docs-raw/cli-monetization.md +9 -8
- package/dist/docs-raw/generated/concepts.md +111 -4
- package/dist/docs-raw/generated/core.md +2 -0
- package/dist/docs-raw/generated/curves.md +480 -1
- package/dist/docs-raw/generated/output.md +1 -0
- package/dist/docs-raw/generated/sketch.md +2 -0
- package/dist/docs-raw/generated/viewport.md +81 -3
- package/dist/docs-raw/product/user-outreach-email-templates.md +159 -0
- package/dist/docs-raw/skills/forgecad-image-replicator.md +1 -1
- package/dist/docs-raw/skills/forgecad-make-a-model.md +33 -4
- package/dist/docs-raw/skills/forgecad-prepare-prompt.md +1 -1
- package/dist/docs-raw/skills/forgecad-project.md +1 -1
- package/dist/docs-raw/skills/forgecad-render-inspect.md +1 -1
- package/dist/docs-raw/skills/forgecad.md +2 -1
- package/dist/docs-raw/welcome.md +85 -137
- package/dist/index.html +1 -1
- package/dist/llms.txt +4 -3
- package/dist/sitemap.xml +6 -6
- package/dist-cli/forgecad.js +1413 -219
- package/dist-cli/forgecad.js.map +1 -1
- package/dist-skill/CONTEXT.md +594 -5
- package/dist-skill/SKILL-dev.md +2 -1
- package/dist-skill/SKILL.md +2 -1
- package/dist-skill/docs/API/core/concepts.md +26 -0
- package/dist-skill/docs/CLI.md +58 -37
- package/dist-skill/docs/generated/core.md +2 -0
- package/dist-skill/docs/generated/curves.md +480 -1
- package/dist-skill/docs/generated/output.md +1 -0
- package/dist-skill/docs/generated/sketch.md +2 -0
- package/dist-skill/docs/generated/viewport.md +81 -3
- package/dist-skill/docs-dev/API/core/concepts.md +26 -0
- package/dist-skill/docs-dev/CLI.md +58 -37
- package/dist-skill/docs-dev/generated/core.md +2 -0
- package/dist-skill/docs-dev/generated/curves.md +480 -1
- package/dist-skill/docs-dev/generated/output.md +1 -0
- package/dist-skill/docs-dev/generated/sketch.md +2 -0
- package/dist-skill/docs-dev/generated/viewport.md +81 -3
- package/dist-skill/library/README.md +0 -1
- package/dist-skill/library/forgecad-image-replicator/SKILL.md +1 -1
- package/dist-skill/library/forgecad-make-a-model/SKILL.md +33 -4
- package/dist-skill/library/forgecad-prepare-prompt/SKILL.md +1 -1
- package/dist-skill/library/forgecad-project/SKILL.md +1 -1
- package/dist-skill/library/forgecad-render-inspect/SKILL.md +1 -1
- package/examples/api/conformal-product-ribbon.forge.js +77 -0
- package/examples/api/render-labels.forge.js +33 -0
- package/examples/api/text2d-basics.forge.js +6 -3
- package/package.json +1 -1
- package/dist-skill/library/forgecad-deep-dive/SKILL.md +0 -120
- package/dist-skill/library/forgecad-deep-dive/agents/openai.yaml +0 -4
- package/dist-skill/library/forgecad-deep-dive/references/output-shape.md +0 -64
package/dist/docs-raw/INDEX.md
CHANGED
|
@@ -1,96 +1,113 @@
|
|
|
1
1
|
# ForgeCAD Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Start here if you are new to ForgeCAD, setting up the CLI, or giving a project to an AI coding agent.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## The Happy Path
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **[Welcome](welcome.md)** - First model, first CLI loop, and first AI-assisted iteration
|
|
10
|
-
- **[AI Usage](AI/usage.md)** - Approved models, CLI validation loop, Codex/Claude Code setup, installable skills, and completion criteria for AI-authored models
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Operations & Runbook
|
|
7
|
+
ForgeCAD works best when every model lives in a real project folder:
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g forgecad
|
|
11
|
+
forgecad login
|
|
12
|
+
mkdir spool-adapter
|
|
13
|
+
cd spool-adapter
|
|
14
|
+
forgecad project init "Spool Adapter"
|
|
15
|
+
forgecad new adapter --template part
|
|
16
|
+
forgecad studio .
|
|
17
|
+
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
- **[Deployment & Environment](deployment.md)** — Kamal architecture, environment variables, deploy/rollback flow, database migrations
|
|
20
|
-
- **[Observability](platform/observability.md)** — Grafana, Loki, Prometheus, Uptime Kuma, dashboards, logs, metrics, incident debugging
|
|
21
|
-
- **[Releasing](RELEASING.md)** — npm version, publish workflow, GitHub Releases
|
|
19
|
+
Then let your AI agent work inside that same folder, validate the model from the terminal, and push the result back to the browser:
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
```bash
|
|
22
|
+
forgecad run adapter.forge.js
|
|
23
|
+
forgecad render inspect adapter.forge.js --channels rgb,mask,collisions --force
|
|
24
|
+
forgecad check params adapter.forge.js --samples 8
|
|
25
|
+
forgecad project push
|
|
26
|
+
forgecad project open
|
|
27
|
+
```
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
`forgecad studio` always needs an explicit project path. Use `.` for the current project. Do not point it at `~`, your whole desktop, downloads, or a huge source tree; ForgeCAD and AI agents need a small folder containing only the model, helper files, references, and generated evidence for that project.
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **[First Account Onboarding](product/onboarding-first-experience.md)** — Source of truth for new-account starter project, Welcome docs, and CLI bridge
|
|
30
|
-
- **[System Architecture](platform/architecture.md)** — Stack overview, URL routes, Docker topology, security
|
|
31
|
-
- **[Authentication](platform/auth.md)** — JWT tokens, OAuth (GitHub/Google), registration, password reset, session management
|
|
32
|
-
- **[Projects & Files](platform/projects.md)** — Project CRUD, member roles, file storage, storage quotas, SSE watching
|
|
33
|
-
- **[Model Sharing](platform/sharing.md)** — Publishing, public URLs, embeds, gist/URL/inline sharing
|
|
34
|
-
- **[Admin Dashboard](platform/admin.md)** — Admin panel, audit log, user management
|
|
35
|
-
- **[Email Delivery](platform/email.md)** — Resend setup, verification emails, password reset emails
|
|
31
|
+
## Start Here
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
- **[Welcome](welcome.md)** - First model, project setup, local editor, browser sync, and the AI-assisted loop.
|
|
34
|
+
- **[AI Usage](AI/usage.md)** - Approved models, project-first agent setup, skill installation, quality prompts, validation evidence, and media ideas.
|
|
35
|
+
- **[CLI Reference](CLI.md)** - Install, login, create projects, open local studios, run scripts, render, inspect, export, publish, and sync.
|
|
38
36
|
|
|
39
|
-
##
|
|
37
|
+
## Project Workflow
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
- **[Inspection Bundles](guides/inspection-bundles.md)** — `render inspect` bundle layout, channel encodings, manifest semantics, and agent workflow
|
|
43
|
-
- **[Monetization & Licensing](project/cli-monetization.md)** — Free vs Pro tiers, license activation, feature gating strategy
|
|
39
|
+
Use this section when the question is "how do I actually start?"
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
- **Create a new hosted project locally**: `forgecad project init "Project Name"` creates the remote project, writes `forgecad.json`, and uploads any existing local `.forge.js`, `.js`, and `.svg` files.
|
|
42
|
+
- **Clone an existing hosted project**: `forgecad project clone <slug>` downloads files and writes `forgecad.json`.
|
|
43
|
+
- **Open the local editor**: `forgecad studio .` opens the installed local editor around the current project folder.
|
|
44
|
+
- **Sync back to the browser**: `forgecad project push` uploads local changes for an initialized project. It does not create a remote project from a random folder; run `project init` first.
|
|
46
45
|
|
|
47
|
-
## API Reference
|
|
46
|
+
## API Reference
|
|
48
47
|
|
|
49
48
|
For users writing `.forge.js` scripts.
|
|
50
49
|
|
|
51
|
-
- **[API Overview](API/README.md)**
|
|
52
|
-
- **
|
|
53
|
-
- **
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
- **[
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
- **[API Overview](API/README.md)** - Reading plan and orientation
|
|
51
|
+
- **[Core](generated/core.md)** - Primitives, booleans, transforms, colors, materials, patterns, and shape operations
|
|
52
|
+
- **[Sketches](generated/sketch.md)** - 2D geometry, constraints, profiles, extrusion, offsets, and sketch-driven modeling
|
|
53
|
+
- **[Curves & Surfaces](generated/curves.md)** - Splines, lofts, sweeps, ruled surfaces, and exact surface workflows
|
|
54
|
+
- **[Assembly](generated/assembly.md)** - Parts, connectors, joints, kinematics, collision checks, and exploded views
|
|
55
|
+
- **[Output](generated/output.md)** - Exports, reports, BOMs, dimensions, robot packages, G-code, and manufacturing outputs
|
|
56
|
+
- **[Library](generated/lib.md)** - Gears, fasteners, pipes, pulleys, belts, springs, and reusable helpers
|
|
57
|
+
- **[Sheet Metal](generated/sheet-metal.md)** - Bends, flanges, flat patterns, reliefs, and sheet workflows
|
|
58
|
+
- **[Viewport](generated/viewport.md)** - Cameras, animations, labels, views, and scene controls
|
|
59
|
+
- **[SDF](generated/sdf.md)** - Organic fields, TPMS structures, smooth booleans, and implicit geometry
|
|
60
|
+
- **[Concepts](generated/concepts.md)** - Semantic data structures and conceptual building blocks
|
|
61
|
+
- **[Core Concepts](API/core/concepts.md)** - Permanent notes for core modeling concepts
|
|
62
|
+
|
|
63
|
+
## Guides
|
|
62
64
|
|
|
63
65
|
Techniques and conventions for model authors.
|
|
64
66
|
|
|
65
|
-
- **[Coordinate System](guides/coordinate-system.md)**
|
|
66
|
-
- **[Geometry Conventions](guides/geometry-conventions.md)**
|
|
67
|
-
- **[Positioning](guides/positioning.md)**
|
|
68
|
-
- **[Modeling Recipes](guides/modeling-recipes.md)**
|
|
69
|
-
- **[
|
|
67
|
+
- **[Coordinate System](guides/coordinate-system.md)** - Z-up convention, axis orientation
|
|
68
|
+
- **[Geometry Conventions](guides/geometry-conventions.md)** - Winding order, depth, normals
|
|
69
|
+
- **[Positioning](guides/positioning.md)** - Connectors, `matchTo()`, and placement strategies
|
|
70
|
+
- **[Modeling Recipes](guides/modeling-recipes.md)** - Common patterns, iteration, multi-file composition
|
|
71
|
+
- **[Joint Design](guides/joint-design.md)** - Connectors, joints, and mechanisms
|
|
72
|
+
- **[Inspection Bundles](guides/inspection-bundles.md)** - `render inspect` bundle layout, channel encodings, manifest semantics, and agent workflow
|
|
73
|
+
- **[Component Model](component-model.md)** - Recommended assembly structure for multi-part projects
|
|
74
|
+
- **[Skill Maintenance](guides/skill-maintenance.md)** - AI skill build process, `npm run refresh`
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
## Platform
|
|
72
77
|
|
|
73
|
-
|
|
78
|
+
Documentation for the hosted service at forgecad.io.
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
- **[First Account Onboarding](product/onboarding-first-experience.md)** - Source of truth for new-account starter project, Welcome docs, and CLI bridge
|
|
81
|
+
- **[User Outreach Email Templates](product/user-outreach-email-templates.md)** - Founder-style templates for Pro users, active users, team onboarding, and follow-ups
|
|
82
|
+
- **[System Architecture](platform/architecture.md)** - Stack overview, URL routes, Docker topology, security
|
|
83
|
+
- **[Authentication](platform/auth.md)** - JWT tokens, OAuth, registration, password reset, session management
|
|
84
|
+
- **[Projects & Files](platform/projects.md)** - Project CRUD, member roles, file storage, storage quotas, SSE watching
|
|
85
|
+
- **[Model Sharing](platform/sharing.md)** - Publishing, public URLs, embeds, gist/URL/inline sharing
|
|
86
|
+
- **[Admin Dashboard](platform/admin.md)** - Admin panel, audit log, user management
|
|
87
|
+
- **[Email Delivery](platform/email.md)** - Resend setup, verification emails, password reset emails
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
- **[Compiler](internals/compiler.md)** — Multi-backend architecture, compile plans, lowering
|
|
79
|
-
- **[Constraint Solver](internals/constraint-solver.md)** — Solver pipeline, architecture, Levenberg-Marquardt
|
|
80
|
-
- **[Solver Quality](internals/constraint-solver-quality.md)** — Tunable vs architectural parameters
|
|
81
|
-
- **[2D Sketch Pipeline](internals/sketch-2d-pipeline.md)** — Two-track export, ProfileCompilePlan
|
|
89
|
+
## Development And Operations
|
|
82
90
|
|
|
83
|
-
|
|
91
|
+
For contributors developing, deploying, or operating ForgeCAD.
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
- **[Runbook](runbook.md)** - Dev server commands, local stack setup, health checks, production SSH, incident workflow, troubleshooting
|
|
94
|
+
- **[Deployment & Environment](deployment.md)** - Kamal architecture, environment variables, deploy/rollback flow, database migrations
|
|
95
|
+
- **[Observability](platform/observability.md)** - Grafana, Loki, Prometheus, Uptime Kuma, dashboards, logs, metrics, incident debugging
|
|
96
|
+
- **[Releasing](RELEASING.md)** - npm version, publish workflow, GitHub Releases
|
|
97
|
+
- **[CLI Monetization & Licensing](cli-monetization.md)** - Free vs Pro tiers, license activation, feature gating strategy
|
|
98
|
+
- **[Coding Guidelines](coding.md)** - Project structure, workflow, adding new features
|
|
99
|
+
- **[Coding Best Practices](coding-best-practices.md)** - TypeScript, React, performance, self-review
|
|
100
|
+
- **[Blueprint-First Design](blueprint-first.md)** - Intent-driven API design
|
|
86
101
|
|
|
87
|
-
|
|
102
|
+
## Engine Internals
|
|
88
103
|
|
|
89
|
-
|
|
90
|
-
- **[Coding Best Practices](project/coding-best-practices.md)** — TypeScript, React, performance, self-review
|
|
91
|
-
- **[Blueprint-First Design](project/blueprint-first.md)** — No trigonometry tax, intent-driven API design
|
|
104
|
+
For contributors working on ForgeCAD's core engine.
|
|
92
105
|
|
|
93
|
-
|
|
106
|
+
- **[Backend Vocabulary](internals/backend-vocabulary.md)** - Canonical terms for compile plans, backends, capabilities, and routes
|
|
107
|
+
- **[Compiler](internals/compiler.md)** - Multi-backend architecture, compile plans, lowering
|
|
108
|
+
- **[Constraint Solver](internals/constraint-solver.md)** - Solver pipeline, architecture, Levenberg-Marquardt
|
|
109
|
+
- **[Solver Quality](internals/constraint-solver-quality.md)** - Tunable vs architectural parameters
|
|
110
|
+
- **[2D Sketch Pipeline](internals/sketch-2d-pipeline.md)** - Two-track export, ProfileCompilePlan
|
|
94
111
|
|
|
95
112
|
## Processes
|
|
96
113
|
|
|
@@ -6,7 +6,7 @@ ForgeCAD follows a phased monetization strategy informed by how real software co
|
|
|
6
6
|
|
|
7
7
|
### Phase 1: Honor System (Now)
|
|
8
8
|
|
|
9
|
-
Ship a compiled binary with a local license gate.
|
|
9
|
+
Ship a compiled binary with a local license gate. Production export commands stay free and show a clear commercial-use message; Pro-only render/capture commands show a clear upgrade message.
|
|
10
10
|
|
|
11
11
|
**Why this works:**
|
|
12
12
|
- Sublime Text makes $5-25M/year with zero enforcement (nag popup only)
|
|
@@ -17,7 +17,8 @@ Ship a compiled binary with a local license gate. Pro commands show a clear upgr
|
|
|
17
17
|
**What we ship:**
|
|
18
18
|
- Compiled native binary via `bun build --compile --minify` (source not trivially readable)
|
|
19
19
|
- Local JWT license validation at `~/.forgecad/license.json`
|
|
20
|
-
-
|
|
20
|
+
- Production outputs marked with commercial-use guidance, not blocked
|
|
21
|
+
- Pro-only render/capture commands blocked with helpful message + free alternatives
|
|
21
22
|
- `forgecad license activate/deactivate/status` commands
|
|
22
23
|
|
|
23
24
|
**What we accept:**
|
|
@@ -37,9 +38,9 @@ These features don't need anti-piracy because they're inherently organizational.
|
|
|
37
38
|
|
|
38
39
|
### Phase 3: Server-Side Pro Features (Later)
|
|
39
40
|
|
|
40
|
-
Move high-value
|
|
41
|
+
Move high-value compute to run on the ForgeCAD server after the security model is ready. The CLI uploads the model, the server processes it, the CLI downloads the result.
|
|
41
42
|
|
|
42
|
-
**Why this is piracy-proof:** The code for
|
|
43
|
+
**Why this is piracy-proof:** The code for server-only rendering, optimization, and future compute-heavy workflows never ships to the user. You can't crack what you don't have.
|
|
43
44
|
|
|
44
45
|
**Proven by:**
|
|
45
46
|
- Cursor: $2B ARR — the editor is free, AI calls are server-side
|
|
@@ -50,15 +51,15 @@ Move high-value exports to run on the ForgeCAD server. The CLI uploads the model
|
|
|
50
51
|
|
|
51
52
|
| Tier | Price | Features |
|
|
52
53
|
|------|-------|----------|
|
|
53
|
-
| **Free** | $0 | Editor, dev server, run scripts, render PNG,
|
|
54
|
-
| **Pro** | $15-25/mo |
|
|
54
|
+
| **Free** | $0 | Editor, dev server, run scripts, render PNG, exports including STEP/BREP/report/layout, all checks, debug tools |
|
|
55
|
+
| **Pro** | $15-25/mo | Commercial coverage, render-hq (Blender), capture GIF/MP4, 500 MB cloud storage, support for production workflows |
|
|
55
56
|
| **Team** | $40-60/seat/mo | Everything in Pro + license server, floating seats, audit log, SSO, priority support |
|
|
56
57
|
|
|
57
58
|
### Why this split?
|
|
58
59
|
|
|
59
|
-
**Free tier** includes everything needed to learn ForgeCAD, build models, and 3D print. This is the funnel — hobbyists, students, and evaluators use this. It's genuinely useful, not a crippled demo.
|
|
60
|
+
**Free tier** includes everything needed to learn ForgeCAD, build models, export files, and 3D print. This is the funnel — hobbyists, students, and evaluators use this. It's genuinely useful, not a crippled demo.
|
|
60
61
|
|
|
61
|
-
**Pro tier**
|
|
62
|
+
**Pro tier** covers the work professionals need to pay for: client work, employer work, funded projects, products for sale, closed commercial IP, larger hosted storage, support, and Pro-only render/capture tools. Exact and manufacturing exports remain free actions with production/commercial reminders.
|
|
62
63
|
|
|
63
64
|
**Team tier** gates organizational features that individuals don't need.
|
|
64
65
|
|
|
@@ -17,7 +17,7 @@ Every public API function belongs to one of 16 fundamental concepts. This docume
|
|
|
17
17
|
- **[C11: Parameterization & UI](#c11-parameterization-ui)** — Declare user-facing controls that drive model geometry. *(7 functions)*
|
|
18
18
|
- **[C12: Dimensional Demotion](#c12-dimensional-demotion)** — Extract 2D geometry from a 3D solid (section, projection). *(3 functions)*
|
|
19
19
|
- **[C13: Export & Output](#c13-export-output)** — Convert geometry to external formats (STL, 3MF, SVG, DXF, G-code, PDF). *(5 functions)*
|
|
20
|
-
- **[C14: Visual & Debugging](#c14-visual-debugging)** — Control viewport appearance and debugging aids. *(
|
|
20
|
+
- **[C14: Visual & Debugging](#c14-visual-debugging)** — Control viewport appearance and debugging aids. *(31 functions)*
|
|
21
21
|
- **[C15: Import & Composition](#c15-import-composition)** — Bring external geometry or other ForgeCAD modules into the current script. *(1 functions)*
|
|
22
22
|
- **[C16: Part Library](#c16-part-library)** — Pre-built parametric parts accessible via `lib.*`. *(4 functions)*
|
|
23
23
|
|
|
@@ -347,12 +347,38 @@ sdf.Sculpt: { sphere: (radius: number) => SdfShape; box: (x: number, y: number,
|
|
|
347
347
|
| Option | Type | Description |
|
|
348
348
|
|--------|------|-------------|
|
|
349
349
|
| `capture?` | `SceneCaptureConfig` | Default capture parameters for `forgecad capture` — CLI flags override these. |
|
|
350
|
-
| `background?`, `camera?`, `lights?`, `environment?`, `fog?`, `postProcessing?`, `ground?` | | — |
|
|
350
|
+
| `background?`, `camera?`, `views?`, `journeys?`, `lights?`, `environment?`, `fog?`, `postProcessing?`, `ground?` | | — |
|
|
351
351
|
|
|
352
352
|
`SceneBackgroundGradient`: `{ top: string, bottom: string }`
|
|
353
353
|
|
|
354
354
|
**`SceneCameraConfig`**: `position?: [ number, number, number ]`, `target?: [ number, number, number ]`, `up?: [ number, number, number ]`, `fov?: number`, `type?: "perspective" | "orthographic"`
|
|
355
355
|
|
|
356
|
+
**`SceneJourneyConfig`**
|
|
357
|
+
|
|
358
|
+
| Option | Type | Description |
|
|
359
|
+
|--------|------|-------------|
|
|
360
|
+
| `title?` | `string` | Viewer-facing journey title. Defaults to the journey id. |
|
|
361
|
+
| `startsAt?` | `string` | Optional starting step id. Defaults to the first step. |
|
|
362
|
+
| `behavior?` | `"opt-in" \| "auto"` | Whether the viewer should offer or auto-open the journey. First slice supports opt-in. |
|
|
363
|
+
| `steps` | `SceneJourneyStepConfig[]` | Ordered journey spine. Branches can be added later without changing this core contract. |
|
|
364
|
+
| `valid?` | `boolean` | True unless any journey or step diagnostic has level "error". |
|
|
365
|
+
| `diagnostics?` | `SceneJourneyDiagnostic[]` | Whole-journey diagnostics, including unresolved startsAt and step target diagnostics. |
|
|
366
|
+
|
|
367
|
+
**`SceneJourneyStepConfig`**
|
|
368
|
+
|
|
369
|
+
| Option | Type | Description |
|
|
370
|
+
|--------|------|-------------|
|
|
371
|
+
| `id` | `string` | Stable step id used by viewer links and Next/Back state. |
|
|
372
|
+
| `title?` | `string` | Viewer-facing title. Defaults to the step id. |
|
|
373
|
+
| `focus?` | `string` | Object name or slash-separated tree path to focus. |
|
|
374
|
+
| `caption?` | `string` | Short optional viewer caption. |
|
|
375
|
+
| `camera?` | `SceneViewCameraConfig` | Optional explicit camera for this step. When omitted, the viewer fits `focus`. |
|
|
376
|
+
| `resolvedFocusId?` | `string \| null` | Resolved object id after script execution, when `focus` matched exactly one object. |
|
|
377
|
+
| `resolvedFocusPath?` | `string \| null` | Resolved object tree path or name after script execution. |
|
|
378
|
+
| `diagnostics?` | `SceneJourneyDiagnostic[]` | Resolution diagnostics for this step. |
|
|
379
|
+
|
|
380
|
+
`SceneJourneyDiagnostic`: `{ level: SceneJourneyDiagnosticLevel, message: string, stepId?: string, suggestions?: string[] }`
|
|
381
|
+
|
|
356
382
|
**`SceneLightConfig`**
|
|
357
383
|
|
|
358
384
|
| Option | Type | Description |
|
|
@@ -754,6 +780,8 @@ stroke(points: [ number, number ][], width: number, join?: "Round" | "Square"):
|
|
|
754
780
|
|
|
755
781
|
The Sketch origin is at the left end of the text baseline by default. Use `align` and `baseline` options to adjust placement. Text is rendered using the bundled Inter font by default, or any TTF/OTF/WOFF font you provide.
|
|
756
782
|
|
|
783
|
+
`text2d()` creates real geometry. For non-exported explanatory labels in the viewport, prefer `Viewport.label()` so the text stays off the geometry and OCCT compile paths.
|
|
784
|
+
|
|
757
785
|
Alignment reference table:
|
|
758
786
|
|
|
759
787
|
| `align` | `baseline` | Origin |
|
|
@@ -2409,6 +2437,7 @@ BOM entries are accumulated during script execution and exported alongside the m
|
|
|
2409
2437
|
- `quantity` must be a finite number `>= 0`. A quantity of `0` is silently ignored (useful for conditional scripting with `param()`-driven counts).
|
|
2410
2438
|
- `unit` defaults to `"pieces"` when omitted or empty.
|
|
2411
2439
|
- The assembly `solved.bom()` / `solved.bomCsv()` API is separate and covers per-part assembly metadata; this function is for free-form purchased-item annotation.
|
|
2440
|
+
- `bom()` is injected into every `.forge.js` script. Call it directly; do not write `const { bom } = require(...)`, because top-level declarations named `bom` collide with the built-in runtime name.
|
|
2412
2441
|
|
|
2413
2442
|
```ts
|
|
2414
2443
|
const tubeLen = param("Tube Length", 1200, { min: 300, max: 4000, unit: "mm" });
|
|
@@ -2635,6 +2664,38 @@ sketchToSvg(sketch: Sketch, options?: SketchSvgOptions): string
|
|
|
2635
2664
|
|
|
2636
2665
|
Control viewport appearance and debugging aids.
|
|
2637
2666
|
|
|
2667
|
+
#### `Viewport.label()` — Add a render-only viewport label at a world-space point.
|
|
2668
|
+
|
|
2669
|
+
`Viewport.label()` is for explanatory text that helps a viewer understand the model. It does not create sketches, meshes, B-rep topology, exported text, or face labels, so it stays off the OCCT path. Use `text2d()` only when the letters should become manufactured geometry, such as raised lettering, engraved serial numbers, or exported nameplates.
|
|
2670
|
+
|
|
2671
|
+
Labels are collected during script execution and rendered by the viewport as lightweight overlay annotations. They are ignored by exports and do not appear in `objects`.
|
|
2672
|
+
|
|
2673
|
+
```js
|
|
2674
|
+
Viewport.label('Bearing bore', [0, 0, 18], {
|
|
2675
|
+
color: '#f8fafc',
|
|
2676
|
+
background: '#0f172acc',
|
|
2677
|
+
offset: [0, 0, 8],
|
|
2678
|
+
anchor: 'bottom',
|
|
2679
|
+
});
|
|
2680
|
+
|
|
2681
|
+
return box(40, 30, 12);
|
|
2682
|
+
```
|
|
2683
|
+
|
|
2684
|
+
```ts
|
|
2685
|
+
Viewport.label(text: string, at: [ number, number, number ], options?: RenderLabelOptions): void
|
|
2686
|
+
```
|
|
2687
|
+
|
|
2688
|
+
**`RenderLabelOptions`**
|
|
2689
|
+
|
|
2690
|
+
| Option | Type | Description |
|
|
2691
|
+
|--------|------|-------------|
|
|
2692
|
+
| `color?` | `string` | Text color as any CSS color string. |
|
|
2693
|
+
| `background?` | `string` | Background color as any CSS color string. Use `'transparent'` for no pill background. |
|
|
2694
|
+
| `size?` | `number` | Font size in CSS pixels. Defaults to 12. |
|
|
2695
|
+
| `offset?` | `[ number, number, number ]` | Additional world-space offset from `at`. |
|
|
2696
|
+
| `anchor?` | `RenderLabelAnchor` | Which point of the label box is anchored to `at`. Defaults to `'center'`. |
|
|
2697
|
+
| `alwaysOnTop?` | `boolean` | When false, the label is hidden when occluded by scene geometry. Defaults to true. |
|
|
2698
|
+
|
|
2638
2699
|
#### `verify.that()` — Custom predicate check.
|
|
2639
2700
|
|
|
2640
2701
|
```ts
|
|
@@ -2868,12 +2929,16 @@ mock<T extends Shape>(shape: T, name?: string): T
|
|
|
2868
2929
|
|
|
2869
2930
|
#### `scene()` — Configure the scene environment for the current script execution.
|
|
2870
2931
|
|
|
2871
|
-
Controls camera position, lighting rig, background color or gradient, atmospheric fog, environment maps, post-processing effects, and capture parameters for the `forgecad capture` command. Multiple calls merge — later values override earlier ones on a per-key basis, so you can split configuration across multiple `scene()` calls.
|
|
2932
|
+
Controls camera position, named render views, optional model journeys, lighting rig, background color or gradient, atmospheric fog, environment maps, post-processing effects, and capture parameters for the `forgecad capture` command. Multiple calls merge — later values override earlier ones on a per-key basis, so you can split configuration across multiple `scene()` calls.
|
|
2872
2933
|
|
|
2873
2934
|
When `lights` is specified, **all** default lights are removed. You must include your own ambient light or the scene will be fully dark.
|
|
2874
2935
|
|
|
2875
2936
|
Setting `camera.position` overrides auto-framing — the viewport will no longer auto-fit the geometry on script reload.
|
|
2876
2937
|
|
|
2938
|
+
Named render views let scripts check in repeatable cameras next to the model code. The canonical shape is `{ camera: { position, target } }`, and a direct camera shorthand `{ position, target }` is also accepted. Use the canonical shape when you may add view metadata later. Use it from the CLI with `forgecad render 3d model.forge.js --view hero`.
|
|
2939
|
+
|
|
2940
|
+
Model journeys let scripts check in a compact guided path through named objects. Each journey has ordered `steps`; each step can name a `focus` target by object name/tree path, provide a caption, and optionally provide an explicit camera. In the viewer, journeys are opt-in: they appear as a small Explore control and do not move the camera until the user starts them. Use `forgecad run model.forge.js --journeys` or `--journeys-json` to inspect resolved targets.
|
|
2941
|
+
|
|
2877
2942
|
Post-processing effects (`bloom`, `vignette`, `grain`) work in the browser viewport only. The CLI applies camera, lights, background, fog, and `toneMappingExposure` but skips shader effects.
|
|
2878
2943
|
|
|
2879
2944
|
All numeric values accept `param()` expressions.
|
|
@@ -2882,6 +2947,22 @@ All numeric values accept `param()` expressions.
|
|
|
2882
2947
|
scene({
|
|
2883
2948
|
background: { top: '#000814', bottom: '#001d3d' },
|
|
2884
2949
|
camera: { position: [160, -120, 100], target: [0, 0, 50], fov: 52 },
|
|
2950
|
+
views: {
|
|
2951
|
+
hero: {
|
|
2952
|
+
camera: { position: [180, -140, 90], target: [0, 0, 25], up: [0, 0, 1], fov: 38 },
|
|
2953
|
+
},
|
|
2954
|
+
side: { position: [240, 0, 70], target: [0, 0, 25], fov: 34 },
|
|
2955
|
+
},
|
|
2956
|
+
journeys: {
|
|
2957
|
+
grandTour: {
|
|
2958
|
+
title: 'Grand Tour',
|
|
2959
|
+
startsAt: 'overview',
|
|
2960
|
+
steps: [
|
|
2961
|
+
{ id: 'overview', focus: 'Solar System', caption: 'Start with the whole model.' },
|
|
2962
|
+
{ id: 'earth', focus: 'Earth', caption: 'Fit and inspect Earth.' },
|
|
2963
|
+
],
|
|
2964
|
+
},
|
|
2965
|
+
},
|
|
2885
2966
|
lights: [
|
|
2886
2967
|
{ type: 'ambient', color: '#001233', intensity: 0.08 },
|
|
2887
2968
|
{ type: 'point', position: [120, -80, 130], color: '#00f5d4', intensity: 4, distance: 400, decay: 1 },
|
|
@@ -2908,12 +2989,38 @@ scene(options: SceneOptions): void
|
|
|
2908
2989
|
| Option | Type | Description |
|
|
2909
2990
|
|--------|------|-------------|
|
|
2910
2991
|
| `capture?` | `SceneCaptureConfig` | Default capture parameters for `forgecad capture` — CLI flags override these. |
|
|
2911
|
-
| `background?`, `camera?`, `lights?`, `environment?`, `fog?`, `postProcessing?`, `ground?` | | — |
|
|
2992
|
+
| `background?`, `camera?`, `views?`, `journeys?`, `lights?`, `environment?`, `fog?`, `postProcessing?`, `ground?` | | — |
|
|
2912
2993
|
|
|
2913
2994
|
`SceneBackgroundGradient`: `{ top: string, bottom: string }`
|
|
2914
2995
|
|
|
2915
2996
|
**`SceneCameraConfig`**: `position?: [ number, number, number ]`, `target?: [ number, number, number ]`, `up?: [ number, number, number ]`, `fov?: number`, `type?: "perspective" | "orthographic"`
|
|
2916
2997
|
|
|
2998
|
+
**`SceneJourneyConfig`**
|
|
2999
|
+
|
|
3000
|
+
| Option | Type | Description |
|
|
3001
|
+
|--------|------|-------------|
|
|
3002
|
+
| `title?` | `string` | Viewer-facing journey title. Defaults to the journey id. |
|
|
3003
|
+
| `startsAt?` | `string` | Optional starting step id. Defaults to the first step. |
|
|
3004
|
+
| `behavior?` | `"opt-in" \| "auto"` | Whether the viewer should offer or auto-open the journey. First slice supports opt-in. |
|
|
3005
|
+
| `steps` | `SceneJourneyStepConfig[]` | Ordered journey spine. Branches can be added later without changing this core contract. |
|
|
3006
|
+
| `valid?` | `boolean` | True unless any journey or step diagnostic has level "error". |
|
|
3007
|
+
| `diagnostics?` | `SceneJourneyDiagnostic[]` | Whole-journey diagnostics, including unresolved startsAt and step target diagnostics. |
|
|
3008
|
+
|
|
3009
|
+
**`SceneJourneyStepConfig`**
|
|
3010
|
+
|
|
3011
|
+
| Option | Type | Description |
|
|
3012
|
+
|--------|------|-------------|
|
|
3013
|
+
| `id` | `string` | Stable step id used by viewer links and Next/Back state. |
|
|
3014
|
+
| `title?` | `string` | Viewer-facing title. Defaults to the step id. |
|
|
3015
|
+
| `focus?` | `string` | Object name or slash-separated tree path to focus. |
|
|
3016
|
+
| `caption?` | `string` | Short optional viewer caption. |
|
|
3017
|
+
| `camera?` | `SceneViewCameraConfig` | Optional explicit camera for this step. When omitted, the viewer fits `focus`. |
|
|
3018
|
+
| `resolvedFocusId?` | `string \| null` | Resolved object id after script execution, when `focus` matched exactly one object. |
|
|
3019
|
+
| `resolvedFocusPath?` | `string \| null` | Resolved object tree path or name after script execution. |
|
|
3020
|
+
| `diagnostics?` | `SceneJourneyDiagnostic[]` | Resolution diagnostics for this step. |
|
|
3021
|
+
|
|
3022
|
+
`SceneJourneyDiagnostic`: `{ level: SceneJourneyDiagnosticLevel, message: string, stepId?: string, suggestions?: string[] }`
|
|
3023
|
+
|
|
2917
3024
|
**`SceneLightConfig`**
|
|
2918
3025
|
|
|
2919
3026
|
| Option | Type | Description |
|
|
@@ -414,6 +414,8 @@ coalesceEdges(segments: EdgeSegment[], tolerance?: number): EdgeSegment[]
|
|
|
414
414
|
|
|
415
415
|
When importing a `.forge.js` file, the return value is what the script returns. If the script returns a metadata object (e.g. `{ shape: myShape, bolts: {...} }`), the caller receives the full object — renderable values and metadata together.
|
|
416
416
|
|
|
417
|
+
**Path rule:** Always include the file extension in relative imports: use `require("./part.forge.js")` for model files and `require("./helpers.js")` for plain helper modules. ForgeCAD does not apply Node-style extension inference, so `require("./part")` will not find `part.forge.js` or `part.js`.
|
|
418
|
+
|
|
417
419
|
**Parameter scoping:** Parameters declared in required files are automatically namespaced with a `"filename#N / "` prefix (e.g. `"bracket.forge.js#1 / Width"`). This prevents collisions when multiple files declare same-named params. Each file's params appear as separate sliders.
|
|
418
420
|
|
|
419
421
|
**Parameter overrides:** When passing overrides, use the bare param name (not the scoped name). Overrides are type-checked — unrecognized keys throw an error with typo suggestions.
|