brep-io-kernel 1.0.184 → 1.0.185
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 -0
- package/dist/about.html +1 -1
- package/dist/help/developer-index.html +1 -1
- package/dist/help/expressions.html +730 -0
- package/dist/help/index.html +2 -1
- package/dist/help/input-params-schema.html +54 -2
- package/dist/help/modes__modeling.html +1 -1
- package/dist/help/part-history.html +81 -2
- package/dist/help/search-index.json +13 -7
- package/dist/help/table-of-contents.html +1 -0
- package/dist-kernel/help/developer-index.html +1 -1
- package/dist-kernel/help/expressions.html +730 -0
- package/dist-kernel/help/index.html +2 -1
- package/dist-kernel/help/input-params-schema.html +54 -2
- package/dist-kernel/help/modes__modeling.html +1 -1
- package/dist-kernel/help/part-history.html +81 -2
- package/dist-kernel/help/search-index.json +13 -7
- package/dist-kernel/help/table-of-contents.html +1 -0
- package/package.json +1 -1
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"title": "Developer Docs Index",
|
|
100
100
|
"href": "developer-index.html",
|
|
101
101
|
"summary": "Developer Docs Index This page is a quick entry point for implementation and integration docs. Embedding Quick Links CAD Embedding Guide (CadEmbed) 2D Sketcher Embedding Guide Start Here Getting Started Bug Reporting and Repro Test Cases De...",
|
|
102
|
-
"content": "Developer Docs Index This page is a quick entry point for implementation and integration docs. Embedding Quick Links CAD Embedding Guide (CadEmbed) 2D Sketcher Embedding Guide Start Here Getting Started Bug Reporting and Repro Test Cases Developer Discord API Examples (Live Demos) BREP API (BREP.js exports) BREP Kernel (core classes & helpers) BREP Model and Classes PartHistory Reference How It Works What's New Highlights Live API Example Pages Examples Index BREP Booleans BREP Primitives BREP Transforms BREP Export Embeded 2D Sketcher Embeded CAD Embeded CAD Integration Test Sketch and Geometry APIs 2D Sketch Solver (standalone) Embeddable 2D Sketcher Embeddable CAD App Radius Metadata for Extruded Sketches Cylindrical Face Radius Embedding Topological Face Naming and Triangle Ownership Solid Methods Simplified Radial Dimensions Application and UI Architecture History Systems Feature Dimension Gizmos (Developer) Input Params Schema UI Overview (Browser) Plugins and Examples Inspector Inspector Improvements Dialog Screenshots Data and File IO File Formats: Import and Export GitHub Repo Storage Assembly Constraints Constraint Solver Angle Constraint Coincident Constraint Distance Constraint Fixed Constraint Parallel Constraint Touch Align Constraint Feature and Mode Docs Features Index Modeling Mode Sketch Mode PMI Mode 2D Sheets Mode Feature Docs (Detailed) Assembly Component Boolean Chamfer Datium Datum Extrude Fillet Helix Hole Image Heightmap Solid Image To Face Import 3D Model Loft Mirror Offset Shell Pattern Pattern Linear Pattern Radial Plane Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Remesh Revolve Sheet Metal Contour Flange Sheet Metal Flange Sheet Metal Tab Sketch Smooth With Subdivision Spline Sweep Text To Face Transform Tube PMI Annotation Docs PMI Annotations Index Angle Dimension Explode Body Hole Callout Leader Linear Dimension Note Radial Dimension License Docs Font Licenses"
|
|
102
|
+
"content": "Developer Docs Index This page is a quick entry point for implementation and integration docs. Embedding Quick Links CAD Embedding Guide (CadEmbed) 2D Sketcher Embedding Guide Start Here Getting Started Bug Reporting and Repro Test Cases Developer Discord API Examples (Live Demos) BREP API (BREP.js exports) BREP Kernel (core classes & helpers) BREP Model and Classes Expressions and Configurator PartHistory Reference How It Works What's New Highlights Live API Example Pages Examples Index BREP Booleans BREP Primitives BREP Transforms BREP Export Embeded 2D Sketcher Embeded CAD Embeded CAD Integration Test Sketch and Geometry APIs 2D Sketch Solver (standalone) Embeddable 2D Sketcher Embeddable CAD App Radius Metadata for Extruded Sketches Cylindrical Face Radius Embedding Topological Face Naming and Triangle Ownership Solid Methods Simplified Radial Dimensions Application and UI Architecture History Systems Expressions and Configurator Feature Dimension Gizmos (Developer) Input Params Schema UI Overview (Browser) Plugins and Examples Inspector Inspector Improvements Dialog Screenshots Data and File IO File Formats: Import and Export GitHub Repo Storage Assembly Constraints Constraint Solver Angle Constraint Coincident Constraint Distance Constraint Fixed Constraint Parallel Constraint Touch Align Constraint Feature and Mode Docs Features Index Modeling Mode Sketch Mode PMI Mode 2D Sheets Mode Feature Docs (Detailed) Assembly Component Boolean Chamfer Datium Datum Extrude Fillet Helix Hole Image Heightmap Solid Image To Face Import 3D Model Loft Mirror Offset Shell Pattern Pattern Linear Pattern Radial Plane Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Remesh Revolve Sheet Metal Contour Flange Sheet Metal Flange Sheet Metal Tab Sketch Smooth With Subdivision Spline Sweep Text To Face Transform Tube PMI Annotation Docs PMI Annotations Index Angle Dimension Explode Body Hole Callout Leader Linear Dimension Note Radial Dimension License Docs Font Licenses"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"title": "Documentation Screenshots",
|
|
@@ -107,6 +107,12 @@
|
|
|
107
107
|
"summary": "Documentation Screenshots Run pnpm dev and open at least one of the capture helper pages: - http://127.0.0.1:5173/feature-dialog-capture.html - http://127.0.0.1:5173/pmi-dialog-capture.html - http://127.0.0.1:5173/assembly-constraint-captur...",
|
|
108
108
|
"content": "Documentation Screenshots Run pnpm dev and open at least one of the capture helper pages: - http://127.0.0.1:5173/feature-dialog-capture.html - http://127.0.0.1:5173/pmi-dialog-capture.html - http://127.0.0.1:5173/assembly-constraint-capture.html With the dev server running, execute pnpm capture to export screenshots. Outputs land in: - docs/features (feature dialogs) - docs/pmi-annotations (PMI annotations) - docs/assembly-constraints (assembly constraints) - docs/MODELING.png , docs/SKETCH.png , docs/PMI.png - docs/features/image-to-face-2D_dialog.png , docs/features/image-to-face-3D_dialog.png - docs/features/NURBS_Face_Solid_cage_editor.png - Full-page documentation captures use a fixed viewport ( 1200x760 ) for consistent, smaller image size. For the schema that drives these dialogs (field types, defaults, and selection filters), see Input Params Schema . Configuration Customize the automation with environment variables: CAPTURE_SCOPE=features,pmi,assembly,docs limits which capture helpers are processed. CAPTURE_BASE_URL=http://127.0.0.1:5174 points to a dev server running on a different host/port. CAPTURE_URL + CAPTURE_OUTPUT run a one-off capture against any URL. CAPTURE_HEADLESS=true runs without showing the browser window (default is headed so you can watch captures live). CAPTURE_KEEP_OPEN=false closes the browser immediately after capture (default keeps it open in headed mode; press Ctrl+C to exit). CAPTURE_SKIP_HISTORY_DIALOGS=true skips any dialog whose name includes History . - Equivalent pnpm flag: pnpm capture --capture-skip-history=true CAPTURE_DEVICE_SCALE_FACTOR=1 (default 2 ) controls the browser’s device pixel ratio for sharper or softer renders. CAPTURE_OUTPUT_SCALE=device keeps the full hi-DPI image size instead of downscaling back to CSS pixels (default css keeps the files small while retaining clarity)."
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
"title": "Expressions and Configurator",
|
|
112
|
+
"href": "expressions.html",
|
|
113
|
+
"summary": "Expressions and Configurator This page is the dedicated guide for the Expressions panel in Modeling Mode. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Overview The...",
|
|
114
|
+
"content": "Expressions and Configurator This page is the dedicated guide for the Expressions panel in Modeling Mode. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Overview The Expressions panel has two related parts: expressions : a shared script where you define variables and formulas configurator : a set of UI widgets whose values are exposed to expressions as configurator.fieldName Together, they let you drive feature dialogs from reusable parameters instead of hard-coded values. Expression syntax Expressions use JavaScript-style syntax. Typical usage is to assign variables in the script, then reference them in feature fields. Example script: javascript wall = 2; width = 80; height = width * 1.5; holeOffset = width * 0.25; Then in a feature dialog field: javascript height or: javascript width - wall * 2 Runtime context When an expression is evaluated, the runtime includes: resolution = 32 by default the current configurator values as configurator the contents of the Expressions script That means these are valid: javascript resolution configurator.panelWidth configurator.materialName Configurator The configurator is for values that should be edited through UI controls instead of typing directly into the script. Supported widget types: slider number select string Example configurator usage: javascript width = configurator.panelWidth; height = width * 2; labelText = configurator.partLabel; Then feature inputs can use: javascript width height labelText configurator.panelWidth * 0.5 Expressions panel behavior If no configurator fields exist, the configurator form is hidden. If configurator fields exist, the live configurator form appears above the expression editor. Editing a configurator value in that live form re-runs the model. Editing the configurator layout with Edit Configurator shows a live preview of the widget set above the expression editor. While the configurator editor is open, that preview does not re-run the model. The model is re-evaluated only when the configurator edit session is committed with Save Configurator or by closing the editor. Using expressions in feature dialogs Feature dialogs evaluate against the shared expression source. Field support: number fields support expressions by default string fields can support expressions when the schema enables allowExpression: true transform and vec3 numeric entries also evaluate expressions Examples: javascript distance = configurator.panelWidth * 0.5 javascript text = configurator.partLabel Persistence Both the script and the configurator are stored in part history. Saved part history includes: expressions configurator.fields configurator.values That means they survive: save/load JSON export/import embedded feature history in 3MF undo/redo snapshots Practical example Expressions script: javascript wall = 2; outerWidth = configurator.panelWidth; outerHeight = configurator.panelHeight; innerWidth = outerWidth - wall * 2; innerHeight = outerHeight - wall * 2; titleText = configurator.label; Possible configurator fields: panelWidth as a slider panelHeight as a slider label as a string Then feature inputs can use: javascript outerWidth outerHeight innerWidth innerHeight titleText Developer notes Relevant API and integration points: partHistory.expressions partHistory.configurator partHistory.getExpressionsSource() partHistory.buildExpressionSource() partHistory.evaluateExpression() If you are authoring a feature dialog schema: use type: 'number' for expression-capable numeric fields use type: 'string' with allowExpression: true for expression-capable string fields Safety note Expressions are executed as code using Function() . Do not evaluate untrusted user input. Related docs Modeling Mode Input Params Schema PartHistory Reference"
|
|
115
|
+
},
|
|
110
116
|
{
|
|
111
117
|
"title": "Radius Metadata for Extruded Sketches",
|
|
112
118
|
"href": "extruded-sketch-radius-embedding.html",
|
|
@@ -447,13 +453,13 @@
|
|
|
447
453
|
"title": "[BREP.io](https://BREP.io)",
|
|
448
454
|
"href": "index.html",
|
|
449
455
|
"summary": "BREP.io Source https://github.com/mmiscool/BREP NPM package: brep-io-kernel https://www.npmjs.com/package/brep-io-kernel Live API examples https://BREP.io/apiExamples/index.html Developer Discord https://discord.gg/R5KNAKrQ BREP.io is a bro...",
|
|
450
|
-
"content": "BREP.io Source https://github.com/mmiscool/BREP NPM package: brep-io-kernel https://www.npmjs.com/package/brep-io-kernel Live API examples https://BREP.io/apiExamples/index.html Developer Discord https://discord.gg/R5KNAKrQ BREP.io is a browser-based CAD application and JavaScript kernel for feature-based solid modeling. At its core is a BREP-style modeler with explicit geometry/topology objects such as Solid , Face , Edge , and Vertex , paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans ( manifold-3d ), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs. This project is in active development and APIs may continue to evolve. Workbenches Modeling Workbench Import Workbench Surfacing Workbench Sheet Metal Workbench Assemblies Workbench Wire Harness Workbench PMI Workbench All Workbench Screenshots Documentation Index General: Getting Started Developer Docs Index Bug Reporting and Repro Test Cases Highlights What's New API Examples Core APIs: BREP API Export Map BREP Kernel Reference Solid Methods Part History 2D Sketch Solver Embeddable CAD ( CadEmbed ) Embeddable Sketcher ( Sketcher2DEmbed ) System docs: History Systems Input Params Schema File Formats: Import and Export Plugins and Examples Inspector Inspector Improvements Mode guides: Modeling Mode Sketch Mode PMI Mode 2D Sheets Mode Modeling Feature Docs Feature index: All Feature Docs Primitives and setup: Primitive Cube Primitive Cylinder Primitive Cone Primitive Sphere Primitive Torus Primitive Pyramid Plane Datum Datium Sketch Spline Helix Solid operations: Extrude Sweep Tube Loft Revolve Mirror Boolean Fillet Chamfer Hole Offset Shell Remesh Transform Pattern, import, and generation: Pattern (Legacy Combined) Pattern Linear Pattern Radial Import 3D Model Image Heightmap Solid Image to Face Text to Face Assembly and sheet metal: Assembly Component Sheet Metal Tab Sheet Metal Contour Flange Sheet Metal Flange Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout. Assembly Constraints Assembly Constraint Solver Coincident Distance Angle Parallel Touch Align Fixed PMI Annotation Docs PMI Annotations Index Linear Dimension Radial Dimension Angle Dimension Leader Note Hole Callout Explode Body Quick Start Prerequisites: Node.js 18+ pnpm git submodule update --init --recursive Emscripten SDK ( emcmake / emcc on PATH , or EMSDK installed at $HOME/emsdk ) Install and run locally: bash git submodule update --init --recursive pnpm install pnpm dev Then open the Vite URL shown in your terminal. Main app shell: /index.html Direct CAD workspace: /cad.html Build, Test, and Utility Commands Command Purpose pnpm dev Prepares fonts, builds the kernel bundle, then runs the Vite dev server. pnpm build Production build of the app into dist/ (includes kernel build step). pnpm build:manifoldPlus Builds the local manifold wasm/js bundle from the vendor/manifold3d submodule plus local custom bindings. pnpm build:kernel Builds the ESM kernel bundle into dist-kernel/ and syncs assets. pnpm use:manifold:npm Switches runtime/builds to the published manifold-3d npm package. pnpm use:manifold:local Switches runtime/builds to the locally compiled manifold bundle. pnpm which:manifold Prints the currently selected manifold source. pnpm test Runs the Node test suite ( src/tests/tests.js ), writing artifacts to tests/results/ . pnpm liveTesting Watches src/ and tests/ and reruns tests on change. pnpm capture Captures docs/dialog screenshots. pnpm generateLicenses Regenerates dependency and bundled-font license summaries. Build outputs: dist/ : static web app (ready for CDN/web hosting) dist-kernel/ : published kernel bundle artifacts CI and Pages Deployments The kernel build compiles a custom wasm bundle from the vendor/manifold3d git submodule. CI environments must: fetch submodules install Emscripten/EMSDK before running pnpm build This repo includes GitHub Actions workflows for: npm publishing with submodules + EMSDK Cloudflare Pages deployment via Wrangler Direct Upload For Cloudflare Pages, use the GitHub Actions deploy workflow instead of relying on Cloudflare's Git build container to compile the wasm bundle. Configure these repository settings before enabling the workflow: secret CLOUDFLARE_ACCOUNT_ID secret CLOUDFLARE_API_TOKEN variable CLOUDFLARE_PAGES_PROJECT_NAME Use as an NPM Package Package name: brep-io-kernel (ESM-only). Install: bash pnpm add brep-io-kernel Main imports: javascript import { BREP, PartHistory, AssemblyConstraintHistory, AssemblyConstraintRegistry, CadEmbed, Sketcher2DEmbed } from \"brep-io-kernel\" ; Subpath imports: javascript import { BREP } from \"brep-io-kernel/BREP\" ; import { PartHistory } from \"brep-io-kernel/PartHistory\" ; import { CadEmbed } from \"brep-io-kernel/CAD\" ; import { Sketcher2DEmbed } from \"brep-io-kernel/Sketcher2D\" ; import { ConstraintSolver, ConstraintEngine, constraints } from \"brep-io-kernel/SketchSolver2D\" ; Node examples: brep-io-kernel-examples/README.md CLI helper: bash npx brep-io-kernel npx brep-io-kernel --host 127.0.0.1 --port 4173 npx brep-io-kernel --help License helper APIs: javascript import { getPackageLicenseInfoString, getAllLicensesInfoString } from \"brep-io-kernel\" ; console.log(getPackageLicenseInfoString()); // package license info console.log(getAllLicensesInfoString()); // package + production dependencies CommonJS note: javascript const { BREP } = await import ( \"brep-io-kernel\" ); Repository Layout src/BREP : core solid/kernel implementation src/features : feature implementations and dialogs src/assemblyConstraints : assembly solver and constraints src/UI : CAD/sketcher UI and embedding bridges docs/ : markdown docs and screenshots apiExamples/ : standalone browser API demos tests/ and src/tests/ : test assets and test runner Contributing See CONTRIBUTING.md . License See LICENSE.md . This project uses a dual-licensing strategy managed by Autodrop3d LLC. Documentation API Examples Angle Constraint Coincident Constraint Distance Constraint Fixed Constraint Parallel Constraint Assembly Constraint Solver Touch Align Constraint BREP.js Export Map and Usage BREP Kernel Reference BREP Model and Classes Bug Reporting and Repro Test Cases Embeddable CAD App CONTRIBUTING C++ Solid Porting Cylindrical Face Radius Embedding Developer Docs Index Documentation Screenshots Radius Metadata for Extruded Sketches Feature Dimension Gizmos (Developer) Assembly Component Boolean Chamfer Collapse Edge Datium Datum Edge Smooth Extrude Fillet Helix Hole Image Editor (Shared) Image Heightmap Solid Image to Face Import 3D Model Features Loft Mirror NURBS Face Solid Offset Face Offset Shell Overlap Cleanup Pattern Linear Pattern Radial Pattern (Legacy) Plane Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Remesh Revolve Sheet Metal Contour Flange Sheet Metal Cutout Sheet Metal Flange Sheet Metal Hem Sheet Metal Tab Sketch Smooth With Subdivision Spline Sweep Text to Face Transform Tube File Formats: Import and Export Font Licenses Getting Started GitHub Repo Storage Highlights History Systems How It Works Input Params Schema Recent Inspector Improvements Inspector LICENSE Modeling Mode PMI Mode 2D Sheets Mode Sketch Mode PartHistory Reference Plugins and Examples Angle Dimension Explode Body Hole Callout PMI Annotations Leader Linear Dimension Note Radial Dimension Simplified Radial Dimension Interface 2D Sketch Solver (Standalone) Embeddable 2D Sketcher Solid Methods Reference Topological Face and Edge Naming Specification UI Overview (Browser) What's New Workbench Implementation Plan All Workbench Assemblies Workbench Import Workbench Modeling Workbench PMI Workbench Sheet Metal Workbench Surfacing Workbench Wire Harness Workbench This project's license Copyright 2025 Autodrop3d LLC https://autodrop3d.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 1. Any modifications made to the Software must be submitted to Autodrop3d LLC with an irrevocable assignment of the copyright via git pull request. This is intended to allow Autodrop3d LLC to sell commercial licenses of the Software for use in proprietary products under a dual-licensing strategy. Failure to contribute back modifications without a commercial license purchased from Autodrop3d LLC voids all permissions granted by this license. 2. If Autodrop3d LLC is sold, merged, transferred, or otherwise succeeded by any entity or individual, all rights and obligations described in this license shall transfer automatically to that successor entity or individual. 3. If Autodrop3d LLC ceases operations or dissolves, and no successor entity or individual continues to publicly host the Software in a manner that allows the public to obtain the source code and submit contributions for a period of at least eighteen (18) consecutive months, then Clauses 1 and 2 of this license shall be automatically and irrevocably canceled. The above copyright notice and these permission notices shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Licenses Report of libraries used in this package 33 packages • 6 license types (MIT AND Zlib) 2 packages pako 1 version zlib port to javascript - fast, modularized, with browser support Repo / Homepage pako 1 version zlib port to javascript - fast, modularized, with browser support Repo / Homepage (MIT OR GPL-3.0-or-later) 1 package jszip 1 version Create, read and edit .zip files with JavaScript http://stuartk.com/jszip Author: Stuart Knightley <stuart@stuartk.com> Repo / Homepage Apache-2.0 1 package manifold-3d 1 version Geometry library for topological robustness Repo / Homepage ISC 1 package inherits 1 version Browser-friendly inheritance fully compatible with standard node.js inherits() Repo / Homepage MIT 27 packages @babel/runtime 1 version babel's modular runtime helpers Author: The Babel Team (https://babel.dev/team) Repo / Homepage @tarikjabiri/dxf 1 version A JavaScript interface to Dxf written in TypeScript. Author: Tarik EL JABIRI Repo / Homepage @types/pako 1 version TypeScript definitions for pako Repo / Homepage base64-arraybuffer 1 version Encode/decode base64 data into ArrayBuffers Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage core-js 1 version Standard library Author: Denis Pushkarev <zloirock@zloirock.ru> Repo / Homepage core-util-is 1 version The `util.is*` functions introduced in Node v0.12. Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/) Repo / Homepage css-line-break 1 version Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage fast-png 1 version PNG image decoder and encoder written entirely in JavaScript Author: Michaël Zasso Repo / Homepage html2canvas 1 version Screenshots with JavaScript Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage immediate 1 version A cross browser microtask library Repo / Homepage iobuffer 1 version Read and write binary data on ArrayBuffers Author: Michaël Zasso Repo / Homepage isarray 1 version Array#isArray for older browsers Author: Julian Gruber <mail@juliangruber.com> Repo / Homepage jspdf 1 version PDF Document creation from JavaScript Repo / Homepage lie 1 version A basic but performant promise implementation Repo / Homepage marked 1 version A markdown parser built for speed Author: Christopher Jeffrey Repo / Homepage monaco-editor 1 version A browser based code editor Author: Microsoft Corporation Repo / Homepage pngjs 1 version PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite. Repo / Homepage process-nextick-args 1 version process.nextTick but always with args Repo / Homepage readable-stream 1 version Streams3, a user-land copy of the stream library from Node.js Repo / Homepage safe-buffer 1 version Safer Node.js Buffer API Author: Feross Aboukhadijeh <feross@feross.org> Repo / Homepage setimmediate 1 version A shim for the setImmediate efficient script yielding API Author: YuzuJS Repo / Homepage string_decoder 1 version The string_decoder module from Node core Repo / Homepage text-segmentation 1 version Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage three 1 version JavaScript 3D library Author: mrdoob Repo / Homepage three-mesh-bvh 1 version A BVH implementation to speed up raycasting against three.js meshes. Author: Garrett Johnson <garrett.kjohnson@gmail.com> Repo / Homepage util-deprecate 1 version The Node.js `util.deprecate()` function with browser support Author: Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/) Repo / Homepage utrie 1 version Unicode Trie Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage SGI-B-2.0 1 package tess2 1 version GLU tesselator ported to Javascript, performs polygon boolean operations and triangulation Author: Matt DesLauriers <dave.des@gmail.com> Repo / Homepage Font Licenses Bundled fonts are licensed separately from npm packages. Font license details Generated from installed node_modules graph (dependencies + optionalDependencies) + vendored third-party components ."
|
|
456
|
+
"content": "BREP.io Source https://github.com/mmiscool/BREP NPM package: brep-io-kernel https://www.npmjs.com/package/brep-io-kernel Live API examples https://BREP.io/apiExamples/index.html Developer Discord https://discord.gg/R5KNAKrQ BREP.io is a browser-based CAD application and JavaScript kernel for feature-based solid modeling. At its core is a BREP-style modeler with explicit geometry/topology objects such as Solid , Face , Edge , and Vertex , paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans ( manifold-3d ), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs. This project is in active development and APIs may continue to evolve. Workbenches Modeling Workbench Import Workbench Surfacing Workbench Sheet Metal Workbench Assemblies Workbench Wire Harness Workbench PMI Workbench All Workbench Screenshots Documentation Index General: Getting Started Developer Docs Index Bug Reporting and Repro Test Cases Highlights What's New API Examples Core APIs: BREP API Export Map BREP Kernel Reference Solid Methods Expressions and Configurator Part History 2D Sketch Solver Embeddable CAD ( CadEmbed ) Embeddable Sketcher ( Sketcher2DEmbed ) System docs: History Systems Input Params Schema File Formats: Import and Export Plugins and Examples Inspector Inspector Improvements Mode guides: Modeling Mode Sketch Mode PMI Mode 2D Sheets Mode Modeling Feature Docs Feature index: All Feature Docs Primitives and setup: Primitive Cube Primitive Cylinder Primitive Cone Primitive Sphere Primitive Torus Primitive Pyramid Plane Datum Datium Sketch Spline Helix Solid operations: Extrude Sweep Tube Loft Revolve Mirror Boolean Fillet Chamfer Hole Offset Shell Remesh Transform Pattern, import, and generation: Pattern (Legacy Combined) Pattern Linear Pattern Radial Import 3D Model Image Heightmap Solid Image to Face Text to Face Assembly and sheet metal: Assembly Component Sheet Metal Tab Sheet Metal Contour Flange Sheet Metal Flange Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout. Assembly Constraints Assembly Constraint Solver Coincident Distance Angle Parallel Touch Align Fixed PMI Annotation Docs PMI Annotations Index Linear Dimension Radial Dimension Angle Dimension Leader Note Hole Callout Explode Body Quick Start Prerequisites: Node.js 18+ pnpm git submodule update --init --recursive Emscripten SDK ( emcmake / emcc on PATH , or EMSDK installed at $HOME/emsdk ) Install and run locally: bash git submodule update --init --recursive pnpm install pnpm dev Then open the Vite URL shown in your terminal. Main app shell: /index.html Direct CAD workspace: /cad.html Build, Test, and Utility Commands Command Purpose pnpm dev Prepares fonts, builds the kernel bundle, then runs the Vite dev server. pnpm build Production build of the app into dist/ (includes kernel build step). pnpm build:manifoldPlus Builds the local manifold wasm/js bundle from the vendor/manifold3d submodule plus local custom bindings. pnpm build:kernel Builds the ESM kernel bundle into dist-kernel/ and syncs assets. pnpm use:manifold:npm Switches runtime/builds to the published manifold-3d npm package. pnpm use:manifold:local Switches runtime/builds to the locally compiled manifold bundle. pnpm which:manifold Prints the currently selected manifold source. pnpm test Runs the Node test suite ( src/tests/tests.js ), writing artifacts to tests/results/ . pnpm liveTesting Watches src/ and tests/ and reruns tests on change. pnpm capture Captures docs/dialog screenshots. pnpm generateLicenses Regenerates dependency and bundled-font license summaries. Build outputs: dist/ : static web app (ready for CDN/web hosting) dist-kernel/ : published kernel bundle artifacts CI and Pages Deployments The kernel build compiles a custom wasm bundle from the vendor/manifold3d git submodule. CI environments must: fetch submodules install Emscripten/EMSDK before running pnpm build This repo includes GitHub Actions workflows for: npm publishing with submodules + EMSDK Cloudflare Pages deployment via Wrangler Direct Upload For Cloudflare Pages, use the GitHub Actions deploy workflow instead of relying on Cloudflare's Git build container to compile the wasm bundle. Configure these repository settings before enabling the workflow: secret CLOUDFLARE_ACCOUNT_ID secret CLOUDFLARE_API_TOKEN variable CLOUDFLARE_PAGES_PROJECT_NAME Use as an NPM Package Package name: brep-io-kernel (ESM-only). Install: bash pnpm add brep-io-kernel Main imports: javascript import { BREP, PartHistory, AssemblyConstraintHistory, AssemblyConstraintRegistry, CadEmbed, Sketcher2DEmbed } from \"brep-io-kernel\" ; Subpath imports: javascript import { BREP } from \"brep-io-kernel/BREP\" ; import { PartHistory } from \"brep-io-kernel/PartHistory\" ; import { CadEmbed } from \"brep-io-kernel/CAD\" ; import { Sketcher2DEmbed } from \"brep-io-kernel/Sketcher2D\" ; import { ConstraintSolver, ConstraintEngine, constraints } from \"brep-io-kernel/SketchSolver2D\" ; Node examples: brep-io-kernel-examples/README.md CLI helper: bash npx brep-io-kernel npx brep-io-kernel --host 127.0.0.1 --port 4173 npx brep-io-kernel --help License helper APIs: javascript import { getPackageLicenseInfoString, getAllLicensesInfoString } from \"brep-io-kernel\" ; console.log(getPackageLicenseInfoString()); // package license info console.log(getAllLicensesInfoString()); // package + production dependencies CommonJS note: javascript const { BREP } = await import ( \"brep-io-kernel\" ); Repository Layout src/BREP : core solid/kernel implementation src/features : feature implementations and dialogs src/assemblyConstraints : assembly solver and constraints src/UI : CAD/sketcher UI and embedding bridges docs/ : markdown docs and screenshots apiExamples/ : standalone browser API demos tests/ and src/tests/ : test assets and test runner Contributing See CONTRIBUTING.md . License See LICENSE.md . This project uses a dual-licensing strategy managed by Autodrop3d LLC. Documentation API Examples Angle Constraint Coincident Constraint Distance Constraint Fixed Constraint Parallel Constraint Assembly Constraint Solver Touch Align Constraint BREP.js Export Map and Usage BREP Kernel Reference BREP Model and Classes Bug Reporting and Repro Test Cases Embeddable CAD App CONTRIBUTING C++ Solid Porting Cylindrical Face Radius Embedding Developer Docs Index Documentation Screenshots Expressions and Configurator Radius Metadata for Extruded Sketches Feature Dimension Gizmos (Developer) Assembly Component Boolean Chamfer Collapse Edge Datium Datum Edge Smooth Extrude Fillet Helix Hole Image Editor (Shared) Image Heightmap Solid Image to Face Import 3D Model Features Loft Mirror NURBS Face Solid Offset Face Offset Shell Overlap Cleanup Pattern Linear Pattern Radial Pattern (Legacy) Plane Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Remesh Revolve Sheet Metal Contour Flange Sheet Metal Cutout Sheet Metal Flange Sheet Metal Hem Sheet Metal Tab Sketch Smooth With Subdivision Spline Sweep Text to Face Transform Tube File Formats: Import and Export Font Licenses Getting Started GitHub Repo Storage Highlights History Systems How It Works Input Params Schema Recent Inspector Improvements Inspector LICENSE Modeling Mode PMI Mode 2D Sheets Mode Sketch Mode PartHistory Reference Plugins and Examples Angle Dimension Explode Body Hole Callout PMI Annotations Leader Linear Dimension Note Radial Dimension Simplified Radial Dimension Interface 2D Sketch Solver (Standalone) Embeddable 2D Sketcher Solid Methods Reference Topological Face and Edge Naming Specification UI Overview (Browser) What's New Workbench Implementation Plan All Workbench Assemblies Workbench Import Workbench Modeling Workbench PMI Workbench Sheet Metal Workbench Surfacing Workbench Wire Harness Workbench This project's license Copyright 2025 Autodrop3d LLC https://autodrop3d.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 1. Any modifications made to the Software must be submitted to Autodrop3d LLC with an irrevocable assignment of the copyright via git pull request. This is intended to allow Autodrop3d LLC to sell commercial licenses of the Software for use in proprietary products under a dual-licensing strategy. Failure to contribute back modifications without a commercial license purchased from Autodrop3d LLC voids all permissions granted by this license. 2. If Autodrop3d LLC is sold, merged, transferred, or otherwise succeeded by any entity or individual, all rights and obligations described in this license shall transfer automatically to that successor entity or individual. 3. If Autodrop3d LLC ceases operations or dissolves, and no successor entity or individual continues to publicly host the Software in a manner that allows the public to obtain the source code and submit contributions for a period of at least eighteen (18) consecutive months, then Clauses 1 and 2 of this license shall be automatically and irrevocably canceled. The above copyright notice and these permission notices shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Licenses Report of libraries used in this package 33 packages • 6 license types (MIT AND Zlib) 2 packages pako 1 version zlib port to javascript - fast, modularized, with browser support Repo / Homepage pako 1 version zlib port to javascript - fast, modularized, with browser support Repo / Homepage (MIT OR GPL-3.0-or-later) 1 package jszip 1 version Create, read and edit .zip files with JavaScript http://stuartk.com/jszip Author: Stuart Knightley <stuart@stuartk.com> Repo / Homepage Apache-2.0 1 package manifold-3d 1 version Geometry library for topological robustness Repo / Homepage ISC 1 package inherits 1 version Browser-friendly inheritance fully compatible with standard node.js inherits() Repo / Homepage MIT 27 packages @babel/runtime 1 version babel's modular runtime helpers Author: The Babel Team (https://babel.dev/team) Repo / Homepage @tarikjabiri/dxf 1 version A JavaScript interface to Dxf written in TypeScript. Author: Tarik EL JABIRI Repo / Homepage @types/pako 1 version TypeScript definitions for pako Repo / Homepage base64-arraybuffer 1 version Encode/decode base64 data into ArrayBuffers Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage core-js 1 version Standard library Author: Denis Pushkarev <zloirock@zloirock.ru> Repo / Homepage core-util-is 1 version The `util.is*` functions introduced in Node v0.12. Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/) Repo / Homepage css-line-break 1 version Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage fast-png 1 version PNG image decoder and encoder written entirely in JavaScript Author: Michaël Zasso Repo / Homepage html2canvas 1 version Screenshots with JavaScript Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage immediate 1 version A cross browser microtask library Repo / Homepage iobuffer 1 version Read and write binary data on ArrayBuffers Author: Michaël Zasso Repo / Homepage isarray 1 version Array#isArray for older browsers Author: Julian Gruber <mail@juliangruber.com> Repo / Homepage jspdf 1 version PDF Document creation from JavaScript Repo / Homepage lie 1 version A basic but performant promise implementation Repo / Homepage marked 1 version A markdown parser built for speed Author: Christopher Jeffrey Repo / Homepage monaco-editor 1 version A browser based code editor Author: Microsoft Corporation Repo / Homepage pngjs 1 version PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite. Repo / Homepage process-nextick-args 1 version process.nextTick but always with args Repo / Homepage readable-stream 1 version Streams3, a user-land copy of the stream library from Node.js Repo / Homepage safe-buffer 1 version Safer Node.js Buffer API Author: Feross Aboukhadijeh <feross@feross.org> Repo / Homepage setimmediate 1 version A shim for the setImmediate efficient script yielding API Author: YuzuJS Repo / Homepage string_decoder 1 version The string_decoder module from Node core Repo / Homepage text-segmentation 1 version Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage three 1 version JavaScript 3D library Author: mrdoob Repo / Homepage three-mesh-bvh 1 version A BVH implementation to speed up raycasting against three.js meshes. Author: Garrett Johnson <garrett.kjohnson@gmail.com> Repo / Homepage util-deprecate 1 version The Node.js `util.deprecate()` function with browser support Author: Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/) Repo / Homepage utrie 1 version Unicode Trie Author: Niklas von Hertzen <niklasvh@gmail.com> Repo / Homepage SGI-B-2.0 1 package tess2 1 version GLU tesselator ported to Javascript, performs polygon boolean operations and triangulation Author: Matt DesLauriers <dave.des@gmail.com> Repo / Homepage Font Licenses Bundled fonts are licensed separately from npm packages. Font license details Generated from installed node_modules graph (dependencies + optionalDependencies) + vendored third-party components ."
|
|
451
457
|
},
|
|
452
458
|
{
|
|
453
459
|
"title": "Input Params Schema",
|
|
454
460
|
"href": "input-params-schema.html",
|
|
455
461
|
"summary": "Input Params Schema Feature, PMI annotation, and assembly constraint dialogs are rendered from an inputParamsSchema object by SchemaForm ( src/UI/featureDialogs.js ). Each key in the schema corresponds to a param entry; the widget type and....",
|
|
456
|
-
"content": "Input Params Schema Feature, PMI annotation, and assembly constraint dialogs are rendered from an inputParamsSchema object by SchemaForm ( src/UI/featureDialogs.js ). Each key in the schema corresponds to a param entry; the widget type and its options are driven by the definition object. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Embeded 2D Sketcher: https://BREP.io/apiExamples/Embeded_2D_Sketcher.html javascript const inputParamsSchema = { distance: { type: 'number' , label: 'Distance' , default_value: 10, // Optional step: 0.1, // Optional min: 0, // Optional }, profile: { type: 'reference_selection' , label: 'Profile' , selectionFilter: [ 'FACE' , 'SKETCH' ], multiple: false , // Optional }, }; SchemaForm clones default_value when seeding params ; when a default is omitted it falls back to false for booleans, '' for most text/select fields, null for single reference selections, { position:[0,0,0], rotationEuler:[0,0,0], scale:[1,1,1] } for transforms, and [0,0,0] for vec3. Keys id and featureID are reserved and not rendered. You can override rendering with renderWidget or widgetRenderer (a function that receives { ui, key, def, id, controlWrap, row } ). PMI annotations also honor defaultResolver({ pmimode, handler }) for dynamic defaults. Selection filters for references reference_selection widgets call SelectionFilter.SetSelectionTypes(def.selectionFilter) . Valid tokens come from SelectionFilter.TYPES : SOLID , COMPONENT , FACE , PLANE , SKETCH , EDGE , LOOP , VERTEX , or ALL (to allow any scene pick). Widget types string Required: type: 'string' , label Optional: default_value , hint Behavior: single-line text box. Example: javascript title: { type: 'string' , label: 'Title' , default_value: 'My feature' , // Optional hint: 'Shown in the tree' , // Optional } textarea Required: type: 'textarea' , label Optional: default_value , hint , rows , placeholder Behavior: multi-line text area with optional placeholder. Example: javascript note: { type: 'textarea' , label: 'Note' , rows: 3, // Optional placeholder: 'Enter notes…' , // Optional } number Required: type: 'number' , label Optional: default_value , hint , step , min , max Behavior: numeric input that flips to text when the value looks like an expression. Example: javascript distance: { type: 'number' , label: 'Distance' , default_value: 5, // Optional step: 0.01, // Optional min: 0, // Optional max: 100, // Optional } boolean Required: type: 'boolean' , label Optional: default_value , hint Behavior: checkbox storing a boolean. Example: javascript copy: { type: 'boolean' , label: 'Create copy' , default_value: false , // Optional hint: 'Duplicates instead of replacing' , // Optional } options Required: type: 'options' , label , options (array of string values) Optional: default_value , hint Behavior: <select> with provided options; stored value is the selected string. Example: javascript mode: { type: 'options' , label: 'Space' , options: [ 'WORLD' , 'LOCAL' ], default_value: 'WORLD' , // Optional hint: 'Choose frame' , // Optional } reference_selection Required: type: 'reference_selection' , label , selectionFilter (see tokens above) Optional: default_value , hint , multiple , minSelections , maxSelections , placeholder , selectionValidator(candidate, ctx) , selectionValidationMessage Behavior: single-select shows a button with clear control; multi-select shows chips plus a hidden input. Values are normalized reference names; multi-select stores an array. minSelections / maxSelections enforce counts when chips render. When selectionValidator is provided it runs before the picked scene object is committed; returning false blocks the pick. ctx includes the live form state ( params , featureID , currentValue , currentSelectionNames , currentSelections , viewer , partHistory , key , def , inputEl , and pick metadata when available). selectionValidationMessage can be a string or function and is shown when a selection is blocked. Example: javascript profile: { type: 'reference_selection' , label: 'Profile' , selectionFilter: [ 'FACE' , 'SKETCH' ], multiple: false , // Optional default_value: null , // Optional hint: 'Pick a face or sketch' , // Optional placeholder: 'Click then pick…' , // Optional }, targets: { type: 'reference_selection' , label: 'Targets' , selectionFilter: [ 'SOLID' ], multiple: true , // Optional minSelections: 1, // Optional maxSelections: 4, // Optional default_value: [], // Optional placeholder: 'Pick solids…' , // Optional hint: 'Set boolean targets' , // Optional } transform Required: type: 'transform' , label Optional: default_value , hint Behavior: launches the transform gizmo plus numeric grid. Value shape { position:[x,y,z], rotationEuler:[rx,ry,rz], scale:[sx,sy,sz] } . Example: javascript transform: { type: 'transform' , label: 'Placement' , hint: 'Use the gizmo' , // Optional default_value: { position: [0, 0, 0], rotationEuler: [0, 0, 0], scale: [1, 1, 1], }, // Optional } vec3 Required: type: 'vec3' , label Optional: default_value , hint , step , uniformToggle , uniformDefault , uniformLockLabel Behavior: three-number row; when uniformToggle is true a checkbox can lock all three values together. Example: javascript scale: { type: 'vec3' , label: 'Scale' , default_value: [1, 1, 1], // Optional step: 0.1, // Optional uniformToggle: true , // Optional uniformDefault: true , // Optional uniformLockLabel: 'Uniform scale' , // Optional hint: 'Set per-axis scale' , // Optional } boolean_operation Required: type: 'boolean_operation' , label Optional: default_value (expects { targets: [], operation: 'NONE' } ), options (operation list), hint Behavior: dropdown of operations plus a multi-reference chip list fixed to SOLID selection filtering. Example: javascript boolean: { type: 'boolean_operation' , label: 'Boolean' , default_value: { targets: [], operation: 'NONE' }, // Optional options: [ 'NONE' , 'UNION' , 'SUBTRACT' , 'INTERSECT' ], // Optional hint: 'Apply a CSG operation' , // Optional } file Required: type: 'file' , label Optional: hint , accept Behavior: hidden <input type=\"file\"> paired with a trigger button; selected file is stored as a data URL. accept is forwarded to the file input. Example: javascript texture: { type: 'file' , label: 'Pick image…' , accept: '.png,image/png' , // Optional hint: 'PNG files only' , // Optional } button Required: type: 'button' , label Optional: hint , actionFunction(ctx) Behavior: no value is stored; clicking runs actionFunction (receives { featureID, key, viewer, partHistory, feature, params, schemaDef } ) or falls back to onAction supplied to SchemaForm . Example: javascript preview: { type: 'button' , label: 'Preview' , hint: 'Run without saving' , // Optional actionFunction: ({ feature }) => feature?.rerun?.(), // Optional } component_selector Required: type: 'component_selector' , label Optional: hint , buttonLabel , dialogTitle , onSelect(ctx, record) Behavior: opens the component library modal and writes the chosen component name into the param; onSelect can stash extra payload (see AssemblyComponentFeature ). Example: javascript componentName: { type: 'component_selector' , label: 'Component' , buttonLabel: 'Select…' , // Optional dialogTitle: 'Select Component' , // Optional onSelect: (ctx, record) => handleSelection(ctx, record), // Optional hint: 'Pull from component library' , // Optional } fallback Any unknown type (or omitted type ) renders a plain text input via renderDefaultField . Use this for quick string fields or to prototype a custom widget before registering one."
|
|
462
|
+
"content": "Input Params Schema Feature, PMI annotation, and assembly constraint dialogs are rendered from an inputParamsSchema object by SchemaForm ( src/UI/featureDialogs.js ). Each key in the schema corresponds to a param entry; the widget type and its options are driven by the definition object. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Embeded 2D Sketcher: https://BREP.io/apiExamples/Embeded_2D_Sketcher.html javascript const inputParamsSchema = { distance: { type: 'number' , label: 'Distance' , default_value: 10, // Optional step: 0.1, // Optional min: 0, // Optional }, profile: { type: 'reference_selection' , label: 'Profile' , selectionFilter: [ 'FACE' , 'SKETCH' ], multiple: false , // Optional }, }; SchemaForm clones default_value when seeding params ; when a default is omitted it falls back to false for booleans, '' for most text/select fields, null for single reference selections, { position:[0,0,0], rotationEuler:[0,0,0], scale:[1,1,1] } for transforms, and [0,0,0] for vec3. Keys id and featureID are reserved and not rendered. You can override rendering with renderWidget or widgetRenderer (a function that receives { ui, key, def, id, controlWrap, row } ). PMI annotations also honor defaultResolver({ pmimode, handler }) for dynamic defaults. Expressions in dialogs For the dedicated user-facing Expressions panel guide, see Expressions and Configurator . SchemaForm evaluates expression-capable fields against partHistory.getExpressionsSource() . That source includes: the default prelude ( resolution = 32; ) the current configurator values object ( configurator ) the user script from the Expressions panel In practice, dialog fields can reference: javascript width * 2 configurator.panelWidth configurator.materialName Expression UI behavior: number fields always accept expressions. string fields can opt in with allowExpression: true . The form stores raw expression text in params.__expr and keeps the evaluated display value in the main field. When expressions or configurator values change, open dialogs refresh so displayed values stay in sync. Selection filters for references reference_selection widgets call SelectionFilter.SetSelectionTypes(def.selectionFilter) . Valid tokens come from SelectionFilter.TYPES : SOLID , COMPONENT , FACE , PLANE , SKETCH , EDGE , LOOP , VERTEX , or ALL (to allow any scene pick). Widget types string Required: type: 'string' , label Optional: default_value , hint , allowExpression Behavior: single-line text box. When allowExpression: true , the field can evaluate expression text and stores the raw expression in params.__expr[key] . Example: javascript title: { type: 'string' , label: 'Title' , default_value: 'My feature' , // Optional hint: 'Shown in the tree' , // Optional } javascript text: { type: 'string' , label: 'Text' , allowExpression: true , default_value: 'configurator.label' } textarea Required: type: 'textarea' , label Optional: default_value , hint , rows , placeholder Behavior: multi-line text area with optional placeholder. Example: javascript note: { type: 'textarea' , label: 'Note' , rows: 3, // Optional placeholder: 'Enter notes…' , // Optional } number Required: type: 'number' , label Optional: default_value , hint , step , min , max Behavior: numeric input that flips to text when the value looks like an expression. Number fields can reference variables from the Expressions panel and configurator values through configurator.fieldName . Example: javascript distance: { type: 'number' , label: 'Distance' , default_value: 5, // Optional step: 0.01, // Optional min: 0, // Optional max: 100, // Optional } javascript width: { type: 'number' , label: 'Width' , default_value: 'configurator.panelWidth' , min: 0, step: 0.1 } boolean Required: type: 'boolean' , label Optional: default_value , hint Behavior: checkbox storing a boolean. Example: javascript copy: { type: 'boolean' , label: 'Create copy' , default_value: false , // Optional hint: 'Duplicates instead of replacing' , // Optional } options Required: type: 'options' , label , options (array of string values) Optional: default_value , hint Behavior: <select> with provided options; stored value is the selected string. Example: javascript mode: { type: 'options' , label: 'Space' , options: [ 'WORLD' , 'LOCAL' ], default_value: 'WORLD' , // Optional hint: 'Choose frame' , // Optional } reference_selection Required: type: 'reference_selection' , label , selectionFilter (see tokens above) Optional: default_value , hint , multiple , minSelections , maxSelections , placeholder , selectionValidator(candidate, ctx) , selectionValidationMessage Behavior: single-select shows a button with clear control; multi-select shows chips plus a hidden input. Values are normalized reference names; multi-select stores an array. minSelections / maxSelections enforce counts when chips render. When selectionValidator is provided it runs before the picked scene object is committed; returning false blocks the pick. ctx includes the live form state ( params , featureID , currentValue , currentSelectionNames , currentSelections , viewer , partHistory , key , def , inputEl , and pick metadata when available). selectionValidationMessage can be a string or function and is shown when a selection is blocked. Example: javascript profile: { type: 'reference_selection' , label: 'Profile' , selectionFilter: [ 'FACE' , 'SKETCH' ], multiple: false , // Optional default_value: null , // Optional hint: 'Pick a face or sketch' , // Optional placeholder: 'Click then pick…' , // Optional }, targets: { type: 'reference_selection' , label: 'Targets' , selectionFilter: [ 'SOLID' ], multiple: true , // Optional minSelections: 1, // Optional maxSelections: 4, // Optional default_value: [], // Optional placeholder: 'Pick solids…' , // Optional hint: 'Set boolean targets' , // Optional } transform Required: type: 'transform' , label Optional: default_value , hint Behavior: launches the transform gizmo plus numeric grid. Value shape { position:[x,y,z], rotationEuler:[rx,ry,rz], scale:[sx,sy,sz] } . Example: javascript transform: { type: 'transform' , label: 'Placement' , hint: 'Use the gizmo' , // Optional default_value: { position: [0, 0, 0], rotationEuler: [0, 0, 0], scale: [1, 1, 1], }, // Optional } vec3 Required: type: 'vec3' , label Optional: default_value , hint , step , uniformToggle , uniformDefault , uniformLockLabel Behavior: three-number row; when uniformToggle is true a checkbox can lock all three values together. Example: javascript scale: { type: 'vec3' , label: 'Scale' , default_value: [1, 1, 1], // Optional step: 0.1, // Optional uniformToggle: true , // Optional uniformDefault: true , // Optional uniformLockLabel: 'Uniform scale' , // Optional hint: 'Set per-axis scale' , // Optional } boolean_operation Required: type: 'boolean_operation' , label Optional: default_value (expects { targets: [], operation: 'NONE' } ), options (operation list), hint Behavior: dropdown of operations plus a multi-reference chip list fixed to SOLID selection filtering. Example: javascript boolean: { type: 'boolean_operation' , label: 'Boolean' , default_value: { targets: [], operation: 'NONE' }, // Optional options: [ 'NONE' , 'UNION' , 'SUBTRACT' , 'INTERSECT' ], // Optional hint: 'Apply a CSG operation' , // Optional } file Required: type: 'file' , label Optional: hint , accept Behavior: hidden <input type=\"file\"> paired with a trigger button; selected file is stored as a data URL. accept is forwarded to the file input. Example: javascript texture: { type: 'file' , label: 'Pick image…' , accept: '.png,image/png' , // Optional hint: 'PNG files only' , // Optional } button Required: type: 'button' , label Optional: hint , actionFunction(ctx) Behavior: no value is stored; clicking runs actionFunction (receives { featureID, key, viewer, partHistory, feature, params, schemaDef } ) or falls back to onAction supplied to SchemaForm . Example: javascript preview: { type: 'button' , label: 'Preview' , hint: 'Run without saving' , // Optional actionFunction: ({ feature }) => feature?.rerun?.(), // Optional } component_selector Required: type: 'component_selector' , label Optional: hint , buttonLabel , dialogTitle , onSelect(ctx, record) Behavior: opens the component library modal and writes the chosen component name into the param; onSelect can stash extra payload (see AssemblyComponentFeature ). Example: javascript componentName: { type: 'component_selector' , label: 'Component' , buttonLabel: 'Select…' , // Optional dialogTitle: 'Select Component' , // Optional onSelect: (ctx, record) => handleSelection(ctx, record), // Optional hint: 'Pull from component library' , // Optional } fallback Any unknown type (or omitted type ) renders a plain text input via renderDefaultField . Use this for quick string fields or to prototype a custom widget before registering one."
|
|
457
463
|
},
|
|
458
464
|
{
|
|
459
465
|
"title": "Recent Inspector Improvements",
|
|
@@ -477,7 +483,7 @@
|
|
|
477
483
|
"title": "Modeling Mode",
|
|
478
484
|
"href": "modes__modeling.html",
|
|
479
485
|
"summary": "Modeling Mode Modeling Mode is the default workspace for solid construction. The scene shows the active history tree, 3D viewport, and main toolbar controls. Add primitives, booleans, and editing features to the timeline, then drag or edit....",
|
|
480
|
-
"content": "Modeling Mode Modeling Mode is the default workspace for solid construction. The scene shows the active history tree, 3D viewport, and main toolbar controls. Add primitives, booleans, and editing features to the timeline, then drag or edit them to re-run the part. Selection filters and gizmos in this mode operate directly on bodies, faces, and edges to drive feature inputs. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Key tools: Main toolbar (Save, Zoom to Fit, Wireframe, Import/Export, About) Feature history panel for creating primitives, sketches, and operations Inspector for per-face metrics like area and owning feature Use Modeling Mode to position solids, apply patterns, and manage global transforms before switching to specialized modes."
|
|
486
|
+
"content": "Modeling Mode Modeling Mode is the default workspace for solid construction. The scene shows the active history tree, 3D viewport, and main toolbar controls. Add primitives, booleans, and editing features to the timeline, then drag or edit them to re-run the part. Selection filters and gizmos in this mode operate directly on bodies, faces, and edges to drive feature inputs. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Key tools: Main toolbar (Save, Zoom to Fit, Wireframe, Import/Export, About) Feature history panel for creating primitives, sketches, and operations Expressions panel for global variables and configurator widgets Inspector for per-face metrics like area and owning feature The Expressions panel supports two related workflows: expressions : a shared JavaScript-style scratchpad for variables such as width = 20; configurator : a UI-driven set of widgets ( slider , number , select , string ) whose values are injected into expressions as configurator.fieldName If configurator widgets exist, the generated configurator form appears above the expression editor. Those values are stored in part history, survive save/load, and can be referenced by feature dialogs through normal expression entry. Use Modeling Mode to position solids, apply patterns, and manage global transforms before switching to specialized modes."
|
|
481
487
|
},
|
|
482
488
|
{
|
|
483
489
|
"title": "PMI Mode",
|
|
@@ -500,8 +506,8 @@
|
|
|
500
506
|
{
|
|
501
507
|
"title": "PartHistory Reference",
|
|
502
508
|
"href": "part-history.html",
|
|
503
|
-
"summary": "PartHistory Reference PartHistory lives in src/PartHistory.js and is the core modeling history manager. It owns the feature list, the shared Three.js scene, the expression scratchpad, PMI views, metadata, and the
|
|
504
|
-
"content": "PartHistory Reference PartHistory lives in src/PartHistory.js and is the core modeling history manager. It owns the feature list, the shared Three.js scene, the expression scratchpad, PMI views, metadata, and the assembly constraint history. It can rebuild geometry deterministically by replaying feature entries, serialize and restore part state, and maintain undo/redo via JSON snapshots. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Embeded CAD Integration Test: https://BREP.io/apiExamples/Embeded_CAD_Integration_Test.html Responsibilities Manage the ordered list of modeling features ( features ). Own and mutate the shared Three.js scene . Evaluate parameter expressions via a user-defined expression script. Run the history to (re)build geometry from feature inputs. Persist and restore feature history, PMI views, metadata, and assembly constraints. Track and apply undo/redo snapshots. Sync and update assembly component data. Constructor new PartHistory() Creates a new history manager and initializes: features : empty array scene : new THREE.Scene() featureRegistry : new FeatureRegistry() assemblyConstraintRegistry : new AssemblyConstraintRegistry() assemblyConstraintHistory : new AssemblyConstraintHistory(this, registry) pmiViewsManager : new PMIViewsManager(this) metadataManager : new MetadataManager() expressions : default example script string callbacks : empty bag for optional hooks Undo/redo state in _historyUndo The constructor also soft-overrides scene.remove and scene.add to aid debugging and to block removal of objects with userData.preventRemove . Data model Feature entry shape Each entry in features is a plain object with at least: javascript { type: string, // Feature type string (registry key) inputParams: Object, // User inputs; includes an id persistentData: Object, // Saved outputs from previous runs timestamp?: number, // Last run time (ms epoch) dirty?: boolean, // Marks entry for re-run lastRunInputParams?: string, // JSON string for dirty detection lastRun?: { // Execution metadata ok: boolean, startedAt: number, endedAt: number, durationMs: number, error: { name, message, stack } | null }, effects?: { added: [], removed: [] }, previouseExpressions?: Object // Cached evaluated numeric inputs } IDs are normalized and kept in sync: feature.inputParams.id and feature.id are strings. A non-enumerable feature.inputParams.featureID property is defined as an alias of id for legacy compatibility. Feature class contract A feature class (from FeatureRegistry ) is expected to provide: static inputParamsSchema describing inputs and defaults. run(partHistory) which returns { added, removed } . Optional longName , shortName , name for display. (Sketch only) hasSketchChanged(feature) for dirty detection. Result artifacts run() should return an object with: added : array of objects to add to the scene removed : array of objects to remove from the scene Objects are expected to be compatible with Three.js scene nodes. If they implement free() and/or visualize() , those are called automatically. Expressions expressions is a user-editable script string. Numeric inputs can reference it. Static helper: PartHistory.evaluateExpression(expressionsSource, equation) Instance helper: partHistory.evaluateExpression(equation) evaluateExpression uses Function() to execute the script and return an evaluated value. It returns null on error. Treat expression input as code (do not evaluate untrusted content). Execution flow runHistory() Rebuilds the scene by replaying features in order. High-level flow: Clear the scene and dispose resources, preserving lights, cameras, and transform gizmos. Iterate features in order: - Normalize ID linkage for each feature. - Stop after currentHistoryStepId (if set) but keep later features in the list. - Resolve the feature class from the registry; if missing, mark lastRun with a MissingFeature error and continue. - Copy persistentData into the feature instance. - Remove any existing scene children with owningFeatureID === featureId (rerun case). - Compute dirty state based on: - changed input params - feature timestamps vs. upstream features - newer referenced objects - expression evaluation changes - Sketch change detection - If dirty: - call run() - record lastRun , timestamp , effects , lastRunInputParams - Apply effects via applyFeatureEffects() . Run assembly constraints. Call optional callbacks. Notes: currentHistoryStepId is not cleared inside runHistory() . Any feature error stops the run and logs the error. runHistory() returns this . Scene integration and selection When adding objects: applyFeatureEffects() calls free() and visualize() if present. Each added object and its descendants get timestamp and owningFeatureID . Each object gets an onClick handler that uses SelectionFilter.toggleSelection . Objects with userData.preventRemove are not removed when the scene is cleared. Serialization toJSON() Returns a pretty-printed JSON string containing: features (type, inputParams, persistentData, timestamp) idCounter expressions pmiViews (via PMIViewsManager ) metadata (from MetadataManager ) assemblyConstraints and assemblyConstraintIdCounter Before export, assembly component transforms are synced into feature input params. fromJSON(jsonString, options) Restores state from a JSON string. Behavior: Migrates legacy featureID fields to id . Rehydrates PMI views and metadata. Loads assembly constraints into AssemblyConstraintHistory . Resets undo/redo history unless options.skipUndoReset is true . Undo / redo PartHistory maintains a JSON snapshot stack: _historyUndo.undoStack and _historyUndo.redoStack Debounced snapshot capture ( debounceMs , default 350ms) Max snapshot count ( max , default 50) Key methods: queueHistorySnapshot({ debounceMs, force }) flushHistorySnapshot({ force }) undoFeatureHistory() redoFeatureHistory() canUndoFeatureHistory() canRedoFeatureHistory() Undo/redo restores by calling fromJSON() and re-running runHistory() . Assembly components and constraints assemblyConstraintHistory owns constraints and runs the solver. runAssemblyConstraints() delegates to AssemblyConstraintHistory.runAll() . Assembly component utilities: hasAssemblyComponents() : returns true if any feature is an assembly component. syncAssemblyComponentTransforms() : copies scene transforms into feature input params. getOutdatedAssemblyComponentCount() : counts components whose source data changed. updateAssemblyComponents({ rerun = true }) : refreshes component data and optionally re-runs history. Public properties features: Array<Object> scene: THREE.Scene idCounter: number featureRegistry: FeatureRegistry assemblyConstraintRegistry: AssemblyConstraintRegistry assemblyConstraintHistory: AssemblyConstraintHistory pmiViewsManager: PMIViewsManager metadataManager: MetadataManager expressions: string - currentHistoryStepId: string | null callbacks: Object (optional hooks) _historyUndo: Object (internal state) Callbacks callbacks is a simple bag of optional functions: callbacks.run(featureId) - called before each feature runs (awaited). callbacks.reset() - called after reset() clears scene (awaited). callbacks.afterRunHistory() - called after runHistory() completes. callbacks.afterReset() - called after reset() finishes. API reference Static #### PartHistory.evaluateExpression(expressionsSource, equation): any | null Evaluates equation using expressionsSource as the preamble. Returns null on error. Instance #### evaluateExpression(equation): any | null Same as static helper but uses this.expressions . #### getObjectByName(name): Object3D | null Delegates to scene.getObjectByName . reset(): Promise<void> Clears features, resets managers, clears the scene, and resets undo/redo. Calls callbacks.reset and callbacks.afterReset . runHistory(): Promise<PartHistory> Replays features, rebuilds the scene, runs constraints, and calls callbacks.afterRunHistory . applyFeatureEffects(effects, featureId, feature): Promise<void> Applies added / removed artifacts to the scene, sets timestamps/ownership, and attaches selection handlers. toJSON(): Promise<string> Serializes the full part history and related state. fromJSON(jsonString, options?): Promise<void> Restores from a serialized history string. generateId(prefix): Promise<string> Increments idCounter and returns ${prefix}${idCounter} . sanitizeInputParams(schema, inputParams): Promise<Object> Normalizes and evaluates input params based on schema types: number : evaluates expressions reference_selection : resolves object names to scene objects boolean_operation : normalizes op and target list, optional bias/offset transform : evaluates position/rotation/scale arrays vec3 : evaluates 3-vector entries boolean : normalizes to boolean default: pass-through newFeature(featureType): Promise<Object> Creates a new feature entry, seeds defaults from schema, assigns an ID, and appends it to features . removeFeature(featureId): Promise<void> Removes any feature with matching ID. resetHistoryUndo(): void Clears undo/redo stacks and internal flags. queueHistorySnapshot(options?): void Debounced snapshot capture. flushHistorySnapshot(options?): Promise<void> Forces a snapshot immediately. undoFeatureHistory(): Promise<boolean> Restores the previous snapshot if available. redoFeatureHistory(): Promise<boolean> Reapplies the next snapshot if available. runAssemblyConstraints(): Promise<Array> Runs the assembly constraint solver. hasAssemblyComponents(): boolean Checks if any feature is an assembly component. syncAssemblyComponentTransforms(): void Writes current scene transforms into feature input params. getOutdatedAssemblyComponentCount(): number Returns number of outdated components. updateAssemblyComponents(options?): Promise<{ updatedCount, reran }> Refreshes assembly component data; optionally re-runs history. Internal helpers These methods are intended for internal use: _coerceRunEffects , _attachSelectionHandlers , _safeRemove _commitHistorySnapshot , _applyHistorySnapshot _sanitizePersistentDataForExport , _collectAssemblyComponentUpdates #runFeatureEntryMigrations , #linkFeatureParams , #prepareFeatureEntry , #prepareFeatureList #disposeSceneObjects , #disposeObjectResources , #disposeMaterialResources Related helper extractDefaultValues(schema) Exported alongside PartHistory . Returns a deep-cloned object of default_value for each schema key. Usage examples Basic feature run javascript import { PartHistory } from './PartHistory.js' ; const history = new PartHistory(); const feature = await history.newFeature( 'Sketch' ); // set feature.inputParams as needed await history.runHistory(); Expressions javascript history.expressions = \"x = 10; y = x * 2;\" ; feature.inputParams.depth = \"y + 5\" ; await history.runHistory(); Save / load javascript const json = await history.toJSON(); const restored = new PartHistory(); await restored.fromJSON(json); await restored.runHistory(); Undo / redo javascript history.queueHistorySnapshot(); await history.undoFeatureHistory(); await history.redoFeatureHistory();"
|
|
509
|
+
"summary": "PartHistory Reference PartHistory lives in src/PartHistory.js and is the core modeling history manager. It owns the feature list, the shared Three.js scene, the expression scratchpad, configurator state, PMI views, metadata, and the assembl...",
|
|
510
|
+
"content": "PartHistory Reference PartHistory lives in src/PartHistory.js and is the core modeling history manager. It owns the feature list, the shared Three.js scene, the expression scratchpad, configurator state, PMI views, metadata, and the assembly constraint history. It can rebuild geometry deterministically by replaying feature entries, serialize and restore part state, and maintain undo/redo via JSON snapshots. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Embeded CAD Integration Test: https://BREP.io/apiExamples/Embeded_CAD_Integration_Test.html Responsibilities Manage the ordered list of modeling features ( features ). Own and mutate the shared Three.js scene . Evaluate parameter expressions via a user-defined expression script. Store configurator widget definitions and current configurator values. Run the history to (re)build geometry from feature inputs. Persist and restore feature history, PMI views, metadata, and assembly constraints. Track and apply undo/redo snapshots. Sync and update assembly component data. Constructor new PartHistory() Creates a new history manager and initializes: features : empty array scene : new THREE.Scene() featureRegistry : new FeatureRegistry() assemblyConstraintRegistry : new AssemblyConstraintRegistry() assemblyConstraintHistory : new AssemblyConstraintHistory(this, registry) pmiViewsManager : new PMIViewsManager(this) metadataManager : new MetadataManager() expressions : default example script string configurator : { fields: [], values: {} } callbacks : empty bag for optional hooks Undo/redo state in _historyUndo The constructor also soft-overrides scene.remove and scene.add to aid debugging and to block removal of objects with userData.preventRemove . Data model Feature entry shape Each entry in features is a plain object with at least: javascript { type: string, // Feature type string (registry key) inputParams: Object, // User inputs; includes an id persistentData: Object, // Saved outputs from previous runs timestamp?: number, // Last run time (ms epoch) dirty?: boolean, // Marks entry for re-run lastRunInputParams?: string, // JSON string for dirty detection lastRun?: { // Execution metadata ok: boolean, startedAt: number, endedAt: number, durationMs: number, error: { name, message, stack } | null }, effects?: { added: [], removed: [] }, previouseExpressions?: Object // Cached evaluated numeric inputs } IDs are normalized and kept in sync: feature.inputParams.id and feature.id are strings. A non-enumerable feature.inputParams.featureID property is defined as an alias of id for legacy compatibility. Feature class contract A feature class (from FeatureRegistry ) is expected to provide: static inputParamsSchema describing inputs and defaults. run(partHistory) which returns { added, removed } . Optional longName , shortName , name for display. (Sketch only) hasSketchChanged(feature) for dirty detection. Result artifacts run() should return an object with: added : array of objects to add to the scene removed : array of objects to remove from the scene Objects are expected to be compatible with Three.js scene nodes. If they implement free() and/or visualize() , those are called automatically. Expressions For the user-facing guide focused specifically on the Expressions panel and configurator workflow, see Expressions and Configurator . expressions is a user-editable script string stored on partHistory.expressions . Expression-aware inputs evaluate against a shared source built from: the default prelude ( resolution = 32; ) the current configurator values object ( configurator ) the user script in expressions This means feature dialogs can reference both scratch variables and configurator fields: javascript width = 20; height = width * 2; javascript configurator.panelWidth configurator.materialName Static helper: PartHistory.evaluateExpression(expressionsSource, equation) Instance helper: partHistory.evaluateExpression(equation) evaluateExpression uses Function() to execute the script and return an evaluated value. It returns null on error. Treat expression input as code (do not evaluate untrusted content). Configurator configurator is stored on partHistory.configurator and has this normalized shape: javascript { fields: [ { name: 'panelWidth' , label: 'Panel Width' , type: 'slider' , // slider | number | select | string defaultValue: 42, min: 0, max: 100, step: 1 } ], values: { panelWidth: 42 } } Behavior in the Expressions sidebar: The live configurator form is shown above the expression editor only when at least one configurator field exists. The Edit Configurator session can add, remove, and edit widgets of type slider , number , select , and string . While the editor is open, the live configurator form previews the draft widget set in real time. The model is not re-run for those draft edits until the edit session is closed or saved. After the edit session is committed, runHistory() is triggered and the resulting configurator values become available through configurator.fieldName . Execution flow runHistory() Rebuilds the scene by replaying features in order. High-level flow: Clear the scene and dispose resources, preserving lights, cameras, and transform gizmos. Iterate features in order: - Normalize ID linkage for each feature. - Stop after currentHistoryStepId (if set) but keep later features in the list. - Resolve the feature class from the registry; if missing, mark lastRun with a MissingFeature error and continue. - Copy persistentData into the feature instance. - Remove any existing scene children with owningFeatureID === featureId (rerun case). - Compute dirty state based on: - changed input params - feature timestamps vs. upstream features - newer referenced objects - expression evaluation changes - Sketch change detection - If dirty: - call run() - record lastRun , timestamp , effects , lastRunInputParams - Apply effects via applyFeatureEffects() . Run assembly constraints. Call optional callbacks. Notes: currentHistoryStepId is not cleared inside runHistory() . Any feature error stops the run and logs the error. runHistory() returns this . Scene integration and selection When adding objects: applyFeatureEffects() calls free() and visualize() if present. Each added object and its descendants get timestamp and owningFeatureID . Each object gets an onClick handler that uses SelectionFilter.toggleSelection . Objects with userData.preventRemove are not removed when the scene is cleared. Serialization toJSON() Returns a pretty-printed JSON string containing: features (type, inputParams, persistentData, timestamp) idCounter expressions configurator pmiViews (via PMIViewsManager ) metadata (from MetadataManager ) assemblyConstraints and assemblyConstraintIdCounter Before export, assembly component transforms are synced into feature input params. fromJSON(jsonString, options) Restores state from a JSON string. Behavior: Migrates legacy featureID fields to id . Rehydrates PMI views and metadata. Loads assembly constraints into AssemblyConstraintHistory . Resets undo/redo history unless options.skipUndoReset is true . Undo / redo PartHistory maintains a JSON snapshot stack: _historyUndo.undoStack and _historyUndo.redoStack Debounced snapshot capture ( debounceMs , default 350ms) Max snapshot count ( max , default 50) Key methods: queueHistorySnapshot({ debounceMs, force }) flushHistorySnapshot({ force }) undoFeatureHistory() redoFeatureHistory() canUndoFeatureHistory() canRedoFeatureHistory() Undo/redo restores by calling fromJSON() and re-running runHistory() . Assembly components and constraints assemblyConstraintHistory owns constraints and runs the solver. runAssemblyConstraints() delegates to AssemblyConstraintHistory.runAll() . Assembly component utilities: hasAssemblyComponents() : returns true if any feature is an assembly component. syncAssemblyComponentTransforms() : copies scene transforms into feature input params. getOutdatedAssemblyComponentCount() : counts components whose source data changed. updateAssemblyComponents({ rerun = true }) : refreshes component data and optionally re-runs history. Public properties features: Array<Object> scene: THREE.Scene idCounter: number featureRegistry: FeatureRegistry assemblyConstraintRegistry: AssemblyConstraintRegistry assemblyConstraintHistory: AssemblyConstraintHistory pmiViewsManager: PMIViewsManager metadataManager: MetadataManager expressions: string configurator: { fields: Array<Object>, values: Object } - currentHistoryStepId: string | null callbacks: Object (optional hooks) _historyUndo: Object (internal state) Callbacks callbacks is a simple bag of optional functions: callbacks.run(featureId) - called before each feature runs (awaited). callbacks.reset() - called after reset() clears scene (awaited). callbacks.afterRunHistory() - called after runHistory() completes. callbacks.afterReset() - called after reset() finishes. API reference Static #### PartHistory.evaluateExpression(expressionsSource, equation): any | null Evaluates equation using expressionsSource as the preamble. Returns null on error. Instance #### evaluateExpression(equation): any | null Same as static helper but uses this.getExpressionsSource() , which includes the default prelude and the current configurator values. buildExpressionSource(expressionsSource = this.expressions): string Builds the executable expression preamble from the default resolution , the current configurator values, and the user script. getExpressionsSource(): string Returns the fully assembled expression source used by dialogs and evaluators. getConfiguratorState(): { fields: Array<Object>, values: Object } Returns a normalized copy of the current configurator definition and values. getConfiguratorValues(): Object Returns the normalized configurator.values object that is injected into the expression runtime. #### getObjectByName(name): Object3D | null Delegates to scene.getObjectByName . reset(): Promise<void> Clears features, resets managers, clears the scene, and resets undo/redo. Calls callbacks.reset and callbacks.afterReset . runHistory(): Promise<PartHistory> Replays features, rebuilds the scene, runs constraints, and calls callbacks.afterRunHistory . applyFeatureEffects(effects, featureId, feature): Promise<void> Applies added / removed artifacts to the scene, sets timestamps/ownership, and attaches selection handlers. toJSON(): Promise<string> Serializes the full part history and related state. fromJSON(jsonString, options?): Promise<void> Restores from a serialized history string. generateId(prefix): Promise<string> Increments idCounter and returns ${prefix}${idCounter} . sanitizeInputParams(schema, inputParams): Promise<Object> Normalizes and evaluates input params based on schema types: number : evaluates expressions string with allowExpression: true : evaluates expressions and coerces the result back to a string reference_selection : resolves object names to scene objects boolean_operation : normalizes op and target list, optional bias/offset transform : evaluates position/rotation/scale arrays vec3 : evaluates 3-vector entries boolean : normalizes to boolean default: pass-through newFeature(featureType): Promise<Object> Creates a new feature entry, seeds defaults from schema, assigns an ID, and appends it to features . removeFeature(featureId): Promise<void> Removes any feature with matching ID. resetHistoryUndo(): void Clears undo/redo stacks and internal flags. queueHistorySnapshot(options?): void Debounced snapshot capture. flushHistorySnapshot(options?): Promise<void> Forces a snapshot immediately. undoFeatureHistory(): Promise<boolean> Restores the previous snapshot if available. redoFeatureHistory(): Promise<boolean> Reapplies the next snapshot if available. runAssemblyConstraints(): Promise<Array> Runs the assembly constraint solver. hasAssemblyComponents(): boolean Checks if any feature is an assembly component. syncAssemblyComponentTransforms(): void Writes current scene transforms into feature input params. getOutdatedAssemblyComponentCount(): number Returns number of outdated components. updateAssemblyComponents(options?): Promise<{ updatedCount, reran }> Refreshes assembly component data; optionally re-runs history. Internal helpers These methods are intended for internal use: _coerceRunEffects , _attachSelectionHandlers , _safeRemove _commitHistorySnapshot , _applyHistorySnapshot _sanitizePersistentDataForExport , _collectAssemblyComponentUpdates #runFeatureEntryMigrations , #linkFeatureParams , #prepareFeatureEntry , #prepareFeatureList #disposeSceneObjects , #disposeObjectResources , #disposeMaterialResources Related helper extractDefaultValues(schema) Exported alongside PartHistory . Returns a deep-cloned object of default_value for each schema key. Usage examples Basic feature run javascript import { PartHistory } from './PartHistory.js' ; const history = new PartHistory(); const feature = await history.newFeature( 'Sketch' ); // set feature.inputParams as needed await history.runHistory(); Expressions javascript history.expressions = \"x = 10; y = x * 2;\" ; feature.inputParams.depth = \"y + 5\" ; await history.runHistory(); Configurator-backed expressions javascript history.configurator = { fields: [ { name: 'panelWidth' , label: 'Panel Width' , type: 'number' , defaultValue: 24, step: 1 } ], values: { panelWidth: 24 } }; feature.inputParams.width = \"configurator.panelWidth * 2\" ; await history.runHistory(); Save / load javascript const json = await history.toJSON(); const restored = new PartHistory(); await restored.fromJSON(json); await restored.runHistory(); Undo / redo javascript history.queueHistorySnapshot(); await history.undoFeatureHistory(); await history.redoFeatureHistory();"
|
|
505
511
|
},
|
|
506
512
|
{
|
|
507
513
|
"title": "Plugins and Examples",
|
|
@@ -585,7 +591,7 @@
|
|
|
585
591
|
"title": "Table of Contents",
|
|
586
592
|
"href": "table-of-contents.html",
|
|
587
593
|
"summary": "Table of Contents - BREP Help Home · Table of Contents · GitHub Clear Table of Contents Complete documentation structure with all available pages. Main Documentation 2D Sheets Mode 2D Sketch Solver (Standalone) All Workbench A...",
|
|
588
|
-
"content": "Table of Contents - BREP Help Home · Table of Contents · GitHub Clear Table of Contents Complete documentation structure with all available pages. Main Documentation 2D Sheets Mode 2D Sketch Solver (Standalone) All Workbench Angle Constraint Angle Dimension API Examples Assemblies Workbench Assembly Component Assembly Constraint Solver Boolean BREP Kernel Reference BREP Model and Classes BREP.js Export Map and Usage Bug Reporting and Repro Test Cases C++ Solid Porting Chamfer Coincident Constraint Collapse Edge CONTRIBUTING Cylindrical Face Radius Embedding Datium Datum Developer Docs Index Distance Constraint Documentation Screenshots Edge Smooth Embeddable 2D Sketcher Embeddable CAD App Explode Body Extrude Feature Dimension Gizmos (Developer) Features File Formats: Import and Export Fillet Fixed Constraint Font Licenses Getting Started GitHub Repo Storage Helix Highlights History Systems Hole Hole Callout How It Works Image Editor (Shared) Image Heightmap Solid Image to Face Import 3D Model Import Workbench Input Params Schema Inspector Leader LICENSE Linear Dimension Loft Mirror Modeling Mode Modeling Workbench Note NURBS Face Solid Offset Face Offset Shell Overlap Cleanup Parallel Constraint PartHistory Reference Pattern (Legacy) Pattern Linear Pattern Radial Plane Plugins and Examples PMI Annotations PMI Mode PMI Workbench Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Radial Dimension Radius Metadata for Extruded Sketches Recent Inspector Improvements Remesh Revolve Sheet Metal Contour Flange Sheet Metal Cutout Sheet Metal Flange Sheet Metal Hem Sheet Metal Tab Sheet Metal Workbench Simplified Radial Dimension Interface Sketch Sketch Mode Smooth With Subdivision Solid Methods Reference Spline Surfacing Workbench Sweep Text to Face Topological Face and Edge Naming Specification Touch Align Constraint Transform Tube UI Overview (Browser) What's New Wire Harness Workbench Workbench Implementation Plan"
|
|
594
|
+
"content": "Table of Contents - BREP Help Home · Table of Contents · GitHub Clear Table of Contents Complete documentation structure with all available pages. Main Documentation 2D Sheets Mode 2D Sketch Solver (Standalone) All Workbench Angle Constraint Angle Dimension API Examples Assemblies Workbench Assembly Component Assembly Constraint Solver Boolean BREP Kernel Reference BREP Model and Classes BREP.js Export Map and Usage Bug Reporting and Repro Test Cases C++ Solid Porting Chamfer Coincident Constraint Collapse Edge CONTRIBUTING Cylindrical Face Radius Embedding Datium Datum Developer Docs Index Distance Constraint Documentation Screenshots Edge Smooth Embeddable 2D Sketcher Embeddable CAD App Explode Body Expressions and Configurator Extrude Feature Dimension Gizmos (Developer) Features File Formats: Import and Export Fillet Fixed Constraint Font Licenses Getting Started GitHub Repo Storage Helix Highlights History Systems Hole Hole Callout How It Works Image Editor (Shared) Image Heightmap Solid Image to Face Import 3D Model Import Workbench Input Params Schema Inspector Leader LICENSE Linear Dimension Loft Mirror Modeling Mode Modeling Workbench Note NURBS Face Solid Offset Face Offset Shell Overlap Cleanup Parallel Constraint PartHistory Reference Pattern (Legacy) Pattern Linear Pattern Radial Plane Plugins and Examples PMI Annotations PMI Mode PMI Workbench Polygon Solid Primitive Cone Primitive Cube Primitive Cylinder Primitive Pyramid Primitive Sphere Primitive Torus Radial Dimension Radius Metadata for Extruded Sketches Recent Inspector Improvements Remesh Revolve Sheet Metal Contour Flange Sheet Metal Cutout Sheet Metal Flange Sheet Metal Hem Sheet Metal Tab Sheet Metal Workbench Simplified Radial Dimension Interface Sketch Sketch Mode Smooth With Subdivision Solid Methods Reference Spline Surfacing Workbench Sweep Text to Face Topological Face and Edge Naming Specification Touch Align Constraint Transform Tube UI Overview (Browser) What's New Wire Harness Workbench Workbench Implementation Plan"
|
|
589
595
|
},
|
|
590
596
|
{
|
|
591
597
|
"title": "Topological Face and Edge Naming Specification",
|
|
@@ -175,6 +175,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
|
|
|
175
175
|
<li><a href="./sketcher2d-embed.html">Embeddable 2D Sketcher</a></li>
|
|
176
176
|
<li><a href="./cad-embed.html">Embeddable CAD App</a></li>
|
|
177
177
|
<li><a href="./pmi-annotations__explode-body.html">Explode Body</a></li>
|
|
178
|
+
<li><a href="./expressions.html">Expressions and Configurator</a></li>
|
|
178
179
|
<li><a href="./features__extrude.html">Extrude</a></li>
|
|
179
180
|
<li><a href="./feature-dimension-gizmos.html">Feature Dimension Gizmos (Developer)</a></li>
|
|
180
181
|
<li><a href="./features__index.html">Features</a></li>
|