brep-io-kernel 1.0.185 → 1.0.186

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.
@@ -141,7 +141,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
141
141
  <section class="card doc-card">
142
142
 
143
143
  <div class="prose">
144
- <h1>Documentation Screenshots</h1><ol><li>Run <code>pnpm dev</code> and open at least one of the capture helper pages:</li><p>- <code><a href="http://127.0.0.1:5173/feature-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/feature-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/pmi-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/pmi-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/assembly-constraint-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/assembly-constraint-capture.html</a></code></p><li>With the dev server running, execute <code>pnpm capture</code> to export screenshots. Outputs land in:</li></ol><p>- <code>docs/features</code> (feature dialogs) - <code>docs/pmi-annotations</code> (PMI annotations) - <code>docs/assembly-constraints</code> (assembly constraints) - <code>docs/MODELING.png</code>, <code>docs/SKETCH.png</code>, <code>docs/PMI.png</code> - <code>docs/features/image-to-face-2D_dialog.png</code>, <code>docs/features/image-to-face-3D_dialog.png</code> - <code>docs/features/NURBS_Face_Solid_cage_editor.png</code> - Full-page documentation captures use a fixed viewport (<code>1200x760</code>) for consistent, smaller image size.</p><p>For the schema that drives these dialogs (field types, defaults, and selection filters), see <a href="input-params-schema.html">Input Params Schema</a>.</p><h2>Configuration</h2><p>Customize the automation with environment variables:</p><ul><li><code>CAPTURE_SCOPE=features,pmi,assembly,docs</code> limits which capture helpers are processed.</li><li><code>CAPTURE_BASE_URL=http://127.0.0.1:5174</code> points to a dev server running on a different host/port.</li><li><code>CAPTURE_URL</code> + <code>CAPTURE_OUTPUT</code> run a one-off capture against any URL.</li><li><code>CAPTURE_HEADLESS=true</code> runs without showing the browser window (default is headed so you can watch captures live).</li><li><code>CAPTURE_KEEP_OPEN=false</code> closes the browser immediately after capture (default keeps it open in headed mode; press <code>Ctrl+C</code> to exit).</li><li><code>CAPTURE_SKIP_HISTORY_DIALOGS=true</code> skips any dialog whose name includes <code>History</code>.</li><p>- Equivalent pnpm flag: <code>pnpm capture --capture-skip-history=true</code></p><li><code>CAPTURE_DEVICE_SCALE_FACTOR=1</code> (default <code>2</code>) controls the browser’s device pixel ratio for sharper or softer renders.</li><li><code>CAPTURE_OUTPUT_SCALE=device</code> keeps the full hi-DPI image size instead of downscaling back to CSS pixels (default <code>css</code> keeps the files small while retaining clarity).</li></ul>
144
+ <h1>Documentation Screenshots</h1><ol><li>Run <code>pnpm dev</code> and open at least one of the capture helper pages:</li><p>- <code><a href="http://127.0.0.1:5173/feature-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/feature-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/pmi-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/pmi-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/assembly-constraint-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/assembly-constraint-capture.html</a></code></p><li>With the dev server running, execute <code>pnpm capture</code> to export screenshots. Outputs land in:</li></ol><p>- <code>docs/features</code> (feature dialogs) - <code>docs/pmi-annotations</code> (PMI annotations) - <code>docs/assembly-constraints</code> (assembly constraints) - <code>docs/MODELING.png</code>, <code>docs/SKETCH.png</code>, <code>docs/PMI.png</code> - <code>docs/expressions-panel.png</code>, <code>docs/configurator-editor.png</code>, <code>docs/configurator-field-types.png</code> - <code>docs/features/image-to-face-2D_dialog.png</code>, <code>docs/features/image-to-face-3D_dialog.png</code> - <code>docs/features/NURBS_Face_Solid_cage_editor.png</code> - Full-page documentation captures use a fixed viewport (<code>1200x760</code>) for consistent, smaller image size.</p><p>For the schema that drives these dialogs (field types, defaults, and selection filters), see <a href="input-params-schema.html">Input Params Schema</a>.</p><h2>Configuration</h2><p>Customize the automation with environment variables:</p><ul><li><code>CAPTURE_SCOPE=features,pmi,assembly,docs</code> limits which capture helpers are processed.</li><li><code>CAPTURE_BASE_URL=http://127.0.0.1:5174</code> points to a dev server running on a different host/port.</li><li><code>CAPTURE_URL</code> + <code>CAPTURE_OUTPUT</code> run a one-off capture against any URL.</li><li><code>CAPTURE_HEADLESS=true</code> runs without showing the browser window (default is headed so you can watch captures live).</li><li><code>CAPTURE_KEEP_OPEN=false</code> closes the browser immediately after capture (default keeps it open in headed mode; press <code>Ctrl+C</code> to exit).</li><li><code>CAPTURE_SKIP_HISTORY_DIALOGS=true</code> skips any dialog whose name includes <code>History</code>.</li><p>- Equivalent pnpm flag: <code>pnpm capture --capture-skip-history=true</code></p><li><code>CAPTURE_DEVICE_SCALE_FACTOR=1</code> (default <code>2</code>) controls the browser’s device pixel ratio for sharper or softer renders.</li><li><code>CAPTURE_OUTPUT_SCALE=device</code> keeps the full hi-DPI image size instead of downscaling back to CSS pixels (default <code>css</code> keeps the files small while retaining clarity).</li></ul>
145
145
  </div>
146
146
  </section>
147
147
  </main>
Binary file
@@ -141,7 +141,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
141
141
  <section class="card doc-card">
142
142
 
143
143
  <div class="prose">
144
- <h1>Expressions and Configurator</h1><p>This page is the dedicated guide for the Expressions panel in Modeling Mode.</p><h2>Live Demos</h2><ul><li>Examples hub: <a href="https://BREP.io/apiExamples/index.html">https://BREP.io/apiExamples/index.html</a></li><li>Embeded CAD: <a href="https://BREP.io/apiExamples/Embeded_CAD.html">https://BREP.io/apiExamples/Embeded_CAD.html</a></li></ul><h2>Overview</h2><p>The Expressions panel has two related parts:</p><ul><li><code>expressions</code>: a shared script where you define variables and formulas</li><li><code>configurator</code>: a set of UI widgets whose values are exposed to expressions as <code>configurator.fieldName</code></li></ul><p>Together, they let you drive feature dialogs from reusable parameters instead of hard-coded values.</p><h2>Expression syntax</h2><p>Expressions use JavaScript-style syntax. Typical usage is to assign variables in the script, then reference them in feature fields.</p><p>Example script:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
144
+ <h1>Expressions and Configurator</h1><p>Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature.</p><p>The panel has two parts:</p><ul><li><code>Expressions</code>: a shared place to define variables and formulas</li><li><code>Configurator</code>: optional UI controls that expose a few important values as sliders, number fields, dropdowns, or text inputs</li></ul><p>This is most useful when you want to build a part once, then resize or retune it quickly.</p><h2>Live Demos</h2><ul><li>Examples hub: <a href="https://BREP.io/apiExamples/index.html">https://BREP.io/apiExamples/index.html</a></li><li>Embeded CAD: <a href="https://BREP.io/apiExamples/Embeded_CAD.html">https://BREP.io/apiExamples/Embeded_CAD.html</a></li></ul><h2>Expressions Panel</h2><p>Write variables in the Expressions box, then reference those variable names in feature dialog inputs.</p><p><img src="expressions-panel.png" alt="Expressions panel" loading="lazy" /></p><p>Example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
145
145
  <div class="doc-codeblock-header">
146
146
  <span class="doc-codeblock-lang">javascript</span>
147
147
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -155,9 +155,9 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
155
155
  </div>
156
156
  <div class="doc-codeblock-body"><pre><code class="language-javascript">wall = 2;
157
157
  width = 80;
158
- height = width * 1.5;
159
- holeOffset = width * 0.25;</code></pre></div>
160
- </div><p>Then in a feature dialog field:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
158
+ height = width * 0.6;
159
+ innerWidth = width - wall * 2;</code></pre></div>
160
+ </div><p>Then in a feature dialog you can enter values such as:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
161
161
  <div class="doc-codeblock-header">
162
162
  <span class="doc-codeblock-lang">javascript</span>
163
163
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -169,8 +169,8 @@ holeOffset = width * 0.25;</code></pre></div>
169
169
  </span>
170
170
  </button>
171
171
  </div>
172
- <div class="doc-codeblock-body"><pre><code class="language-javascript">height</code></pre></div>
173
- </div><p>or:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
172
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">width</code></pre></div>
173
+ </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
174
174
  <div class="doc-codeblock-header">
175
175
  <span class="doc-codeblock-lang">javascript</span>
176
176
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -182,8 +182,8 @@ holeOffset = width * 0.25;</code></pre></div>
182
182
  </span>
183
183
  </button>
184
184
  </div>
185
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width - wall * 2</code></pre></div>
186
- </div><h2>Runtime context</h2><p>When an expression is evaluated, the runtime includes:</p><ul><li><code>resolution = 32</code> by default</li><li>the current configurator values as <code>configurator</code></li><li>the contents of the Expressions script</li></ul><p>That means these are valid:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
185
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">height</code></pre></div>
186
+ </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
187
187
  <div class="doc-codeblock-header">
188
188
  <span class="doc-codeblock-lang">javascript</span>
189
189
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -195,10 +195,8 @@ holeOffset = width * 0.25;</code></pre></div>
195
195
  </span>
196
196
  </button>
197
197
  </div>
198
- <div class="doc-codeblock-body"><pre><code class="language-javascript">resolution
199
- configurator.panelWidth
200
- configurator.materialName</code></pre></div>
201
- </div><h2>Configurator</h2><p>The configurator is for values that should be edited through UI controls instead of typing directly into the script.</p><p>Supported widget types:</p><ul><li><code>slider</code></li><li><code>number</code></li><li><code>select</code></li><li><code>string</code></li></ul><p>Example configurator usage:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
198
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">width - wall * 2</code></pre></div>
199
+ </div><h2>Quick Start</h2><ol><li>Open the <code>Expressions</code> panel in Modeling Mode.</li><li>Add a few variables in the main text area.</li><li>Click <code>Test Expressions</code>.</li><li>In feature dialogs, enter those variable names instead of fixed numbers.</li><li>Change the variables later to update the model.</li></ol><p>This lets you control repeated dimensions from one place.</p><h2>Configurator</h2><p>The configurator is for values that should be adjusted through UI controls instead of editing the script directly.</p><p>If no configurator widgets exist, the configurator form stays hidden.</p><p>When widgets do exist, the form appears above the Expressions editor.</p><p><img src="configurator-field-types.png" alt="Configurator field types" loading="lazy" /></p><p>Supported widget types:</p><ul><li><code>slider</code>: best for bounded numeric values you want to drag</li><li><code>number</code>: best for precise numeric entry</li><li><code>select</code>: best for choosing from a small list of options</li><li><code>string</code>: best for names, labels, and other text values</li></ul><p>Configurator values are available inside expressions as:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
202
200
  <div class="doc-codeblock-header">
203
201
  <span class="doc-codeblock-lang">javascript</span>
204
202
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -210,10 +208,8 @@ configurator.materialName</code></pre></div>
210
208
  </span>
211
209
  </button>
212
210
  </div>
213
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width = configurator.panelWidth;
214
- height = width * 2;
215
- labelText = configurator.partLabel;</code></pre></div>
216
- </div><p>Then feature inputs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
211
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.fieldName</code></pre></div>
212
+ </div><p>Example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
217
213
  <div class="doc-codeblock-header">
218
214
  <span class="doc-codeblock-lang">javascript</span>
219
215
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -225,11 +221,10 @@ labelText = configurator.partLabel;</code></pre></div>
225
221
  </span>
226
222
  </button>
227
223
  </div>
228
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width
229
- height
230
- labelText
231
- configurator.panelWidth * 0.5</code></pre></div>
232
- </div><h2>Expressions panel behavior</h2><ul><li>If no configurator fields exist, the configurator form is hidden.</li><li>If configurator fields exist, the live configurator form appears above the expression editor.</li><li>Editing a configurator value in that live form re-runs the model.</li><li>Editing the configurator layout with <code>Edit Configurator</code> shows a live preview of the widget set above the expression editor.</li><li>While the configurator editor is open, that preview does not re-run the model.</li><li>The model is re-evaluated only when the configurator edit session is committed with <code>Save Configurator</code> or by closing the editor.</li></ul><h2>Using expressions in feature dialogs</h2><p>Feature dialogs evaluate against the shared expression source.</p><p>Field support:</p><ul><li><code>number</code> fields support expressions by default</li><li><code>string</code> fields can support expressions when the schema enables <code>allowExpression: true</code></li><li><code>transform</code> and <code>vec3</code> numeric entries also evaluate expressions</li></ul><p>Examples:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
224
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">panelWidth = configurator.panelWidth;
225
+ finish = configurator.finish;
226
+ labelText = configurator.partLabel;</code></pre></div>
227
+ </div><p>You do not need to create an intermediate variable first. In many cases you can enter the configurator value directly in a feature dialog input, for example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
233
228
  <div class="doc-codeblock-header">
234
229
  <span class="doc-codeblock-lang">javascript</span>
235
230
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -241,7 +236,7 @@ configurator.panelWidth * 0.5</code></pre></div>
241
236
  </span>
242
237
  </button>
243
238
  </div>
244
- <div class="doc-codeblock-body"><pre><code class="language-javascript">distance = configurator.panelWidth * 0.5</code></pre></div>
239
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.panelWidth</code></pre></div>
245
240
  </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
246
241
  <div class="doc-codeblock-header">
247
242
  <span class="doc-codeblock-lang">javascript</span>
@@ -254,8 +249,8 @@ configurator.panelWidth * 0.5</code></pre></div>
254
249
  </span>
255
250
  </button>
256
251
  </div>
257
- <div class="doc-codeblock-body"><pre><code class="language-javascript">text = configurator.partLabel</code></pre></div>
258
- </div><h2>Persistence</h2><p>Both the script and the configurator are stored in part history.</p><p>Saved part history includes:</p><ul><li><code>expressions</code></li><li><code>configurator.fields</code></li><li><code>configurator.values</code></li></ul><p>That means they survive:</p><ul><li>save/load</li><li>JSON export/import</li><li>embedded feature history in 3MF</li><li>undo/redo snapshots</li></ul><h2>Practical example</h2><p>Expressions script:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
252
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.partLabel</code></pre></div>
253
+ </div><h2>Editing the Configurator</h2><p>Click <code>Edit Configurator</code> below the Expressions area to add or change widgets.</p><p><img src="configurator-editor.png" alt="Configurator editor" loading="lazy" /></p><p>Typical setup:</p><ol><li>Click <code>Edit Configurator</code>.</li><li>Click <code>Add Widget</code>.</li><li>Set the <code>Field Name</code>.</li><li>Choose the widget <code>Type</code>.</li><li>Set the default value and any limits or options.</li><li>Click <code>Save Configurator</code>.</li></ol><p>After saving, the live configurator form appears above the Expressions editor.</p><h2>Naming Rules</h2><p>Each widget needs a field name that can be referenced from expressions.</p><p>Good examples:</p><ul><li><code>panelWidth</code></li><li><code>rib_count</code></li><li><code>partLabel</code></li></ul><p>Avoid spaces and punctuation in field names. Use letters, numbers, <code>_</code>, and <code>$</code>.</p><h2>How Editing Behaves</h2><ul><li>Changing a value in the live configurator form re-runs the model.</li><li>Text and number inputs apply when you press <code>Enter</code> or leave the field.</li><li>Slider drags update live.</li><li>While <code>Edit Configurator</code> is open, the preview above updates as you add or remove widgets.</li><li>That preview does not re-run the model until you save or close the configurator editor.</li></ul><h2>Practical Example</h2><p>Create these configurator fields:</p><ul><li><code>panelWidth</code> as a slider</li><li><code>panelHeight</code> as a number field</li><li><code>finish</code> as a select</li><li><code>label</code> as a string</li></ul><p>Then write expressions like:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
259
254
  <div class="doc-codeblock-header">
260
255
  <span class="doc-codeblock-lang">javascript</span>
261
256
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -273,7 +268,7 @@ outerHeight = configurator.panelHeight;
273
268
  innerWidth = outerWidth - wall * 2;
274
269
  innerHeight = outerHeight - wall * 2;
275
270
  titleText = configurator.label;</code></pre></div>
276
- </div><p>Possible configurator fields:</p><ul><li><code>panelWidth</code> as a slider</li><li><code>panelHeight</code> as a slider</li><li><code>label</code> as a string</li></ul><p>Then feature inputs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
271
+ </div><p>Now feature dialogs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
277
272
  <div class="doc-codeblock-header">
278
273
  <span class="doc-codeblock-lang">javascript</span>
279
274
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -286,11 +281,9 @@ titleText = configurator.label;</code></pre></div>
286
281
  </button>
287
282
  </div>
288
283
  <div class="doc-codeblock-body"><pre><code class="language-javascript">outerWidth
289
- outerHeight
290
284
  innerWidth
291
- innerHeight
292
285
  titleText</code></pre></div>
293
- </div><h2>Developer notes</h2><p>Relevant API and integration points:</p><ul><li><code>partHistory.expressions</code></li><li><code>partHistory.configurator</code></li><li><code>partHistory.getExpressionsSource()</code></li><li><code>partHistory.buildExpressionSource()</code></li><li><code>partHistory.evaluateExpression()</code></li></ul><p>If you are authoring a feature dialog schema:</p><ul><li>use <code>type: &#39;number&#39;</code> for expression-capable numeric fields</li><li>use <code>type: &#39;string&#39;</code> with <code>allowExpression: true</code> for expression-capable string fields</li></ul><h2>Safety note</h2><p>Expressions are executed as code using <code>Function()</code>. Do not evaluate untrusted user input.</p><h2>Related docs</h2><ul><li><a href="modes__modeling.html">Modeling Mode</a></li><li><a href="input-params-schema.html">Input Params Schema</a></li><li><a href="part-history.html">PartHistory Reference</a></li></ul>
286
+ </div><p>That gives you one place to control the whole part.</p><h2>Where You Can Use Expressions</h2><p>Expressions are mainly intended for feature dialog inputs.</p><p>Common cases:</p><ul><li>numeric fields</li><li>transform values</li><li>vector component fields</li><li>some text fields</li></ul><p>If a feature dialog supports expressions, you can enter either a direct value like <code>20</code> or an expression like <code>width * 0.5</code>.</p><p>You can also enter configurator values directly, such as <code>configurator.panelWidth</code>, without first defining a separate variable in the Expressions editor.</p><h2>Saved With the Part</h2><p>Expressions and configurator values are stored in part history, so they stay with the model through:</p><ul><li>save and load</li><li>JSON export and import</li><li>undo and redo</li><li>embedded history in exported files that preserve feature history</li></ul><h2>Related Docs</h2><ul><li><a href="modes__modeling.html">Modeling Mode</a></li><li><a href="part-history.html">Part History</a></li></ul>
294
287
  </div>
295
288
  </section>
296
289
  </main>
@@ -105,13 +105,13 @@
105
105
  "title": "Documentation Screenshots",
106
106
  "href": "dialog-screenshots.html",
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
- "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)."
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/expressions-panel.png , docs/configurator-editor.png , docs/configurator-field-types.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
110
  {
111
111
  "title": "Expressions and Configurator",
112
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"
113
+ "summary": "Expressions and Configurator Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature. The panel has two parts: Expressions : a shared place to define variables a...",
114
+ "content": "Expressions and Configurator Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature. The panel has two parts: Expressions : a shared place to define variables and formulas Configurator : optional UI controls that expose a few important values as sliders, number fields, dropdowns, or text inputs This is most useful when you want to build a part once, then resize or retune it quickly. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Expressions Panel Write variables in the Expressions box, then reference those variable names in feature dialog inputs. Example: javascript wall = 2; width = 80; height = width * 0.6; innerWidth = width - wall * 2; Then in a feature dialog you can enter values such as: javascript width javascript height javascript width - wall * 2 Quick Start Open the Expressions panel in Modeling Mode. Add a few variables in the main text area. Click Test Expressions . In feature dialogs, enter those variable names instead of fixed numbers. Change the variables later to update the model. This lets you control repeated dimensions from one place. Configurator The configurator is for values that should be adjusted through UI controls instead of editing the script directly. If no configurator widgets exist, the configurator form stays hidden. When widgets do exist, the form appears above the Expressions editor. Supported widget types: slider : best for bounded numeric values you want to drag number : best for precise numeric entry select : best for choosing from a small list of options string : best for names, labels, and other text values Configurator values are available inside expressions as: javascript configurator.fieldName Example: javascript panelWidth = configurator.panelWidth; finish = configurator.finish; labelText = configurator.partLabel; You do not need to create an intermediate variable first. In many cases you can enter the configurator value directly in a feature dialog input, for example: javascript configurator.panelWidth javascript configurator.partLabel Editing the Configurator Click Edit Configurator below the Expressions area to add or change widgets. Typical setup: Click Edit Configurator . Click Add Widget . Set the Field Name . Choose the widget Type . Set the default value and any limits or options. Click Save Configurator . After saving, the live configurator form appears above the Expressions editor. Naming Rules Each widget needs a field name that can be referenced from expressions. Good examples: panelWidth rib_count partLabel Avoid spaces and punctuation in field names. Use letters, numbers, _ , and $ . How Editing Behaves Changing a value in the live configurator form re-runs the model. Text and number inputs apply when you press Enter or leave the field. Slider drags update live. While Edit Configurator is open, the preview above updates as you add or remove widgets. That preview does not re-run the model until you save or close the configurator editor. Practical Example Create these configurator fields: panelWidth as a slider panelHeight as a number field finish as a select label as a string Then write expressions like: javascript wall = 2; outerWidth = configurator.panelWidth; outerHeight = configurator.panelHeight; innerWidth = outerWidth - wall * 2; innerHeight = outerHeight - wall * 2; titleText = configurator.label; Now feature dialogs can use: javascript outerWidth innerWidth titleText That gives you one place to control the whole part. Where You Can Use Expressions Expressions are mainly intended for feature dialog inputs. Common cases: numeric fields transform values vector component fields some text fields If a feature dialog supports expressions, you can enter either a direct value like 20 or an expression like width * 0.5 . You can also enter configurator values directly, such as configurator.panelWidth , without first defining a separate variable in the Expressions editor. Saved With the Part Expressions and configurator values are stored in part history, so they stay with the model through: save and load JSON export and import undo and redo embedded history in exported files that preserve feature history Related Docs Modeling Mode Part History"
115
115
  },
116
116
  {
117
117
  "title": "Radius Metadata for Extruded Sketches",
@@ -141,7 +141,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
141
141
  <section class="card doc-card">
142
142
 
143
143
  <div class="prose">
144
- <h1>Documentation Screenshots</h1><ol><li>Run <code>pnpm dev</code> and open at least one of the capture helper pages:</li><p>- <code><a href="http://127.0.0.1:5173/feature-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/feature-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/pmi-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/pmi-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/assembly-constraint-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/assembly-constraint-capture.html</a></code></p><li>With the dev server running, execute <code>pnpm capture</code> to export screenshots. Outputs land in:</li></ol><p>- <code>docs/features</code> (feature dialogs) - <code>docs/pmi-annotations</code> (PMI annotations) - <code>docs/assembly-constraints</code> (assembly constraints) - <code>docs/MODELING.png</code>, <code>docs/SKETCH.png</code>, <code>docs/PMI.png</code> - <code>docs/features/image-to-face-2D_dialog.png</code>, <code>docs/features/image-to-face-3D_dialog.png</code> - <code>docs/features/NURBS_Face_Solid_cage_editor.png</code> - Full-page documentation captures use a fixed viewport (<code>1200x760</code>) for consistent, smaller image size.</p><p>For the schema that drives these dialogs (field types, defaults, and selection filters), see <a href="input-params-schema.html">Input Params Schema</a>.</p><h2>Configuration</h2><p>Customize the automation with environment variables:</p><ul><li><code>CAPTURE_SCOPE=features,pmi,assembly,docs</code> limits which capture helpers are processed.</li><li><code>CAPTURE_BASE_URL=http://127.0.0.1:5174</code> points to a dev server running on a different host/port.</li><li><code>CAPTURE_URL</code> + <code>CAPTURE_OUTPUT</code> run a one-off capture against any URL.</li><li><code>CAPTURE_HEADLESS=true</code> runs without showing the browser window (default is headed so you can watch captures live).</li><li><code>CAPTURE_KEEP_OPEN=false</code> closes the browser immediately after capture (default keeps it open in headed mode; press <code>Ctrl+C</code> to exit).</li><li><code>CAPTURE_SKIP_HISTORY_DIALOGS=true</code> skips any dialog whose name includes <code>History</code>.</li><p>- Equivalent pnpm flag: <code>pnpm capture --capture-skip-history=true</code></p><li><code>CAPTURE_DEVICE_SCALE_FACTOR=1</code> (default <code>2</code>) controls the browser’s device pixel ratio for sharper or softer renders.</li><li><code>CAPTURE_OUTPUT_SCALE=device</code> keeps the full hi-DPI image size instead of downscaling back to CSS pixels (default <code>css</code> keeps the files small while retaining clarity).</li></ul>
144
+ <h1>Documentation Screenshots</h1><ol><li>Run <code>pnpm dev</code> and open at least one of the capture helper pages:</li><p>- <code><a href="http://127.0.0.1:5173/feature-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/feature-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/pmi-dialog-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/pmi-dialog-capture.html</a></code> - <code><a href="http://127.0.0.1:5173/assembly-constraint-capture.html" target="_blank" rel="noopener noreferrer">http://127.0.0.1:5173/assembly-constraint-capture.html</a></code></p><li>With the dev server running, execute <code>pnpm capture</code> to export screenshots. Outputs land in:</li></ol><p>- <code>docs/features</code> (feature dialogs) - <code>docs/pmi-annotations</code> (PMI annotations) - <code>docs/assembly-constraints</code> (assembly constraints) - <code>docs/MODELING.png</code>, <code>docs/SKETCH.png</code>, <code>docs/PMI.png</code> - <code>docs/expressions-panel.png</code>, <code>docs/configurator-editor.png</code>, <code>docs/configurator-field-types.png</code> - <code>docs/features/image-to-face-2D_dialog.png</code>, <code>docs/features/image-to-face-3D_dialog.png</code> - <code>docs/features/NURBS_Face_Solid_cage_editor.png</code> - Full-page documentation captures use a fixed viewport (<code>1200x760</code>) for consistent, smaller image size.</p><p>For the schema that drives these dialogs (field types, defaults, and selection filters), see <a href="input-params-schema.html">Input Params Schema</a>.</p><h2>Configuration</h2><p>Customize the automation with environment variables:</p><ul><li><code>CAPTURE_SCOPE=features,pmi,assembly,docs</code> limits which capture helpers are processed.</li><li><code>CAPTURE_BASE_URL=http://127.0.0.1:5174</code> points to a dev server running on a different host/port.</li><li><code>CAPTURE_URL</code> + <code>CAPTURE_OUTPUT</code> run a one-off capture against any URL.</li><li><code>CAPTURE_HEADLESS=true</code> runs without showing the browser window (default is headed so you can watch captures live).</li><li><code>CAPTURE_KEEP_OPEN=false</code> closes the browser immediately after capture (default keeps it open in headed mode; press <code>Ctrl+C</code> to exit).</li><li><code>CAPTURE_SKIP_HISTORY_DIALOGS=true</code> skips any dialog whose name includes <code>History</code>.</li><p>- Equivalent pnpm flag: <code>pnpm capture --capture-skip-history=true</code></p><li><code>CAPTURE_DEVICE_SCALE_FACTOR=1</code> (default <code>2</code>) controls the browser’s device pixel ratio for sharper or softer renders.</li><li><code>CAPTURE_OUTPUT_SCALE=device</code> keeps the full hi-DPI image size instead of downscaling back to CSS pixels (default <code>css</code> keeps the files small while retaining clarity).</li></ul>
145
145
  </div>
146
146
  </section>
147
147
  </main>
@@ -141,7 +141,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
141
141
  <section class="card doc-card">
142
142
 
143
143
  <div class="prose">
144
- <h1>Expressions and Configurator</h1><p>This page is the dedicated guide for the Expressions panel in Modeling Mode.</p><h2>Live Demos</h2><ul><li>Examples hub: <a href="https://BREP.io/apiExamples/index.html">https://BREP.io/apiExamples/index.html</a></li><li>Embeded CAD: <a href="https://BREP.io/apiExamples/Embeded_CAD.html">https://BREP.io/apiExamples/Embeded_CAD.html</a></li></ul><h2>Overview</h2><p>The Expressions panel has two related parts:</p><ul><li><code>expressions</code>: a shared script where you define variables and formulas</li><li><code>configurator</code>: a set of UI widgets whose values are exposed to expressions as <code>configurator.fieldName</code></li></ul><p>Together, they let you drive feature dialogs from reusable parameters instead of hard-coded values.</p><h2>Expression syntax</h2><p>Expressions use JavaScript-style syntax. Typical usage is to assign variables in the script, then reference them in feature fields.</p><p>Example script:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
144
+ <h1>Expressions and Configurator</h1><p>Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature.</p><p>The panel has two parts:</p><ul><li><code>Expressions</code>: a shared place to define variables and formulas</li><li><code>Configurator</code>: optional UI controls that expose a few important values as sliders, number fields, dropdowns, or text inputs</li></ul><p>This is most useful when you want to build a part once, then resize or retune it quickly.</p><h2>Live Demos</h2><ul><li>Examples hub: <a href="https://BREP.io/apiExamples/index.html">https://BREP.io/apiExamples/index.html</a></li><li>Embeded CAD: <a href="https://BREP.io/apiExamples/Embeded_CAD.html">https://BREP.io/apiExamples/Embeded_CAD.html</a></li></ul><h2>Expressions Panel</h2><p>Write variables in the Expressions box, then reference those variable names in feature dialog inputs.</p><p><img src="expressions-panel.png" alt="Expressions panel" loading="lazy" /></p><p>Example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
145
145
  <div class="doc-codeblock-header">
146
146
  <span class="doc-codeblock-lang">javascript</span>
147
147
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -155,9 +155,9 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
155
155
  </div>
156
156
  <div class="doc-codeblock-body"><pre><code class="language-javascript">wall = 2;
157
157
  width = 80;
158
- height = width * 1.5;
159
- holeOffset = width * 0.25;</code></pre></div>
160
- </div><p>Then in a feature dialog field:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
158
+ height = width * 0.6;
159
+ innerWidth = width - wall * 2;</code></pre></div>
160
+ </div><p>Then in a feature dialog you can enter values such as:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
161
161
  <div class="doc-codeblock-header">
162
162
  <span class="doc-codeblock-lang">javascript</span>
163
163
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -169,8 +169,8 @@ holeOffset = width * 0.25;</code></pre></div>
169
169
  </span>
170
170
  </button>
171
171
  </div>
172
- <div class="doc-codeblock-body"><pre><code class="language-javascript">height</code></pre></div>
173
- </div><p>or:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
172
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">width</code></pre></div>
173
+ </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
174
174
  <div class="doc-codeblock-header">
175
175
  <span class="doc-codeblock-lang">javascript</span>
176
176
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -182,8 +182,8 @@ holeOffset = width * 0.25;</code></pre></div>
182
182
  </span>
183
183
  </button>
184
184
  </div>
185
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width - wall * 2</code></pre></div>
186
- </div><h2>Runtime context</h2><p>When an expression is evaluated, the runtime includes:</p><ul><li><code>resolution = 32</code> by default</li><li>the current configurator values as <code>configurator</code></li><li>the contents of the Expressions script</li></ul><p>That means these are valid:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
185
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">height</code></pre></div>
186
+ </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
187
187
  <div class="doc-codeblock-header">
188
188
  <span class="doc-codeblock-lang">javascript</span>
189
189
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -195,10 +195,8 @@ holeOffset = width * 0.25;</code></pre></div>
195
195
  </span>
196
196
  </button>
197
197
  </div>
198
- <div class="doc-codeblock-body"><pre><code class="language-javascript">resolution
199
- configurator.panelWidth
200
- configurator.materialName</code></pre></div>
201
- </div><h2>Configurator</h2><p>The configurator is for values that should be edited through UI controls instead of typing directly into the script.</p><p>Supported widget types:</p><ul><li><code>slider</code></li><li><code>number</code></li><li><code>select</code></li><li><code>string</code></li></ul><p>Example configurator usage:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
198
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">width - wall * 2</code></pre></div>
199
+ </div><h2>Quick Start</h2><ol><li>Open the <code>Expressions</code> panel in Modeling Mode.</li><li>Add a few variables in the main text area.</li><li>Click <code>Test Expressions</code>.</li><li>In feature dialogs, enter those variable names instead of fixed numbers.</li><li>Change the variables later to update the model.</li></ol><p>This lets you control repeated dimensions from one place.</p><h2>Configurator</h2><p>The configurator is for values that should be adjusted through UI controls instead of editing the script directly.</p><p>If no configurator widgets exist, the configurator form stays hidden.</p><p>When widgets do exist, the form appears above the Expressions editor.</p><p><img src="configurator-field-types.png" alt="Configurator field types" loading="lazy" /></p><p>Supported widget types:</p><ul><li><code>slider</code>: best for bounded numeric values you want to drag</li><li><code>number</code>: best for precise numeric entry</li><li><code>select</code>: best for choosing from a small list of options</li><li><code>string</code>: best for names, labels, and other text values</li></ul><p>Configurator values are available inside expressions as:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
202
200
  <div class="doc-codeblock-header">
203
201
  <span class="doc-codeblock-lang">javascript</span>
204
202
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -210,10 +208,8 @@ configurator.materialName</code></pre></div>
210
208
  </span>
211
209
  </button>
212
210
  </div>
213
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width = configurator.panelWidth;
214
- height = width * 2;
215
- labelText = configurator.partLabel;</code></pre></div>
216
- </div><p>Then feature inputs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
211
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.fieldName</code></pre></div>
212
+ </div><p>Example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
217
213
  <div class="doc-codeblock-header">
218
214
  <span class="doc-codeblock-lang">javascript</span>
219
215
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -225,11 +221,10 @@ labelText = configurator.partLabel;</code></pre></div>
225
221
  </span>
226
222
  </button>
227
223
  </div>
228
- <div class="doc-codeblock-body"><pre><code class="language-javascript">width
229
- height
230
- labelText
231
- configurator.panelWidth * 0.5</code></pre></div>
232
- </div><h2>Expressions panel behavior</h2><ul><li>If no configurator fields exist, the configurator form is hidden.</li><li>If configurator fields exist, the live configurator form appears above the expression editor.</li><li>Editing a configurator value in that live form re-runs the model.</li><li>Editing the configurator layout with <code>Edit Configurator</code> shows a live preview of the widget set above the expression editor.</li><li>While the configurator editor is open, that preview does not re-run the model.</li><li>The model is re-evaluated only when the configurator edit session is committed with <code>Save Configurator</code> or by closing the editor.</li></ul><h2>Using expressions in feature dialogs</h2><p>Feature dialogs evaluate against the shared expression source.</p><p>Field support:</p><ul><li><code>number</code> fields support expressions by default</li><li><code>string</code> fields can support expressions when the schema enables <code>allowExpression: true</code></li><li><code>transform</code> and <code>vec3</code> numeric entries also evaluate expressions</li></ul><p>Examples:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
224
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">panelWidth = configurator.panelWidth;
225
+ finish = configurator.finish;
226
+ labelText = configurator.partLabel;</code></pre></div>
227
+ </div><p>You do not need to create an intermediate variable first. In many cases you can enter the configurator value directly in a feature dialog input, for example:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
233
228
  <div class="doc-codeblock-header">
234
229
  <span class="doc-codeblock-lang">javascript</span>
235
230
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -241,7 +236,7 @@ configurator.panelWidth * 0.5</code></pre></div>
241
236
  </span>
242
237
  </button>
243
238
  </div>
244
- <div class="doc-codeblock-body"><pre><code class="language-javascript">distance = configurator.panelWidth * 0.5</code></pre></div>
239
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.panelWidth</code></pre></div>
245
240
  </div><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
246
241
  <div class="doc-codeblock-header">
247
242
  <span class="doc-codeblock-lang">javascript</span>
@@ -254,8 +249,8 @@ configurator.panelWidth * 0.5</code></pre></div>
254
249
  </span>
255
250
  </button>
256
251
  </div>
257
- <div class="doc-codeblock-body"><pre><code class="language-javascript">text = configurator.partLabel</code></pre></div>
258
- </div><h2>Persistence</h2><p>Both the script and the configurator are stored in part history.</p><p>Saved part history includes:</p><ul><li><code>expressions</code></li><li><code>configurator.fields</code></li><li><code>configurator.values</code></li></ul><p>That means they survive:</p><ul><li>save/load</li><li>JSON export/import</li><li>embedded feature history in 3MF</li><li>undo/redo snapshots</li></ul><h2>Practical example</h2><p>Expressions script:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
252
+ <div class="doc-codeblock-body"><pre><code class="language-javascript">configurator.partLabel</code></pre></div>
253
+ </div><h2>Editing the Configurator</h2><p>Click <code>Edit Configurator</code> below the Expressions area to add or change widgets.</p><p><img src="configurator-editor.png" alt="Configurator editor" loading="lazy" /></p><p>Typical setup:</p><ol><li>Click <code>Edit Configurator</code>.</li><li>Click <code>Add Widget</code>.</li><li>Set the <code>Field Name</code>.</li><li>Choose the widget <code>Type</code>.</li><li>Set the default value and any limits or options.</li><li>Click <code>Save Configurator</code>.</li></ol><p>After saving, the live configurator form appears above the Expressions editor.</p><h2>Naming Rules</h2><p>Each widget needs a field name that can be referenced from expressions.</p><p>Good examples:</p><ul><li><code>panelWidth</code></li><li><code>rib_count</code></li><li><code>partLabel</code></li></ul><p>Avoid spaces and punctuation in field names. Use letters, numbers, <code>_</code>, and <code>$</code>.</p><h2>How Editing Behaves</h2><ul><li>Changing a value in the live configurator form re-runs the model.</li><li>Text and number inputs apply when you press <code>Enter</code> or leave the field.</li><li>Slider drags update live.</li><li>While <code>Edit Configurator</code> is open, the preview above updates as you add or remove widgets.</li><li>That preview does not re-run the model until you save or close the configurator editor.</li></ul><h2>Practical Example</h2><p>Create these configurator fields:</p><ul><li><code>panelWidth</code> as a slider</li><li><code>panelHeight</code> as a number field</li><li><code>finish</code> as a select</li><li><code>label</code> as a string</li></ul><p>Then write expressions like:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
259
254
  <div class="doc-codeblock-header">
260
255
  <span class="doc-codeblock-lang">javascript</span>
261
256
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -273,7 +268,7 @@ outerHeight = configurator.panelHeight;
273
268
  innerWidth = outerWidth - wall * 2;
274
269
  innerHeight = outerHeight - wall * 2;
275
270
  titleText = configurator.label;</code></pre></div>
276
- </div><p>Possible configurator fields:</p><ul><li><code>panelWidth</code> as a slider</li><li><code>panelHeight</code> as a slider</li><li><code>label</code> as a string</li></ul><p>Then feature inputs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
271
+ </div><p>Now feature dialogs can use:</p><div class="doc-codeblock doc-codeblock-js" data-code-language="javascript">
277
272
  <div class="doc-codeblock-header">
278
273
  <span class="doc-codeblock-lang">javascript</span>
279
274
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -286,11 +281,9 @@ titleText = configurator.label;</code></pre></div>
286
281
  </button>
287
282
  </div>
288
283
  <div class="doc-codeblock-body"><pre><code class="language-javascript">outerWidth
289
- outerHeight
290
284
  innerWidth
291
- innerHeight
292
285
  titleText</code></pre></div>
293
- </div><h2>Developer notes</h2><p>Relevant API and integration points:</p><ul><li><code>partHistory.expressions</code></li><li><code>partHistory.configurator</code></li><li><code>partHistory.getExpressionsSource()</code></li><li><code>partHistory.buildExpressionSource()</code></li><li><code>partHistory.evaluateExpression()</code></li></ul><p>If you are authoring a feature dialog schema:</p><ul><li>use <code>type: &#39;number&#39;</code> for expression-capable numeric fields</li><li>use <code>type: &#39;string&#39;</code> with <code>allowExpression: true</code> for expression-capable string fields</li></ul><h2>Safety note</h2><p>Expressions are executed as code using <code>Function()</code>. Do not evaluate untrusted user input.</p><h2>Related docs</h2><ul><li><a href="modes__modeling.html">Modeling Mode</a></li><li><a href="input-params-schema.html">Input Params Schema</a></li><li><a href="part-history.html">PartHistory Reference</a></li></ul>
286
+ </div><p>That gives you one place to control the whole part.</p><h2>Where You Can Use Expressions</h2><p>Expressions are mainly intended for feature dialog inputs.</p><p>Common cases:</p><ul><li>numeric fields</li><li>transform values</li><li>vector component fields</li><li>some text fields</li></ul><p>If a feature dialog supports expressions, you can enter either a direct value like <code>20</code> or an expression like <code>width * 0.5</code>.</p><p>You can also enter configurator values directly, such as <code>configurator.panelWidth</code>, without first defining a separate variable in the Expressions editor.</p><h2>Saved With the Part</h2><p>Expressions and configurator values are stored in part history, so they stay with the model through:</p><ul><li>save and load</li><li>JSON export and import</li><li>undo and redo</li><li>embedded history in exported files that preserve feature history</li></ul><h2>Related Docs</h2><ul><li><a href="modes__modeling.html">Modeling Mode</a></li><li><a href="part-history.html">Part History</a></li></ul>
294
287
  </div>
295
288
  </section>
296
289
  </main>
@@ -105,13 +105,13 @@
105
105
  "title": "Documentation Screenshots",
106
106
  "href": "dialog-screenshots.html",
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
- "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)."
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/expressions-panel.png , docs/configurator-editor.png , docs/configurator-field-types.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
110
  {
111
111
  "title": "Expressions and Configurator",
112
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"
113
+ "summary": "Expressions and Configurator Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature. The panel has two parts: Expressions : a shared place to define variables a...",
114
+ "content": "Expressions and Configurator Use the Expressions panel when you want a model to be driven by a few reusable values instead of typing raw numbers into every feature. The panel has two parts: Expressions : a shared place to define variables and formulas Configurator : optional UI controls that expose a few important values as sliders, number fields, dropdowns, or text inputs This is most useful when you want to build a part once, then resize or retune it quickly. Live Demos Examples hub: https://BREP.io/apiExamples/index.html Embeded CAD: https://BREP.io/apiExamples/Embeded_CAD.html Expressions Panel Write variables in the Expressions box, then reference those variable names in feature dialog inputs. Example: javascript wall = 2; width = 80; height = width * 0.6; innerWidth = width - wall * 2; Then in a feature dialog you can enter values such as: javascript width javascript height javascript width - wall * 2 Quick Start Open the Expressions panel in Modeling Mode. Add a few variables in the main text area. Click Test Expressions . In feature dialogs, enter those variable names instead of fixed numbers. Change the variables later to update the model. This lets you control repeated dimensions from one place. Configurator The configurator is for values that should be adjusted through UI controls instead of editing the script directly. If no configurator widgets exist, the configurator form stays hidden. When widgets do exist, the form appears above the Expressions editor. Supported widget types: slider : best for bounded numeric values you want to drag number : best for precise numeric entry select : best for choosing from a small list of options string : best for names, labels, and other text values Configurator values are available inside expressions as: javascript configurator.fieldName Example: javascript panelWidth = configurator.panelWidth; finish = configurator.finish; labelText = configurator.partLabel; You do not need to create an intermediate variable first. In many cases you can enter the configurator value directly in a feature dialog input, for example: javascript configurator.panelWidth javascript configurator.partLabel Editing the Configurator Click Edit Configurator below the Expressions area to add or change widgets. Typical setup: Click Edit Configurator . Click Add Widget . Set the Field Name . Choose the widget Type . Set the default value and any limits or options. Click Save Configurator . After saving, the live configurator form appears above the Expressions editor. Naming Rules Each widget needs a field name that can be referenced from expressions. Good examples: panelWidth rib_count partLabel Avoid spaces and punctuation in field names. Use letters, numbers, _ , and $ . How Editing Behaves Changing a value in the live configurator form re-runs the model. Text and number inputs apply when you press Enter or leave the field. Slider drags update live. While Edit Configurator is open, the preview above updates as you add or remove widgets. That preview does not re-run the model until you save or close the configurator editor. Practical Example Create these configurator fields: panelWidth as a slider panelHeight as a number field finish as a select label as a string Then write expressions like: javascript wall = 2; outerWidth = configurator.panelWidth; outerHeight = configurator.panelHeight; innerWidth = outerWidth - wall * 2; innerHeight = outerHeight - wall * 2; titleText = configurator.label; Now feature dialogs can use: javascript outerWidth innerWidth titleText That gives you one place to control the whole part. Where You Can Use Expressions Expressions are mainly intended for feature dialog inputs. Common cases: numeric fields transform values vector component fields some text fields If a feature dialog supports expressions, you can enter either a direct value like 20 or an expression like width * 0.5 . You can also enter configurator values directly, such as configurator.panelWidth , without first defining a separate variable in the Expressions editor. Saved With the Part Expressions and configurator values are stored in part history, so they stay with the model through: save and load JSON export and import undo and redo embedded history in exported files that preserve feature history Related Docs Modeling Mode Part History"
115
115
  },
116
116
  {
117
117
  "title": "Radius Metadata for Extruded Sketches",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brep-io-kernel",
3
- "version": "1.0.185",
3
+ "version": "1.0.186",
4
4
  "scripts": {
5
5
  "start": "pnpm dev",
6
6
  "dev": "node ./scripts/prepareFontAssets.js && pnpm prepareFonts && pnpm build:kernel && vite --host 0.0.0.0",