brep-io-kernel 1.0.130 → 1.0.131
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/apiExamples/BREP_Booleans.html +2 -2
- package/dist/apiExamples/BREP_Export.html +2 -2
- package/dist/apiExamples/BREP_Primitives.html +2 -2
- package/dist/apiExamples/BREP_Transforms.html +2 -2
- package/dist/apiExamples/Embeded_2D_Sketcher.html +2 -2
- package/dist/apiExamples/Embeded_CAD.html +2 -2
- package/dist/apiExamples/Embeded_CAD_Integration_Test.html +2 -2
- package/dist/assets/{apiExample_BREP_Booleans-D4kgtViy.js → apiExample_BREP_Booleans-B7Kj1vvV.js} +1 -1
- package/dist/assets/{apiExample_BREP_Export-DpMK1JkS.js → apiExample_BREP_Export-BnKCdAHT.js} +1 -1
- package/dist/assets/{apiExample_BREP_Primitives-BwOo3cRE.js → apiExample_BREP_Primitives-LwPdyXrS.js} +1 -1
- package/dist/assets/{apiExample_BREP_Transforms-DMlj9lD8.js → apiExample_BREP_Transforms-DqsVunqO.js} +1 -1
- package/dist/assets/{apiExample_Embeded_2D_Sketcher-iRRFKiIs.js → apiExample_Embeded_2D_Sketcher-CY0GC0HV.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD-noXGj9pZ.js → apiExample_Embeded_CAD-CnfNjlJr.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD_Integration_Test-Dc_ZxSJ0.js → apiExample_Embeded_CAD_Integration_Test-BhejmDCU.js} +1 -1
- package/dist/assets/{brep-kernel-B-jYf5J_.js → brep-kernel-BaG0p-r1.js} +1 -1
- package/dist/assets/{browserTests-DRjrmODD.js → browserTests-i3eUkZ2A.js} +1 -1
- package/dist/assets/{main-cad-nInwQVGl.js → main-cad-DhExRvqf.js} +3 -3
- package/dist/assets/{test-BUMOHzem.js → test-zyBQfu7n.js} +3 -3
- package/dist/cad.html +1 -1
- package/dist/help/CONTRIBUTING.html +1 -1
- package/dist/help/developer-index.html +1 -1
- package/dist/help/index.html +1 -1
- package/dist/help/search-index.json +6 -6
- package/dist/test.html +1 -1
- package/dist/viewer.html +1 -1
- package/dist-kernel/brep-kernel.js +1 -1
- package/dist-kernel/help/CONTRIBUTING.html +1 -1
- package/dist-kernel/help/developer-index.html +1 -1
- package/dist-kernel/help/index.html +1 -1
- package/dist-kernel/help/search-index.json +6 -6
- package/package.json +1 -1
- package/src/UI/toolbarButtons/historyTestSnippetButton.js +9 -8
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# [Source https://github.com/mmiscool/BREP](https://github.com/mmiscool/BREP)
|
|
3
3
|
- [NPM package: `brep-io-kernel` https://www.npmjs.com/package/brep-io-kernel](https://www.npmjs.com/package/brep-io-kernel)
|
|
4
4
|
- [Live API examples https://BREP.io/apiExamples/index.html](https://BREP.io/apiExamples/index.html)
|
|
5
|
+
- [Developer Discord https://discord.gg/R5KNAKrQ](https://discord.gg/R5KNAKrQ)
|
|
5
6
|
|
|
6
7
|
BREP.io is a browser-based CAD application and JavaScript kernel for feature-based solid modeling.
|
|
7
8
|
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.
|
package/dist/about.html
CHANGED
|
@@ -125,7 +125,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
|
|
|
125
125
|
<main>
|
|
126
126
|
<section class="card readme">
|
|
127
127
|
<div class="header"><h1>Project Overview</h1></div>
|
|
128
|
-
<div class="content prose"><h1><a href="https://BREP.io">BREP.io</a></h1><h1><a href="https://github.com/mmiscool/BREP">Source <a href="https://github.com/mmiscool/BREP" target="_blank" rel="noopener noreferrer">https://github.com/mmiscool/BREP</a></a></h1><ul><li><a href="https://www.npmjs.com/package/brep-io-kernel">NPM package: <code>brep-io-kernel</code> <a href="https://www.npmjs.com/package/brep-io-kernel" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/brep-io-kernel</a></a></li><li><a href="https://BREP.io/apiExamples/index.html">Live API examples <a href="https://BREP.io/apiExamples/index.html" target="_blank" rel="noopener noreferrer">https://BREP.io/apiExamples/index.html</a></a></li></ul><p>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 <code>Solid</code>, <code>Face</code>, <code>Edge</code>, and <code>Vertex</code>, paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans (<a href="https://github.com/elalish/manifold">manifold-3d</a>), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs.</p><p>This project is in active development and APIs may continue to evolve.</p><h2>Screenshots</h2><p><img src="docs__HOME.png" alt="Home" width="280" loading="lazy" /> <a href="docs__modes__modeling.html"><img src="docs__MODELING.png" alt="Modeling Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sketch.html"><img src="docs__SKETCH.png" alt="Sketch Mode" width="280" loading="lazy" /></a> <a href="docs__modes__pmi.html"><img src="docs__PMI.png" alt="PMI Mode" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-2D_dialog.png" alt="Image to Face 2D" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-3D_dialog.png" alt="Image to Face 3D" width="280" loading="lazy" /></a></p><h2>Documentation Index</h2><p>General:</p><ul><li><a href="docs__getting-started.html">Getting Started</a></li><li><a href="docs__developer-index.html">Developer Docs Index</a></li><li><a href="docs__bug-reporting.html">Bug Reporting and Repro Test Cases</a></li><li><a href="docs__highlights.html">Highlights</a></li><li><a href="docs__whats-new.html">What's New</a></li><li><a href="docs__api-examples.html">API Examples</a></li></ul><p>Core APIs:</p><ul><li><a href="docs__brep-api.html">BREP API Export Map</a></li><li><a href="docs__brep-kernel.html">BREP Kernel Reference</a></li><li><a href="docs__solid-methods.html">Solid Methods</a></li><li><a href="docs__part-history.html">Part History</a></li><li><a href="docs__sketch-solver-2d.html">2D Sketch Solver</a></li><li><a href="docs__cad-embed.html">Embeddable CAD (<code>CadEmbed</code>)</a></li><li><a href="docs__sketcher2d-embed.html">Embeddable Sketcher (<code>Sketcher2DEmbed</code>)</a></li></ul><p>System docs:</p><ul><li><a href="docs__history-systems.html">History Systems</a></li><li><a href="docs__input-params-schema.html">Input Params Schema</a></li><li><a href="docs__file-formats.html">File Formats: Import and Export</a></li><li><a href="docs__plugins.html">Plugins and Examples</a></li><li><a href="docs__inspector.html">Inspector</a></li><li><a href="docs__inspector-improvements.html">Inspector Improvements</a></li></ul><p>Mode guides:</p><ul><li><a href="docs__modes__modeling.html">Modeling Mode</a></li><li><a href="docs__modes__sketch.html">Sketch Mode</a></li><li><a href="docs__modes__pmi.html">PMI Mode</a></li></ul><h2>Modeling Feature Docs</h2><p>Feature index:</p><ul><li><a href="docs__features__index.html">All Feature Docs</a></li></ul><p>Primitives and setup:</p><ul><li><a href="docs__features__primitive-cube.html">Primitive Cube</a></li><li><a href="docs__features__primitive-cylinder.html">Primitive Cylinder</a></li><li><a href="docs__features__primitive-cone.html">Primitive Cone</a></li><li><a href="docs__features__primitive-sphere.html">Primitive Sphere</a></li><li><a href="docs__features__primitive-torus.html">Primitive Torus</a></li><li><a href="docs__features__primitive-pyramid.html">Primitive Pyramid</a></li><li><a href="docs__features__plane.html">Plane</a></li><li><a href="docs__features__datum.html">Datum</a></li><li><a href="docs__features__datium.html">Datium</a></li><li><a href="docs__features__sketch.html">Sketch</a></li><li><a href="docs__features__spline.html">Spline</a></li><li><a href="docs__features__helix.html">Helix</a></li></ul><p>Solid operations:</p><ul><li><a href="docs__features__extrude.html">Extrude</a></li><li><a href="docs__features__sweep.html">Sweep</a></li><li><a href="docs__features__tube.html">Tube</a></li><li><a href="docs__features__loft.html">Loft</a></li><li><a href="docs__features__revolve.html">Revolve</a></li><li><a href="docs__features__mirror.html">Mirror</a></li><li><a href="docs__features__boolean.html">Boolean</a></li><li><a href="docs__features__fillet.html">Fillet</a></li><li><a href="docs__features__chamfer.html">Chamfer</a></li><li><a href="docs__features__hole.html">Hole</a></li><li><a href="docs__features__offset-shell.html">Offset Shell</a></li><li><a href="docs__features__remesh.html">Remesh</a></li><li><a href="docs__features__transform.html">Transform</a></li></ul><p>Pattern, import, and generation:</p><ul><li><a href="docs__features__pattern.html">Pattern (Legacy Combined)</a></li><li><a href="docs__features__pattern-linear.html">Pattern Linear</a></li><li><a href="docs__features__pattern-radial.html">Pattern Radial</a></li><li><a href="docs__features__import-3d-model.html">Import 3D Model</a></li><li><a href="docs__features__image-heightmap-solid.html">Image Heightmap Solid</a></li><li><a href="docs__features__image-to-face.html">Image to Face</a></li><li><a href="docs__features__text-to-face.html">Text to Face</a></li></ul><p>Assembly and sheet metal:</p><ul><li><a href="docs__features__assembly-component.html">Assembly Component</a></li><li><a href="docs__features__sheet-metal-tab.html">Sheet Metal Tab</a></li><li><a href="docs__features__sheet-metal-contour-flange.html">Sheet Metal Contour Flange</a></li><li><a href="docs__features__sheet-metal-flange.html">Sheet Metal Flange</a></li></ul><p>Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout.</p><h2>Assembly Constraints</h2><ul><li><a href="docs__assembly-constraints__solver.html">Assembly Constraint Solver</a></li><li><a href="docs__assembly-constraints__coincident-constraint.html">Coincident</a></li><li><a href="docs__assembly-constraints__distance-constraint.html">Distance</a></li><li><a href="docs__assembly-constraints__angle-constraint.html">Angle</a></li><li><a href="docs__assembly-constraints__parallel-constraint.html">Parallel</a></li><li><a href="docs__assembly-constraints__touch-align-constraint.html">Touch Align</a></li><li><a href="docs__assembly-constraints__fixed-constraint.html">Fixed</a></li></ul><h2>PMI Annotation Docs</h2><ul><li><a href="docs__pmi-annotations__index.html">PMI Annotations Index</a></li><li><a href="docs__pmi-annotations__linear-dimension.html">Linear Dimension</a></li><li><a href="docs__pmi-annotations__radial-dimension.html">Radial Dimension</a></li><li><a href="docs__pmi-annotations__angle-dimension.html">Angle Dimension</a></li><li><a href="docs__pmi-annotations__leader.html">Leader</a></li><li><a href="docs__pmi-annotations__note.html">Note</a></li><li><a href="docs__pmi-annotations__hole-callout.html">Hole Callout</a></li><li><a href="docs__pmi-annotations__explode-body.html">Explode Body</a></li></ul><h2>Quick Start</h2><p>Prerequisites:</p><ul><li>Node.js 18+</li><li><code>pnpm</code></li></ul><p>Install and run locally:</p><div class="doc-codeblock" data-code-language="bash">
|
|
128
|
+
<div class="content prose"><h1><a href="https://BREP.io">BREP.io</a></h1><h1><a href="https://github.com/mmiscool/BREP">Source <a href="https://github.com/mmiscool/BREP" target="_blank" rel="noopener noreferrer">https://github.com/mmiscool/BREP</a></a></h1><ul><li><a href="https://www.npmjs.com/package/brep-io-kernel">NPM package: <code>brep-io-kernel</code> <a href="https://www.npmjs.com/package/brep-io-kernel" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/brep-io-kernel</a></a></li><li><a href="https://BREP.io/apiExamples/index.html">Live API examples <a href="https://BREP.io/apiExamples/index.html" target="_blank" rel="noopener noreferrer">https://BREP.io/apiExamples/index.html</a></a></li><li><a href="https://discord.gg/R5KNAKrQ">Developer Discord <a href="https://discord.gg/R5KNAKrQ" target="_blank" rel="noopener noreferrer">https://discord.gg/R5KNAKrQ</a></a></li></ul><p>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 <code>Solid</code>, <code>Face</code>, <code>Edge</code>, and <code>Vertex</code>, paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans (<a href="https://github.com/elalish/manifold">manifold-3d</a>), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs.</p><p>This project is in active development and APIs may continue to evolve.</p><h2>Screenshots</h2><p><img src="docs__HOME.png" alt="Home" width="280" loading="lazy" /> <a href="docs__modes__modeling.html"><img src="docs__MODELING.png" alt="Modeling Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sketch.html"><img src="docs__SKETCH.png" alt="Sketch Mode" width="280" loading="lazy" /></a> <a href="docs__modes__pmi.html"><img src="docs__PMI.png" alt="PMI Mode" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-2D_dialog.png" alt="Image to Face 2D" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-3D_dialog.png" alt="Image to Face 3D" width="280" loading="lazy" /></a></p><h2>Documentation Index</h2><p>General:</p><ul><li><a href="docs__getting-started.html">Getting Started</a></li><li><a href="docs__developer-index.html">Developer Docs Index</a></li><li><a href="docs__bug-reporting.html">Bug Reporting and Repro Test Cases</a></li><li><a href="docs__highlights.html">Highlights</a></li><li><a href="docs__whats-new.html">What's New</a></li><li><a href="docs__api-examples.html">API Examples</a></li></ul><p>Core APIs:</p><ul><li><a href="docs__brep-api.html">BREP API Export Map</a></li><li><a href="docs__brep-kernel.html">BREP Kernel Reference</a></li><li><a href="docs__solid-methods.html">Solid Methods</a></li><li><a href="docs__part-history.html">Part History</a></li><li><a href="docs__sketch-solver-2d.html">2D Sketch Solver</a></li><li><a href="docs__cad-embed.html">Embeddable CAD (<code>CadEmbed</code>)</a></li><li><a href="docs__sketcher2d-embed.html">Embeddable Sketcher (<code>Sketcher2DEmbed</code>)</a></li></ul><p>System docs:</p><ul><li><a href="docs__history-systems.html">History Systems</a></li><li><a href="docs__input-params-schema.html">Input Params Schema</a></li><li><a href="docs__file-formats.html">File Formats: Import and Export</a></li><li><a href="docs__plugins.html">Plugins and Examples</a></li><li><a href="docs__inspector.html">Inspector</a></li><li><a href="docs__inspector-improvements.html">Inspector Improvements</a></li></ul><p>Mode guides:</p><ul><li><a href="docs__modes__modeling.html">Modeling Mode</a></li><li><a href="docs__modes__sketch.html">Sketch Mode</a></li><li><a href="docs__modes__pmi.html">PMI Mode</a></li></ul><h2>Modeling Feature Docs</h2><p>Feature index:</p><ul><li><a href="docs__features__index.html">All Feature Docs</a></li></ul><p>Primitives and setup:</p><ul><li><a href="docs__features__primitive-cube.html">Primitive Cube</a></li><li><a href="docs__features__primitive-cylinder.html">Primitive Cylinder</a></li><li><a href="docs__features__primitive-cone.html">Primitive Cone</a></li><li><a href="docs__features__primitive-sphere.html">Primitive Sphere</a></li><li><a href="docs__features__primitive-torus.html">Primitive Torus</a></li><li><a href="docs__features__primitive-pyramid.html">Primitive Pyramid</a></li><li><a href="docs__features__plane.html">Plane</a></li><li><a href="docs__features__datum.html">Datum</a></li><li><a href="docs__features__datium.html">Datium</a></li><li><a href="docs__features__sketch.html">Sketch</a></li><li><a href="docs__features__spline.html">Spline</a></li><li><a href="docs__features__helix.html">Helix</a></li></ul><p>Solid operations:</p><ul><li><a href="docs__features__extrude.html">Extrude</a></li><li><a href="docs__features__sweep.html">Sweep</a></li><li><a href="docs__features__tube.html">Tube</a></li><li><a href="docs__features__loft.html">Loft</a></li><li><a href="docs__features__revolve.html">Revolve</a></li><li><a href="docs__features__mirror.html">Mirror</a></li><li><a href="docs__features__boolean.html">Boolean</a></li><li><a href="docs__features__fillet.html">Fillet</a></li><li><a href="docs__features__chamfer.html">Chamfer</a></li><li><a href="docs__features__hole.html">Hole</a></li><li><a href="docs__features__offset-shell.html">Offset Shell</a></li><li><a href="docs__features__remesh.html">Remesh</a></li><li><a href="docs__features__transform.html">Transform</a></li></ul><p>Pattern, import, and generation:</p><ul><li><a href="docs__features__pattern.html">Pattern (Legacy Combined)</a></li><li><a href="docs__features__pattern-linear.html">Pattern Linear</a></li><li><a href="docs__features__pattern-radial.html">Pattern Radial</a></li><li><a href="docs__features__import-3d-model.html">Import 3D Model</a></li><li><a href="docs__features__image-heightmap-solid.html">Image Heightmap Solid</a></li><li><a href="docs__features__image-to-face.html">Image to Face</a></li><li><a href="docs__features__text-to-face.html">Text to Face</a></li></ul><p>Assembly and sheet metal:</p><ul><li><a href="docs__features__assembly-component.html">Assembly Component</a></li><li><a href="docs__features__sheet-metal-tab.html">Sheet Metal Tab</a></li><li><a href="docs__features__sheet-metal-contour-flange.html">Sheet Metal Contour Flange</a></li><li><a href="docs__features__sheet-metal-flange.html">Sheet Metal Flange</a></li></ul><p>Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout.</p><h2>Assembly Constraints</h2><ul><li><a href="docs__assembly-constraints__solver.html">Assembly Constraint Solver</a></li><li><a href="docs__assembly-constraints__coincident-constraint.html">Coincident</a></li><li><a href="docs__assembly-constraints__distance-constraint.html">Distance</a></li><li><a href="docs__assembly-constraints__angle-constraint.html">Angle</a></li><li><a href="docs__assembly-constraints__parallel-constraint.html">Parallel</a></li><li><a href="docs__assembly-constraints__touch-align-constraint.html">Touch Align</a></li><li><a href="docs__assembly-constraints__fixed-constraint.html">Fixed</a></li></ul><h2>PMI Annotation Docs</h2><ul><li><a href="docs__pmi-annotations__index.html">PMI Annotations Index</a></li><li><a href="docs__pmi-annotations__linear-dimension.html">Linear Dimension</a></li><li><a href="docs__pmi-annotations__radial-dimension.html">Radial Dimension</a></li><li><a href="docs__pmi-annotations__angle-dimension.html">Angle Dimension</a></li><li><a href="docs__pmi-annotations__leader.html">Leader</a></li><li><a href="docs__pmi-annotations__note.html">Note</a></li><li><a href="docs__pmi-annotations__hole-callout.html">Hole Callout</a></li><li><a href="docs__pmi-annotations__explode-body.html">Explode Body</a></li></ul><h2>Quick Start</h2><p>Prerequisites:</p><ul><li>Node.js 18+</li><li><code>pnpm</code></li></ul><p>Install and run locally:</p><div class="doc-codeblock" data-code-language="bash">
|
|
129
129
|
<div class="doc-codeblock-header">
|
|
130
130
|
<span class="doc-codeblock-lang">bash</span>
|
|
131
131
|
<button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Booleans</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-B7Kj1vvV.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Export</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Export-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Export-BnKCdAHT.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Primitives</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-LwPdyXrS.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Transforms</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-DqsVunqO.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Embeded 2D Sketcher</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-CY0GC0HV.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
background: #fff;
|
|
32
32
|
}
|
|
33
33
|
</style>
|
|
34
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-
|
|
34
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-CnfNjlJr.js"></script>
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
37
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
38
38
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
</style>
|
|
95
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-
|
|
95
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-BhejmDCU.js"></script>
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-BaG0p-r1.js">
|
|
99
99
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
100
100
|
</head>
|
|
101
101
|
<body>
|
package/dist/assets/{apiExample_BREP_Booleans-D4kgtViy.js → apiExample_BREP_Booleans-B7Kj1vvV.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-
|
|
1
|
+
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),b=document.getElementById("log"),f=document.getElementById("btn-run"),c=o((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),g=o(e=>Number(e).toFixed(6),"fmt"),u=o((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");b.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),s=o(e=>({volume:e.volume(),surfaceArea:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),d=o(()=>{b.textContent="",c("Running...","pending");const e=new i.Cube({x:2.2,y:2.2,z:2.2,name:"Cube"}),t=new i.Sphere({r:1.35,resolution:40,name:"Sphere"}),r=e.union(t),h=e.subtract(t),p=e.intersect(t),n={cube:s(e),sphere:s(t),union:s(r),subtract:s(h),intersect:s(p)};u("--- Boolean Results ---");for(const[v,l]of Object.entries(n))u(`${v.padEnd(10)} volume=${g(l.volume)} area=${g(l.surfaceArea)} triangles=${l.triangles}`);const a=1e-6;if(n.union.volume+a<Math.max(n.cube.volume,n.sphere.volume))throw new Error("Union volume is unexpectedly smaller than both source solids.");if(n.intersect.volume-a>Math.min(n.cube.volume,n.sphere.volume))throw new Error("Intersection volume is unexpectedly larger than a source solid.");if(n.subtract.volume-a>n.cube.volume)throw new Error("Subtract volume is unexpectedly larger than the original cube.");c("Completed","ok")},"runExample");f.addEventListener("click",()=>{try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}});try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}
|
package/dist/assets/{apiExample_BREP_Export-DpMK1JkS.js → apiExample_BREP_Export-BnKCdAHT.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const l=document.getElementById("status"),d=document.getElementById("log"),p=document.getElementById("btn-run"),s=r((t,n)=>{l.textContent=t,l.className=`status ${n}`},"setStatus"),e=r((...t)=>{const n=t.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");d.textContent+=`${n}
|
|
2
2
|
`,console.log(...t)},"write"),u=r((t,n=8)=>t.split(`
|
|
3
3
|
`).slice(0,n).join(`
|
|
4
4
|
`),"firstLines"),m=r(()=>{d.textContent="",s("Running...","pending");const t=new c.Cylinder({radius:1,height:3,resolution:48,name:"Shaft"}).bakeTRS({position:[0,0,.6],rotationEuler:[90,0,0],scale:[1,1,1]}),n=new c.Cone({radius:1.55,height:1.6,resolution:48,name:"Head"}).bakeTRS({position:[0,1.65,.6],rotationEuler:[-90,0,0],scale:[1,1,1]}),o=t.union(n),i=o.toSTL("api_example_part",4),a=o.toSTEP("api_example_part",{precision:4});if(e("--- Export Summary ---"),e("Volume:",o.volume()),e("Surface area:",o.surfaceArea()),e("Triangles:",o.getTriangleCount()),e("STL characters:",i.length),e("STEP characters:",a.length),e(""),e("--- STL Preview ---"),e(u(i)),e(""),e("--- STEP Preview ---"),e(u(a)),!i.startsWith("solid"))throw new Error('STL output did not start with "solid".');if(!a.includes("ISO-10303-21"))throw new Error("STEP output did not contain expected ISO header.");s("Completed","ok")},"runExample");p.addEventListener("click",()=>{try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}});try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),u=document.getElementById("log"),y=document.getElementById("btn-run"),s=n((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),l=n(e=>Number(e).toFixed(6),"fmt"),a=n((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");u.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),C=n(e=>({volume:e.volume(),area:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),c=n(()=>{u.textContent="",s("Running...","pending");const e=[["Cube",()=>new o.Cube({x:2,y:3,z:4,name:"Cube"})],["Sphere",()=>new o.Sphere({r:1.2,resolution:32,name:"Sphere"})],["Cylinder",()=>new o.Cylinder({radius:1,height:2.4,resolution:48,name:"Cylinder"})],["Cone",()=>new o.Cone({radius:1.1,height:2.1,resolution:48,name:"Cone"})],["Torus",()=>new o.Torus({mR:2,tR:.55,resolution:64,name:"Torus"})],["Pyramid",()=>new o.Pyramid({bL:2,s:4,h:2.7,name:"Pyramid"})]];a("--- Primitive Summary ---");for(const[t,r]of e){const d=r(),i=C(d);a(`${t.padEnd(10)} volume=${l(i.volume)} area=${l(i.area)} triangles=${i.triangles}`)}s("Completed","ok")},"runExample");y.addEventListener("click",()=>{try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-
|
|
1
|
+
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const c=document.getElementById("status"),l=document.getElementById("log"),b=document.getElementById("btn-run"),s=n((e,t)=>{c.textContent=e,c.className=`status ${t}`},"setStatus"),i=n(e=>Number(e).toFixed(6),"fmt"),m=n((...e)=>{const t=e.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");l.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),r=n((e,t)=>{m(`${e.padEnd(16)} volume=${i(t.volume())} area=${i(t.surfaceArea())} triangles=${t.getTriangleCount()}`)},"describe"),d=n(()=>{l.textContent="",s("Running...","pending");const e=new g.Cube({x:2.2,y:1.4,z:1,name:"BaseCube"}),t=e.clone().bakeTRS({position:[2,.4,.3],rotationEuler:[0,35,20],scale:[1.1,.85,1.25]}),o=t.mirrorAcrossPlane([0,0,0],[1,0,0]),a=t.union(o);if(m("--- Transform Summary ---"),r("base",e),r("moved",t),r("mirrored",o),r("combined",a),a.volume()<=t.volume())throw new Error("Combined solid volume should be greater than a single moved solid.");s("Completed","ok")},"runExample");b.addEventListener("click",()=>{try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-
|
|
1
|
+
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const k=document.getElementById("btn-create"),C=document.getElementById("btn-destroy"),I=document.getElementById("btn-apply-css"),w=document.getElementById("btn-apply-theme"),B=document.getElementById("btn-export-svg"),$=document.getElementById("btn-export-dxf"),r=document.getElementById("btn-download-dxf"),D=document.getElementById("btn-export-polylines"),F=document.getElementById("geometry-color"),L=document.getElementById("point-color"),N=document.getElementById("constraint-color"),G=document.getElementById("background-color"),T=document.getElementById("point-size-px"),A=document.getElementById("curve-thickness-px"),f=document.getElementById("sidebar-expanded"),u=document.getElementById("grid-visible"),V=document.getElementById("grid-spacing"),W=document.getElementById("curve-resolution"),R=document.getElementById("css-input"),Y=document.getElementById("sketch-status"),q=document.getElementById("sketch-host"),d=document.getElementById("event-output"),g=document.getElementById("svg-preview"),O=document.getElementById("path-output"),P=document.getElementById("dxf-output"),M=document.getElementById("polyline-output");let t=null,i=null,m=0,h=0,y=0,c=null;const K=6,n=s(e=>{Y.textContent=e},"setSketchStatus"),b=s(()=>{c&&(URL.revokeObjectURL(c),c=null)},"revokeDxfDownload"),Q=s(e=>{if(b(),typeof e!="string"||!e.length){r.disabled=!0;return}const o=new Blob([e],{type:"application/dxf"});c=URL.createObjectURL(o),r.disabled=!1},"setDxfDownload"),E=s(e=>{k.disabled=e,C.disabled=!e,I.disabled=!e,w.disabled=!e,B.disabled=!e,$.disabled=!e,D.disabled=!e,r.disabled=!e||!c},"setSketchButtons"),p=s((e,o=null)=>{const a=new Date().toLocaleTimeString(),j=o==null?`[${a}] ${e}`:`[${a}] ${e} ${JSON.stringify(o)}`,z=d.textContent==="(No sketch events yet)"?[]:d.textContent.split(`
|
|
2
2
|
`).filter(Boolean),S=[j,...z].slice(0,K);d.textContent=S.length?S.join(`
|
|
3
3
|
`):"(No sketch events yet)"},"pushEvent"),U=s(()=>({geometryColor:F.value,pointColor:L.value,constraintColor:N.value,backgroundColor:G.value,pointSizePx:Math.max(1,Number(T.value)||10),curveThicknessPx:Math.max(.5,Number(A.value)||2)}),"currentTheme"),x=s(()=>{const e=Number(V.value);return Number.isFinite(e)&&e>0?e:1},"currentGridSpacing"),v=s(()=>{const e=Number(W.value);return Number.isFinite(e)?Math.max(3,Math.min(2048,Math.floor(e))):64},"currentCurveResolution"),Z=s(async()=>{t||(t=new J({cssText:R.value,...U(),sidebarExpanded:f.checked,gridVisible:u.checked,gridSpacing:x(),onChange:s(e=>{i=e,m+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch updated (${m}). Geometries: ${o}`),p("onChange",{geometries:o})},"onChange"),onFinished:s(e=>{i=e,h+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch finished (${h}). Geometries: ${o}`),p("onFinished",{geometries:o}),X().catch(a=>{console.error(a),n(`Failed to export SVG after Finish: ${a?.message||String(a)}`)})},"onFinished"),onCancelled:s(()=>{y+=1,n(`Sketch cancelled (${y}).`),p("onCancelled")},"onCancelled")}),await t.mount(q),i=await t.getSketch(),E(!0),n("Sketcher iframe mounted. Draw geometry and run any export action."))},"attachSketcher"),_=s(async()=>{t&&(await t.destroy(),t=null,i=null,m=0,h=0,y=0,E(!1),n("Sketcher destroyed."),d.textContent="(No sketch events yet)",g.innerHTML="",O.textContent="(No SVG exported yet)",P.textContent="(No DXF exported yet)",M.textContent="(No 3D polylines exported yet)",b())},"detachSketcher"),ee=s(async()=>{t&&(await t.setCss(R.value),n("Custom CSS applied to iframe."))},"applySketchCss"),l=s(async()=>{t&&(await t.setTheme(U()),await t.setSidebarExpanded(f.checked),typeof t.setGrid=="function"?await t.setGrid({visible:u.checked,spacing:x()}):(typeof t.setGridVisible=="function"&&await t.setGridVisible(u.checked),typeof t.setGridSpacing=="function"&&await t.setGridSpacing(x())),n("Theme + sidebar + grid state applied to iframe."))},"applySketchTheme"),X=s(async()=>{if(!t)return;const e=await t.exportSVG({flipY:!0,precision:3,stroke:"#111111",strokeWidth:1.5,fill:"none",padding:12,curveResolution:v()});i=await t.getSketch({preferCached:!0}),g.innerHTML=e.svg,O.textContent=e.paths.length?e.paths.map(o=>`id=${o.id} type=${o.type} d="${o.d}"`).join(`
|
|
4
4
|
`):"(No sketch geometry to export)",n(`Exported ${e.paths.length} SVG paths.`),g.scrollIntoView({behavior:"smooth",block:"start"})},"exportSvg"),te=s(async()=>{if(!t)return;const e=await t.exportDXF({units:"mm",curveResolution:v(),includeConstruction:!1});P.textContent=e?.dxf||"(No DXF payload returned)",Q(e?.dxf||""),n(`Exported DXF with ${e?.polylines?.length||0} polylines.`)},"exportDxf"),ne=s(async()=>{if(!t)return;const e=await t.export3DPolylines({curveResolution:v(),includeConstruction:!1,origin:[0,0,0],xAxis:[1,0,0],yAxis:[0,1,0]});M.textContent=JSON.stringify(e,null,2),n(`Exported ${e?.polylines?.length||0} 3D polylines.`)},"export3DPolylines");k.addEventListener("click",()=>{Z().catch(e=>{console.error(e),n(`Failed to create sketcher: ${e?.message||String(e)}`)})});C.addEventListener("click",()=>{_().catch(e=>{console.error(e),n(`Failed to destroy sketcher: ${e?.message||String(e)}`)})});I.addEventListener("click",()=>{ee().catch(e=>{console.error(e),n(`Failed to apply CSS: ${e?.message||String(e)}`)})});w.addEventListener("click",()=>{l().catch(e=>{console.error(e),n(`Failed to apply theme: ${e?.message||String(e)}`)})});B.addEventListener("click",()=>{X().catch(e=>{console.error(e),n(`Failed to export SVG: ${e?.message||String(e)}`)})});$.addEventListener("click",()=>{te().catch(e=>{console.error(e),n(`Failed to export DXF: ${e?.message||String(e)}`)})});r.addEventListener("click",()=>{if(!c)return;const e=document.createElement("a");e.href=c,e.download="sketch-export.dxf",e.click()});D.addEventListener("click",()=>{ne().catch(e=>{console.error(e),n(`Failed to export 3D polylines: ${e?.message||String(e)}`)})});[F,L,N,G,T,A].forEach(e=>{e.addEventListener("input",()=>{t&&l().catch(o=>{console.error(o),n(`Failed to apply theme: ${o?.message||String(o)}`)})})});f.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply sidebar state: ${e?.message||String(e)}`)})});u.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid visibility: ${e?.message||String(e)}`)})});V.addEventListener("input",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid spacing: ${e?.message||String(e)}`)})});window.addEventListener("beforeunload",()=>{t&&t.destroy().catch(()=>{}),b()});E(!1);i&&!Array.isArray(i?.geometries)&&console.warn("Unexpected sketch payload shape",i);
|
package/dist/assets/{apiExample_Embeded_CAD-noXGj9pZ.js → apiExample_Embeded_CAD-CnfNjlJr.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-
|
|
1
|
+
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const u=document.getElementById("btn-create"),y=document.getElementById("btn-destroy"),p=document.getElementById("btn-state"),g=document.getElementById("btn-history"),b=document.getElementById("btn-sample"),E=document.getElementById("btn-reset"),h=document.getElementById("btn-css"),S=document.getElementById("viewer-only"),i=document.getElementById("sidebar-expanded"),x=document.getElementById("model-path"),w=document.getElementById("model-source"),$=document.getElementById("model-repo"),k=document.getElementById("model-branch"),C=document.getElementById("css-input"),F=document.getElementById("cad-status"),H=document.getElementById("cad-host"),I=document.getElementById("state-output"),f=document.getElementById("history-output");let e=null;const D={features:[{type:"Primitive Cube",inputParams:{id:"sample_cube_1",sizeX:24,sizeY:18,sizeZ:14,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0},s=n(t=>{F.textContent=t},"setStatus"),r=n(t=>{u.disabled=t,y.disabled=!t,p.disabled=!t,g.disabled=!t,b.disabled=!t,E.disabled=!t,h.disabled=!t,S.disabled=t},"setButtons"),L=n(()=>{const t=String(x.value||"").trim();if(!t)return null;const o=String(w.value||"local").trim()||"local",a=String($.value||"").trim(),d=String(k.value||"").trim(),l={modelPath:t,source:o};return a&&(l.repoFull=a),d&&(l.branch=d),l},"currentModelRequest"),c=n((t,o="State updated")=>{I.textContent=JSON.stringify(t||{},null,2);const a=Number(t?.featureCount||0),d=t?.model?.name||"(unsaved/new)";s(`${o}. Features: ${a}. Model: ${d}`)},"renderState"),N=n(async()=>{if(e)return;const t=L();e=new v({mountTo:H,viewerOnlyMode:S.checked,sidebarExpanded:i.checked,cssText:C.value,initialModel:t,onReady:n(a=>{c(a,"CAD ready")},"onReady"),onHistoryChanged:n(a=>{c(a,`History changed (${a?.reason||"update"})`)},"onHistoryChanged")}),await e.mount(),r(!0);const o=await e.getState();c(o,"CAD iframe mounted")},"createCad"),O=n(async()=>{e&&(await e.destroy(),e=null,r(!1),s("CAD iframe destroyed."),I.textContent="(No state yet)",f.textContent="(No history exported yet)")},"destroyCad"),m=n(async()=>{if(!e)return;const t=await e.getState();c(t,"State fetched")},"refreshState"),A=n(async()=>{if(!e)return;const t=await e.getPartHistoryJSON();f.textContent=t||"(History is empty)",s(`History exported (${t?t.length:0} chars).`)},"exportHistory"),M=n(async()=>{e&&(await e.setPartHistory(D),await m(),s("Sample cube history loaded."))},"loadSampleCube"),P=n(async()=>{e&&(await e.reset(),await m(),s("Model reset complete."))},"resetModel"),R=n(async()=>{e&&(await e.setCss(C.value),await e.setSidebarExpanded(i.checked),s("Custom CSS and sidebar state applied."))},"applyCss");u.addEventListener("click",()=>{N().catch(t=>{console.error(t),s(`Failed to create CAD iframe: ${t?.message||String(t)}`)})});y.addEventListener("click",()=>{O().catch(t=>{console.error(t),s(`Failed to destroy CAD iframe: ${t?.message||String(t)}`)})});p.addEventListener("click",()=>{m().catch(t=>{console.error(t),s(`Failed to get state: ${t?.message||String(t)}`)})});g.addEventListener("click",()=>{A().catch(t=>{console.error(t),s(`Failed to export history: ${t?.message||String(t)}`)})});b.addEventListener("click",()=>{M().catch(t=>{console.error(t),s(`Failed to load sample history: ${t?.message||String(t)}`)})});E.addEventListener("click",()=>{P().catch(t=>{console.error(t),s(`Failed to reset model: ${t?.message||String(t)}`)})});h.addEventListener("click",()=>{R().catch(t=>{console.error(t),s(`Failed to apply CSS: ${t?.message||String(t)}`)})});i.addEventListener("change",()=>{e&&e.setSidebarExpanded(i.checked).catch(t=>{console.error(t),s(`Failed to set sidebar state: ${t?.message||String(t)}`)})});r(!1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-
|
|
1
|
+
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-BaG0p-r1.js";import"./preload-helper-ZNr0Qq7Q.js";const h=document.getElementById("btn-run"),u=document.getElementById("btn-destroy"),P=document.getElementById("viewer-only"),H=document.getElementById("sidebar-expanded"),M=document.getElementById("model-path"),A=document.getElementById("model-source"),j=document.getElementById("model-repo"),B=document.getElementById("model-branch"),x=document.getElementById("css-input"),R=document.getElementById("run-status"),$=document.getElementById("cad-host"),C=document.getElementById("results"),g=document.getElementById("log-output");let n=null,w=!1;const v={features:[{type:"Primitive Cube",inputParams:{id:"integration_sample_cube_1",sizeX:16,sizeY:12,sizeZ:10,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0};function l(t){const a=`[${new Date().toLocaleTimeString()}] ${t}`,o=g.textContent==="(No logs yet)"?[]:g.textContent.split(`
|
|
4
4
|
`).filter(Boolean);o.unshift(a),g.textContent=o.slice(0,120).join(`
|
|
@@ -11475,7 +11475,7 @@ ${t.map(i=>`${B}${i}`).join(`
|
|
|
11475
11475
|
.testsnip-btn { background: rgba(255,255,255,.03); color: #f9fafb; border: 1px solid #374151; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 12px; line-height: 1; }
|
|
11476
11476
|
.testsnip-btn:hover { border-color: #3b82f6; background: rgba(59,130,246,.12); }
|
|
11477
11477
|
.testsnip-link { text-decoration: none; display: inline-flex; align-items: center; }
|
|
11478
|
-
`,document.head.appendChild(g)}D(BRA,"KbA");E(BRA,"ensureDialogStyles");function iRA({snippet:g,functionName:A,featureCount:e,copied:t}){BRA();const B=document.createElement("div");B.className="testsnip-overlay";const i=document.createElement("div");i.className="testsnip-modal";const I=document.createElement("div");I.className="testsnip-title",I.textContent="Generated Test Snippet";const s=document.createElement("div");s.className="testsnip-hint",s.textContent=t?`Copied to clipboard. Function: ${A}. Features: ${e}.`:`Clipboard copy was unavailable. Function: ${A}. Features: ${e}.`;const C=document.createElement("textarea");C.className="testsnip-text",C.value=String(g||""),C.readOnly=!0;const o=document.createElement("div");o.className="testsnip-actions";const Q=document.createElement("a");Q.className="testsnip-btn testsnip-link",Q.textContent="Open GitHub Issue",Q.href=tRA(A,e),Q.target="_blank",Q.rel="noopener noreferrer";const n=document.createElement("button");n.className="testsnip-btn",n.textContent="Copy",n.addEventListener("click",async()=>{const a=await X3(C.value);s.textContent=a?`Copied to clipboard. Function: ${A}. Features: ${e}.`:"Clipboard copy failed. Use Ctrl/Cmd+C in the textbox."});const r=document.createElement("button");r.className="testsnip-btn",r.textContent="Close",r.addEventListener("click",()=>{try{document.body.removeChild(B)}catch{}}),o.appendChild(Q),o.appendChild(n),o.appendChild(r),i.appendChild(I),i.appendChild(s),i.appendChild(C),i.appendChild(o),B.appendChild(i),B.addEventListener("click",a=>{if(a.target===B)try{document.body.removeChild(B)}catch{}}),document.body.appendChild(B);try{C.focus(),C.select()}catch{}}D(iRA,"LbA");E(iRA,"openSnippetDialog");function IRA(g){return g?{label:"🪲",title:"Generate a test snippet from current feature history",onClick:E(async()=>{try{const A=await eRA(g?.partHistory),e=qmA(g),t=gRA({functionName:e,features:A.features,expressions:A.expressions}),B=await X3(t);try{window.__generatedHistoryTestSnippet=t}catch{}iRA({snippet:t,functionName:e,featureCount:A.features.length,copied:B})}catch(A){console.error("[HistoryTestSnippet] Failed to generate snippet:",A),alert("Failed to generate test snippet. See console for details.")}},"onClick")}:null}D(IRA,"PbA");E(IRA,"createHistoryTestSnippetButton");const t1="__selectionStatePanel";function sRA(){if(document.getElementById("selection-state-styles"))return;const g=document.createElement("style");g.id="selection-state-styles",g.textContent=`
|
|
11478
|
+
`,document.head.appendChild(g)}D(BRA,"KbA");E(BRA,"ensureDialogStyles");function iRA({snippet:g,functionName:A,featureCount:e,copied:t}){BRA();const B=document.createElement("div");B.className="testsnip-overlay";const i=document.createElement("div");i.className="testsnip-modal";const I=document.createElement("div");I.className="testsnip-title",I.textContent="Generated Test Snippet";const s=document.createElement("div");s.className="testsnip-hint",s.textContent=t?`Copied to clipboard. Function: ${A}. Features: ${e}.`:`Clipboard copy was unavailable. Function: ${A}. Features: ${e}.`;const C=document.createElement("textarea");C.id="code3",C.className="testsnip-text",C.value=String(g||""),C.readOnly=!0;const o=document.createElement("div");o.className="testsnip-actions";const Q=document.createElement("a");Q.className="testsnip-btn testsnip-link",Q.textContent="Open GitHub Issue",Q.href=tRA(A,e),Q.target="_blank",Q.rel="noopener noreferrer";const n=document.createElement("button");n.className="testsnip-btn",n.textContent="Copy",n.addEventListener("click",async()=>{const a=await X3(C.value);s.textContent=a?`Copied to clipboard. Function: ${A}. Features: ${e}.`:"Clipboard copy failed. Use Ctrl/Cmd+C in the textbox."});const r=document.createElement("button");r.className="testsnip-btn",r.textContent="Close",r.addEventListener("click",()=>{try{document.body.removeChild(B)}catch{}}),o.appendChild(Q),o.appendChild(n),o.appendChild(r),i.appendChild(I),i.appendChild(s),i.appendChild(C),i.appendChild(o),B.appendChild(i),B.addEventListener("click",a=>{if(a.target===B)try{document.body.removeChild(B)}catch{}}),document.body.appendChild(B);try{C.focus(),C.select()}catch{}}D(iRA,"LbA");E(iRA,"openSnippetDialog");function IRA(g){return g?{label:"🪲",title:"Generate a test snippet from current feature history",onClick:E(async()=>{try{const A=await eRA(g?.partHistory),e=qmA(g),t=gRA({functionName:e,features:A.features,expressions:A.expressions}),B=await X3(t);try{window.__generatedHistoryTestSnippet=t}catch{}iRA({snippet:t,functionName:e,featureCount:A.features.length,copied:B})}catch(A){console.error("[HistoryTestSnippet] Failed to generate snippet:",A),alert("Failed to generate test snippet. See console for details.")}},"onClick")}:null}D(IRA,"PbA");E(IRA,"createHistoryTestSnippetButton");const t1="__selectionStatePanel";function sRA(){if(document.getElementById("selection-state-styles"))return;const g=document.createElement("style");g.id="selection-state-styles",g.textContent=`
|
|
11479
11479
|
.selection-state-content {
|
|
11480
11480
|
display: flex;
|
|
11481
11481
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var t0=Object.defineProperty;var i=(e,t)=>t0(e,"name",{value:t,configurable:!0});import{g as ot,V as at,F as st}from"./main-cad-
|
|
1
|
+
var t0=Object.defineProperty;var i=(e,t)=>t0(e,"name",{value:t,configurable:!0});import{g as ot,V as at,F as st}from"./main-cad-DhExRvqf.js";import{q as P}from"./browserStorage-CvgF8ovw.js";import{P as kt}from"./PartHistory-C_RCi3EP.js";import{C as $t,f as it,h as qe,e as lt,E as Ct,g as r0,O as n0,_ as o0,i as Ie,j as ct,k as a0,l as s0,B as i0}from"./FeatureRegistry-BKev_OFL.js";import{ar as l0,V as ie,aK as c0,B as d0,a6 as dt}from"./featureDialogs-iSksHtoY.js";import{c as Ot}from"./fillet-D7__7anN.js";import"./droppedWorkspaceFiles-8o-ZYOrf.js";import"./annUtils-DsJrYcfY.js";import"./AnnotationRegistry-CB-B-aFd.js";import"./deepClone-Dj59xCHB.js";import"./preload-helper-ZNr0Qq7Q.js";import"./AssemblyConstraintRegistry-CI7K8Ils.js";import"./chamfer-DsoaU89P.js";const tt=class tt{constructor(t={}){this.options={captureStack:!!t.captureStack,withTimestamp:t.withTimestamp!==!1,levels:t.levels||null,maxEntries:Number.isFinite(t.maxEntries)?t.maxEntries:1/0},this._orig=(typeof window<"u"?window.console:console)||{},this._installed=!1,this._capturing=!0,this._logs=[],this._nextId=1,this._proxy=this._buildProxy(),this.install()}install(){if(this._installed)return;const t=typeof window<"u"?window:globalThis;this._prevConsole=t.console,t.console=this._proxy,this._installed=!0}restore(){if(!this._installed)return;const t=typeof window<"u"?window:globalThis;t.console=this._prevConsole||this._orig,this._installed=!1}pause(){this._capturing=!1}resume(){this._capturing=!0}getLogs(t={}){const{level:r,since:n,until:o}=t;return this._logs.filter(a=>!(r&&a.level!==r||n&&a.time&&a.time<n||o&&a.time&&a.time>o)).slice()}clearLogs(){this._logs.length=0}get logs(){return this.getLogs()}getLogsAll(){return this.getLogs()}_buildProxy(){const t=this._orig,r={},n=new Set([...Object.getOwnPropertyNames(t),...Object.keys(t)]);["log","info","warn","error","debug","trace","group","groupCollapsed","groupEnd","table","time","timeEnd","timeLog","count","countReset","assert","clear","dir","dirxml"].forEach(a=>n.add(a));for(const a of n){const s=this._safeGetDescriptor(t,a);if(s)if(typeof s.value=="function")r[a]=this._wrapMethod(a,t[a]);else if(s.get||s.set)Object.defineProperty(r,a,{configurable:!0,enumerable:s.enumerable,get:s.get?s.get.bind(t):void 0,set:s.set?s.set.bind(t):void 0});else try{r[a]=t[a]}catch{}}return Object.defineProperty(r,"__capturing__",{value:!0,enumerable:!1}),r}_safeGetDescriptor(t,r){try{return Object.getOwnPropertyDescriptor(t,r)}catch{return null}}_wrapMethod(t,r){const n=this,o=!n.options.levels||n.options.levels.includes(t);function a(...s){const c=t==="assert"?!s[0]:!0;if(n._capturing&&o&&c){const d={id:n._nextId++,level:t,args:s};if(n.options.withTimestamp&&(d.time=new Date),n.options.captureStack){const p=new Error().stack||"";d.stack=p.split(`
|
|
2
2
|
`).slice(2).join(`
|
|
3
3
|
`)}n.options.maxEntries!==1/0&&n._logs.length>=n.options.maxEntries&&n._logs.shift(),n._logs.push(d)}try{if(typeof r=="function")return r.apply(n._orig,s)}catch(d){try{return n._orig&&typeof n._orig.log=="function"?n._orig.log("ConsoleCapture forwarding error:",d):void 0}catch{}}}i(a,"wrapped");try{Object.defineProperty(a,"name",{value:`capture_${t}`})}catch{}return a}};i(tt,"ConsoleCapture");let ze=tt;const M=!!globalThis?.process?.versions?.node&&typeof window>"u";function $(){if(!M)return F;if(typeof require=="function"){const t=require("node:path");return(t.default??t).posix}const e=globalThis?.module;if(e&&typeof e.createRequire=="function"){const r=e.createRequire(globalThis.__filename||globalThis.process.cwd())("node:path");return(r.default??r).posix}return F}i($,"getNodePosixSync");const Rt="/",u0=":";function X(e){if(typeof e!="string")throw new TypeError("Path must be a string")}i(X,"_assertString");function Te(e){return e.startsWith(Rt)}i(Te,"_isAbsolute");function Lt(e,t){const r=e.split("/"),n=[];for(let o=0;o<r.length;o++){const a=r[o];!a||a==="."||(a===".."?n.length&&n[n.length-1]!==".."?n.pop():t&&n.push(".."):n.push(a))}return n.join("/")}i(Lt,"_normalizeString");function Bt(e){if(X(e),e==="")return".";const t=Te(e),r=e.endsWith("/");let n=Lt(e,!t);return n===""&&!t&&(n="."),n!==""&&r&&(n+="/"),(t?"/":"")+n}i(Bt,"_normalize");function f0(...e){let t="";for(let r=0;r<e.length;r++){const n=e[r];X(n),n!==""&&(t===""?t=n:t+="/"+n)}return Bt(t)}i(f0,"_join");function je(...e){let t="",r=!1;for(let o=e.length-1;o>=0;o--){const a=e[o];if(a!==void 0&&(X(a),a!==""&&(t=a+"/"+t,a.startsWith("/")))){r=!0;break}}r||(t="/"+t,r=!0);const n=Lt(t,!1);return(r?"/":"")+n||(r?"/":".")}i(je,"_resolve");function p0(e,t){if(X(e),X(t),e===t||(e=je(e),t=je(t),e===t))return"";const r=e.slice(1).split("/").filter(Boolean),n=t.slice(1).split("/").filter(Boolean);let o=0;const a=Math.min(r.length,n.length);for(;o<a&&r[o]===n[o];o++);const s=r.slice(o).map(()=>".."),l=n.slice(o);return s.concat(l).join("/")||""}i(p0,"_relative");function zt(e){if(X(e),e.length===0)return".";const t=Te(e),r=e.endsWith("/")?e.length-1:e.length;let n=-1;for(let o=r-1;o>=0;--o)if(e.charCodeAt(o)===47){n=o;break}return n===-1?t?"/":".":t&&n===0?"/":e.slice(0,n)}i(zt,"_dirname");function jt(e,t=""){if(X(e),t!==void 0&&typeof t!="string")throw new TypeError("ext must be a string");let r=e.length;if(r===0)return"";for(;r>0&&e.charCodeAt(r-1)===47;)r--;if(r===0)return"/";let n=0;for(let a=r-1;a>=0;--a)if(e.charCodeAt(a)===47){n=a+1;break}let o=e.slice(n,r);return t&&o.endsWith(t)&&t!==""&&t!==o&&(o=o.slice(0,o.length-t.length)),o}i(jt,"_basename");function Ut(e){X(e);let t=-1,r=0,n=-1,o=0;for(let a=e.length-1;a>=0;--a){const s=e.charCodeAt(a);if(s===47){if(n!==-1){r=a+1;break}continue}n===-1&&(n=a+1),s===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||n===-1||o===0||t===r?"":e.slice(t,n)}i(Ut,"_extname");function m0(e){X(e);const t=Te(e)?"/":"",r=zt(e),n=jt(e),o=Ut(n),a=o?n.slice(0,n.length-o.length):n;return{root:t,dir:r,base:n,ext:o,name:a}}i(m0,"_parse");function h0(e){const t=e.dir||e.root||"",r=e.base||(e.name||"")+(e.ext||"");return t?t.endsWith("/")?t+r:t+"/"+r:r||"."}i(h0,"_format");function x0(e){return e}i(x0,"_toNamespacedPath");const F={sep:Rt,delimiter:u0,normalize:Bt,join:f0,resolve:je,isAbsolute:Te,relative:p0,dirname:zt,basename:jt,extname:Ut,parse:m0,format:h0,toNamespacedPath:x0,posix:null,win32:null};F.posix=F;const Pe={get sep(){return M?$().sep:F.sep},get delimiter(){return M?$().delimiter:F.delimiter},normalize:i((...e)=>M?$().normalize(...e):F.normalize(...e),"normalize"),join:i((...e)=>M?$().join(...e):F.join(...e),"join"),resolve:i((...e)=>M?$().resolve(...e):F.resolve(...e),"resolve"),isAbsolute:i((...e)=>M?$().isAbsolute(...e):F.isAbsolute(...e),"isAbsolute"),relative:i((...e)=>M?$().relative(...e):F.relative(...e),"relative"),dirname:i((...e)=>M?$().dirname(...e):F.dirname(...e),"dirname"),basename:i((...e)=>M?$().basename(...e):F.basename(...e),"basename"),extname:i((...e)=>M?$().extname(...e):F.extname(...e),"extname"),parse:i((...e)=>M?$().parse(...e):F.parse(...e),"parse"),format:i((...e)=>M?$().format(...e):F.format(...e),"format"),toNamespacedPath:i((...e)=>M?$().toNamespacedPath(...e):F.toNamespacedPath(...e),"toNamespacedPath"),posix:null,win32:null};Pe.posix=Pe;const g0=new Proxy({},{get(){throw new Error("POSIX-only path module: use the named export `posix` with your VFS.")}});Pe.win32=g0;const z=Pe,$e=.01,ut="src/tests/fixtures/sketchSolverTopology";function B(e,t){if(!e)throw new Error(t)}i(B,"assert$1");function be(e,t){const r=e.points.find(n=>Number(n.id)===Number(t));if(!r)throw new Error(`Point ${t} not found`);return r}i(be,"getPoint$1");function v0(e,t){const r=e.constraints.find(n=>Number(n.id)===Number(t));if(!r)throw new Error(`Constraint ${t} not found`);return r}i(v0,"getConstraint$1");function ft(e,t,r){const n=be(e,t),o=be(e,r);return Math.hypot(o.x-n.x,o.y-n.y)}i(ft,"dist$1");function pt(e,t){const r=t.map(o=>be(e,o));let n=0;for(let o=0;o<r.length;o++){const a=r[o],s=r[(o+1)%r.length];n+=a.x*s.y-s.x*a.y}return n*.5}i(pt,"signedArea$1");function mt(e){const t=(e.points||[]).map(o=>Number(o.id)).sort((o,a)=>o-a),r=(e.geometries||[]).map(o=>({id:Number(o.id),type:String(o.type),construction:!!o.construction,points:(o.points||[]).map(a=>Number(a))})).sort((o,a)=>o.id-a.id),n=(e.constraints||[]).map(o=>({id:Number(o.id),type:String(o.type),points:(o.points||[]).map(a=>Number(a))})).sort((o,a)=>o.id-a.id);return{pointIds:t,geometries:r,constraints:n}}i(mt,"topologySnapshot$1");function y0(e,t){const r=new Set((e.points||[]).map(n=>Number(n.id)));for(const n of e.geometries||[])for(const o of n.points||[])B(r.has(Number(o)),`${t}: geometry ${n.id} references missing point ${o}`);for(const n of e.constraints||[])for(const o of n.points||[])B(r.has(Number(o)),`${t}: constraint ${n.id} references missing point ${o}`)}i(y0,"assertTopologyIntegrity$1");function w0(e,t="fixture"){const r=String(e||"").trim();return r&&r.toLowerCase().replace(/[^a-z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||t}i(w0,"sanitizeName");function Ce(e,t,r,n){if(!Number.isFinite(e)||!Number.isFinite(t)||Math.abs(e-t)>r)throw new Error(`${n}. Expected ${t}, got ${e}`)}i(Ce,"assertNear$1");function _0(e,t={}){if(typeof e!="string"||!e.trim())return null;const r=Object.keys(t||{}),n=r.map(o=>Number(t[o]));if(!n.every(o=>Number.isFinite(o)))return null;try{const a=Function(...r,`"use strict"; return (${e});`)(...n),s=Number(a);return Number.isFinite(s)?s:null}catch{return null}}i(_0,"evaluateExpressionWithVars");function Wt(e,{maxPasses:t=8,stopWhenConstraintsClear:r=!0}={}){const n=Math.max(1,Number(t)||1);let o=null;for(let a=0;a<n;a++){e.solveSketch("full");const s=e.sketchObject,l=JSON.stringify(s?.points||[]),c=Array.isArray(s?.constraints)?s.constraints.some(d=>typeof d?.error=="string"&&d.error.length>0):!1;if(r&&!c||l===o)break;o=l}}i(Wt,"solveWithSettle");function S0(e,t,r){const n=t&&typeof t=="object"?t:null;if(!n)throw new Error(`${r}: expressionValues edit requires an object`);for(const o of e.sketchObject?.constraints||[]){if(typeof o?.valueExpr!="string"||!o.valueExpr.length)continue;const a=_0(o.valueExpr,n);if(!Number.isFinite(a))continue;const s=o?.type==="⟺"&&o?.displayStyle==="diameter"&&o?.valueExprMode==="diameter";o.value=s?Number(a)*.5:Number(a)}}i(S0,"applyExpressionValuesToConstraints");function E0(e,t,r){for(const n of t||[])if(!(!n||typeof n!="object")){if(Object.prototype.hasOwnProperty.call(n,"expressionValues"))S0(e,n.expressionValues,r);else{const o=Number(n.constraintId),a=Number(n.value);if(!Number.isFinite(o))throw new Error(`${r}: edit has invalid constraintId`);if(!Number.isFinite(a))throw new Error(`${r}: edit for constraint ${o} has invalid value`);const s=v0(e.sketchObject,o);s.value=a}Wt(e,{maxPasses:Number.isFinite(Number(n.maxPasses))?Number(n.maxPasses):8,stopWhenConstraintsClear:n.stopWhenConstraintsClear!==!1})}}i(E0,"applyEdits");function P0({before:e,after:t,expect:r,contextLabel:n}){if(y0(t,n),r?.topologyUnchanged!==!1){const a=JSON.stringify(mt(e)),s=JSON.stringify(mt(t));B(a===s,`${n}: topology changed`)}for(const a of r?.distances||[]){const s=Number(a.a),l=Number(a.b),c=Number(a.value),d=Number.isFinite(Number(a.tol))?Number(a.tol):$e;B(Number.isFinite(s)&&Number.isFinite(l),`${n}: invalid distance pair`),Ce(ft(t,s,l),c,d,`${n}: distance [${s},${l}] mismatch`)}for(const a of r?.anchors||[]){const s=Number(a.pointId),l=Number.isFinite(Number(a.tol))?Number(a.tol):$e,c=be(t,s);Number.isFinite(Number(a.x))&&Ce(c.x,Number(a.x),l,`${n}: anchor ${s} x drift`),Number.isFinite(Number(a.y))&&Ce(c.y,Number(a.y),l,`${n}: anchor ${s} y drift`)}for(const a of r?.coincidentPairs||[]){const s=Number(a.a),l=Number(a.b),c=Number.isFinite(Number(a.tol))?Number(a.tol):$e;B(Number.isFinite(s)&&Number.isFinite(l),`${n}: invalid coincident pair`),B(ft(t,s,l)<=c,`${n}: coincident pair [${s},${l}] broke`)}for(const a of r?.orientationLoops||[]){const s=Array.isArray(a?.pointIds)?a.pointIds.map(p=>Number(p)):[];B(s.length>=3,`${n}: orientation loop needs at least 3 points`);const l=Number.isFinite(Number(a.minAbsArea))?Number(a.minAbsArea):1,c=pt(e,s),d=pt(t,s);B(Math.abs(d)>l,`${n}: loop collapsed`),a.preserveSign!==!1&&B(Math.sign(d)===Math.sign(c),`${n}: loop orientation flipped`)}}i(P0,"runExpectations");async function b0(e,t){const n=`sketch fixture ${e?.name||z.basename(t)}`;B(e&&typeof e=="object",`${n}: fixture is not an object`),B(Array.isArray(e.edits),`${n}: missing edits array`);let o=null;if(e.sketch&&typeof e.sketch=="object")o=e.sketch;else if(typeof e.sourcePartFile=="string"&&e.sourcePartFile.trim().length){const c=e.sourcePartFile.trim(),d=await P.promises.readFile(c,"utf8"),p=JSON.parse(d),u=Array.isArray(p?.features)?p.features:[];let f=null;if(e.sourceFeatureId!=null){const m=String(e.sourceFeatureId);f=u.find(h=>h?.type==="S"&&(String(h?.inputParams?.id??"")===m||String(h?.inputParams?.featureID??"")===m))||null}f||(f=u.find(m=>m?.type==="S"&&m?.persistentData?.sketch)||null),o=f?.persistentData?.sketch||null}B(o&&typeof o=="object",`${n}: missing sketch or sourcePartFile sketch`);const a=new $t({sketch:JSON.parse(JSON.stringify(o))});Wt(a,{maxPasses:Number.isFinite(Number(e.initialSolvePasses))?Number(e.initialSolvePasses):4,stopWhenConstraintsClear:!0});const s=JSON.parse(JSON.stringify(a.sketchObject));E0(a,e.edits,n);const l=a.sketchObject;P0({before:s,after:l,expect:e.expect||{},contextLabel:n})}i(b0,"runFixture");async function F0(e){if(!(typeof process<"u"&&process.versions&&process.versions.node))return 0;const t=new Set((e||[]).map(a=>a?._sourceFile).filter(a=>typeof a=="string"&&a.length>0));let r=[];try{r=await P.promises.readdir(ut)}catch{return 0}const n=r.filter(a=>typeof a=="string"&&a.toLowerCase().endsWith(".json")).sort((a,s)=>a.localeCompare(s));let o=0;for(const a of n){const s=z.join(ut,a);if(t.has(s))continue;let l=null;try{const f=await P.promises.readFile(s,"utf8");l=JSON.parse(f)}catch(f){const m=f?.message||String(f);throw new Error(`Failed to read sketch fixture ${s}: ${m}`)}const c=String(a).replace(/\.[^.]+$/,""),p=`test_sketch_solver_fixture_${w0(l?.name||c,`fixture_${o}`)}`,u=i(async function(){await b0(l,s)},"sketchSolverFixtureTest");try{Object.defineProperty(u,"name",{value:p,configurable:!0})}catch{}e.push({test:u,printArtifacts:!1,exportFaces:!1,exportSolids:!1,resetHistory:!0,_sourceFile:s}),t.add(s),o+=1}return o}i(F0,"registerSketchSolverTopologyFixtureTests");async function A0(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution=20;const r=await e.newFeature("P.CU");r.inputParams.sizeX=2,r.inputParams.sizeY=2,r.inputParams.sizeZ=20;const n=await e.newFeature("B");return n.inputParams.targetSolid=r.inputParams.featureID,n.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(A0,"test_boolean_subtract");async function N0(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=10,t.inputParams.sizeY=10,t.inputParams.sizeZ=10;const r=await e.newFeature("P.CU");return r.inputParams.sizeX=10,r.inputParams.sizeY=10,r.inputParams.sizeZ=10,r.inputParams.transform={position:[5,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},r.inputParams.boolean={operation:"UNION",targets:[t.inputParams.featureID]},e}i(N0,"test_boolean_operation_target_name_preserved");async function I0(e){const t=(e?.features||[]).filter(l=>l?.type==="P.CU");if(t.length<2)throw new Error("[boolean target name] Expected at least two primitive cube features.");const r=t[0]?.inputParams?.featureID,n=t[1]?.inputParams?.featureID;if(!r||!n)throw new Error("[boolean target name] Missing feature IDs for cube setup.");const o=(e?.scene?.children||[]).filter(l=>l?.type==="SOLID");if(o.length!==1)throw new Error(`[boolean target name] Expected exactly one solid after union, got ${o.length}.`);const a=o[0];if(String(a?.name||"")!==String(r))throw new Error(`[boolean target name] Expected result name "${r}", got "${String(a?.name||"")}".`);if(e?.scene?.getObjectByName?.(n))throw new Error(`[boolean target name] Tool-named solid "${n}" should have been replaced.`)}i(I0,"afterRun_boolean_operation_target_name_preserved");async function T0(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=20,t.inputParams.sizeY=20,t.inputParams.sizeZ=20;const r=await e.newFeature("CHAMFER");return r.inputParams.edges=[`${t.inputParams.featureID}_PZ`],r.inputParams.distance=3,r.inputParams.inflate=5e-4,r.inputParams.direction="INSET",e}i(T0,"test_Chamfer");function De(e,t){const r=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2];return r*r+n*n+o*o}i(De,"pointDistanceSq");function K(e,t,r=1e-12){if(De(e,t)>r*r)throw new Error(`Expected point ${JSON.stringify(e)} near ${JSON.stringify(t)} (eps=${r})`)}i(K,"assertPointNear");async function D0(){const e=[[0,0,0],[1,.35,0],[2,-.5,0],[3,.45,0],[4,0,0]],t=it(e,{fitStrength:1});if(!Array.isArray(t)||t.length!==e.length)throw new Error("Curve fit should return one output point per input point.");if(K(t[0],e[0],1e-12),K(t[t.length-1],e[e.length-1],1e-12),qe(e,t))throw new Error("Fitted polyline should not locally reverse direction against the source edge.");let r=0;for(let o=1;o<e.length-1;o++)De(e[o],t[o])>1e-12&&r++;if(r<=0)throw new Error("At least one interior point should be snapped to the fitted curve.");const n=it(e,{fitStrength:0});for(let o=0;o<e.length;o++)K(n[o],e[o],1e-12)}i(D0,"test_edge_smooth_curve_fit");function M0(e,t){const r=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[],o=r.length;if(o!==n.length||o<3)return!0;for(let a=0;a<o;a++){const s=(a+1)%o,l=r[a],c=r[s],d=n[a],p=n[s],u=[c[0]-l[0],c[1]-l[1],c[2]-l[2]],f=[p[0]-d[0],p[1]-d[1],p[2]-d[2]],m=Math.hypot(u[0],u[1],u[2]),h=Math.hypot(f[0],f[1],f[2]);if(!(m>1e-12)||!(h>1e-12))continue;if((u[0]*f[0]+u[1]*f[1]+u[2]*f[2])/(m*h)<-1e-6)return!0}return!1}i(M0,"hasLocalBacktrackingAgainstSourceClosed");async function k0(){const e=[[1,0,0],[.45,.95,.02],[-.55,.8,-.03],[-1,0,0],[-.45,-.85,.03],[.55,-.75,-.02]],t=lt(e,{fitStrength:1});if(!Array.isArray(t)||t.length!==e.length)throw new Error("Closed-loop curve fit should return one output point per input point.");if(M0(e,t))throw new Error("Closed-loop fitted polyline should not locally reverse direction.");let r=0;for(let o=0;o<e.length;o++)De(e[o],t[o])>1e-12&&r++;if(r<=0)throw new Error("Closed-loop fit should move at least one loop point.");const n=lt(e,{fitStrength:0});for(let o=0;o<e.length;o++)K(n[o],e[o],1e-12)}i(k0,"test_edge_smooth_curve_fit_closed_loop");async function $0(){const e=[0,0,0,1,0,0,1,1,0,0,1,0],t=[0,1,2,0,2,3],r=new Map;r.set(1,{x:.2,y:.8,z:0,count:1});const n=l0(e,t,r,{minArea2Ratio:.04,minNormalDot:.1,minArea2Abs:1e-24});if((Number(n?.movedVertices)||0)!==1)throw new Error("Constrained edge smoothing should move the target vertex.");if((Number(n?.constrainedVertices)||0)<=0)throw new Error("Constrained edge smoothing should scale back fold-causing targets.");const o=e[3],a=e[4];if(!Number.isFinite(o)||!Number.isFinite(a))throw new Error("Constrained edge smoothing produced invalid coordinates.");if(Math.abs(o-.2)<1e-9&&Math.abs(a-.8)<1e-9)throw new Error("Constrained smoothing should not apply a fold-causing target at full displacement.");const s=i((l,c,d)=>{const p=l*3,u=c*3,f=d*3,m=e[u+0]-e[p+0],h=e[u+1]-e[p+1],x=e[f+0]-e[p+0],v=e[f+1]-e[p+1];return m*v-h*x},"triNormalZ");if(!(s(0,1,2)>0))throw new Error("Primary triangle normal flipped after constrained smoothing.");if(!(s(0,2,3)>0))throw new Error("Adjacent triangle normal flipped after constrained smoothing.")}i($0,"test_edge_smooth_constraints_prevent_triangle_foldback");function Yt(e){const t=Array.isArray(e)?e.map(o=>[o[0],o[1],o[2]]):[],r=[];for(const o of t)r.push(o[0],o[1],o[2]);const n=i((o,a)=>{const s=o.slice(),l=a.map(u=>[u[0],u[1],u[2]]),c={type:"EDGE",name:"MOCK_EDGE_0",userData:{faceA:"FACE_A",faceB:"FACE_B",polylineLocal:l.map(u=>[u[0],u[1],u[2]])},parent:null,parentSolid:null},d={type:"SOLID",name:"MOCK_SOLID",_vertProperties:s,_triVerts:[0,1,2,0,2,3,0,3,4],_triIDs:[0,0,0],_vertKeyToIndex:new Map,_dirty:!1,_faceIndex:null,_manifold:null,traverse(u){typeof u=="function"&&u(c)},visualize(){},_manifoldize(){},getBoundaryEdgePolylines(){return[{name:c.name,faceA:c.userData.faceA,faceB:c.userData.faceB,indices:[0,1,2,3,4],positions:l.map(u=>[u[0],u[1],u[2]]),closedLoop:!1}]},clone(){return n(s,l)}},p={type:"FACE",name:"MOCK_FACE_0",edges:[c],parent:d,parentSolid:d,userData:{faceName:"MOCK_FACE_0"}};return c.parent=d,c.parentSolid=d,d.__testFace=p,d},"createSolid");return n(r,t)}i(Yt,"makeMockSolidFromPolyline");async function C0(){const e=[[0,0,0],[1,.4,0],[2,-.45,0],[3,.35,0],[4,0,0]],t=Yt(e),r=new Ct;r.inputParams={edges:[t],fitStrength:1,id:"EDGE_SMOOTH_SOLID_TEST"};const n=await r.run();if(!n||!Array.isArray(n.added)||n.added.length!==1)throw new Error("EdgeSmoothFeature should add one smoothed solid when selecting a whole solid.");if(!Array.isArray(n.removed)||n.removed.length!==1||n.removed[0]!==t)throw new Error("EdgeSmoothFeature should remove exactly the selected source solid.");const o=n.added[0],a=Array.isArray(o?._vertProperties)?o._vertProperties:[];if(a.length<15)throw new Error("Smoothed solid is missing expected vertex properties.");const s=[];for(let c=0;c<5;c++){const d=c*3;s.push([a[d+0],a[d+1],a[d+2]])}if(K(s[0],e[0],1e-12),K(s[s.length-1],e[e.length-1],1e-12),qe(e,s))throw new Error("Whole-solid smoothing should not create local edge backtracking.");let l=0;for(let c=1;c<e.length-1;c++)De(e[c],s[c])>1e-12&&l++;if(l<=0)throw new Error("Whole-solid smoothing should move at least one interior edge point.");if(!r.persistentData||r.persistentData.selectedSolidCount<1)throw new Error("Feature metadata should record at least one selected solid.")}i(C0,"test_edge_smooth_whole_solid_selection");async function O0(){const e=[[0,0,0],[1,.3,0],[2,-.35,0],[3,.25,0],[4,0,0]],t=Yt(e),r=t.__testFace;if(!r||r.type!=="FACE")throw new Error("Mock setup should provide a face selection target.");const n=new Ct;n.inputParams={edges:[r],fitStrength:1,id:"EDGE_SMOOTH_FACE_TEST"};const o=await n.run();if(!o||!Array.isArray(o.added)||o.added.length!==1)throw new Error("EdgeSmoothFeature should add one smoothed solid when selecting a face.");if(!Array.isArray(o.removed)||o.removed.length!==1||o.removed[0]!==t)throw new Error("EdgeSmoothFeature should remove exactly the source solid for face selection.");const a=o.added[0],s=Array.isArray(a?._vertProperties)?a._vertProperties:[];if(s.length<15)throw new Error("Face-selected smoothing output is missing expected vertex properties.");const l=[];for(let c=0;c<5;c++){const d=c*3;l.push([s[d+0],s[d+1],s[d+2]])}if(K(l[0],e[0],1e-12),K(l[l.length-1],e[e.length-1],1e-12),qe(e,l))throw new Error("Face-selected smoothing should not create local edge backtracking.");if(!n.persistentData||n.persistentData.selectedFaceCount<1)throw new Error("Feature metadata should record at least one selected face.")}i(O0,"test_edge_smooth_face_selection");const Ue=-4,We=15.7,ye=1e-4,R0=i(()=>({points:[{id:0,x:-2,y:-2,fixed:!0},{id:1,x:2,y:-2,fixed:!1},{id:2,x:2,y:2,fixed:!1},{id:3,x:-2,y:2,fixed:!1}],geometries:[{id:100,type:"line",points:[0,1],construction:!1},{id:101,type:"line",points:[1,2],construction:!1},{id:102,type:"line",points:[2,3],construction:!1},{id:103,type:"line",points:[3,0],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeRectSketch$1");function L0(e){const r=e?.geometry?.getAttribute?.("position");if(!r)return[];const n=[],o=new ie;for(let a=0;a<r.count;a++)o.set(r.getX(a),r.getY(a),r.getZ(a)).applyMatrix4(e.matrixWorld),n.push([o.x,o.y,o.z]);return n}i(L0,"collectWorldVerticesFromFaceObject");function ht(e){const t=[];for(const r of Array.isArray(e)?e:[])Array.isArray(r?.p1)&&t.push(r.p1),Array.isArray(r?.p2)&&t.push(r.p2),Array.isArray(r?.p3)&&t.push(r.p3);return t}i(ht,"collectTriangleVertices");function xt(e,t,r){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=0,s=0;for(const l of e){const d=l[0]*t.x+l[1]*t.y+l[2]*t.z-r;d<n&&(n=d),d>o&&(o=d),a+=d,s+=1}return{mean:s?a/s:0,spread:s?o-n:0,count:s}}i(xt,"analyzeProjectedOffsets");async function B0(e){const t=await e.newFeature("P");t.inputParams.orientation="XY";const r=await e.newFeature("S");r.inputParams.sketchPlane=t.inputParams.featureID,r.persistentData.sketch=R0();const n=await e.newFeature("E");return n.inputParams.profile=r.inputParams.featureID,n.inputParams.consumeProfileSketch=!1,n.inputParams.distance=Ue,n.inputParams.distanceBack=We,e}i(B0,"test_extrude_negative_distance_cap_alignment");async function z0(e){const t=e.features.find(h=>h?.type==="E"),r=e.features.find(h=>h?.type==="S");if(!t?.inputParams?.featureID)throw new Error("[extrude-negative] missing extrude feature id");if(!r?.inputParams?.featureID)throw new Error("[extrude-negative] missing sketch feature id");const n=e.scene.getObjectByName(t.inputParams.featureID);if(!n||typeof n.getFaces!="function")throw new Error("[extrude-negative] extrude solid missing from scene");const o=e.scene.getObjectByName(r.inputParams.featureID),a=o?.children?.find?.(h=>h?.type==="FACE")||o?.children?.find?.(h=>h?.userData?.faceName);if(!a||typeof a.getAverageNormal!="function")throw new Error("[extrude-negative] profile face missing from sketch");const s=a.getAverageNormal().clone();if(s.lengthSq()<1e-20)throw new Error("[extrude-negative] profile normal is degenerate");s.normalize();const l=L0(a);if(!l.length)throw new Error("[extrude-negative] profile face has no vertices");const c=l.reduce((h,x)=>h+x[0]*s.x+x[1]*s.y+x[2]*s.z,0)/l.length,d=n.getFaces(!1),p=d.find(h=>String(h?.faceName||"").endsWith("_START")),u=d.find(h=>String(h?.faceName||"").endsWith("_END"));if(!p||!u){const h=d.map(x=>String(x?.faceName||""));throw new Error(`[extrude-negative] missing start/end caps. Faces: ${h.join(", ")}`)}const f=xt(ht(p.triangles),s,c),m=xt(ht(u.triangles),s,c);if(f.count===0||m.count===0)throw new Error("[extrude-negative] cap triangles are empty");if(f.spread>ye)throw new Error(`[extrude-negative] start cap not planar on expected axis (spread=${f.spread})`);if(m.spread>ye)throw new Error(`[extrude-negative] end cap not planar on expected axis (spread=${m.spread})`);if(Math.abs(f.mean- -We)>ye)throw new Error(`[extrude-negative] start cap offset mismatch: got ${f.mean}, expected ${-We}`);if(Math.abs(m.mean-Ue)>ye)throw new Error(`[extrude-negative] end cap offset mismatch: got ${m.mean}, expected ${Ue}`)}i(z0,"afterRun_extrude_negative_distance_cap_alignment");async function j0(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution=20;const r=await e.newFeature("E");return r.inputParams.profile=`${t.inputParams.featureID}_T`,r.inputParams.distance=0,r.inputParams.distanceBack=5,r.inputParams.boolean={targets:[t.inputParams.featureID],operation:"UNION"},e}i(j0,"test_ExtrudeFace");async function U0(e){const t=await e.newFeature("P.CY");t.inputParams.radius=5,t.inputParams.height=10,t.inputParams.resolution=48;const r=await e.newFeature("F");return r.inputParams.edges=[`${t.inputParams.featureID}_T`],r.inputParams.radius=1,r.inputParams.inflate=.1,r.inputParams.direction="INSET",e}i(U0,"test_Fillet");const W0="src/tests/partFiles/fillet_angle_test.BREP.json";async function Y0(e){const t=await P.promises.readFile(W0,"utf8");return await e.reset(),await e.fromJSON(t),e.expressions=`//Examples:
|
|
4
4
|
angle = 35;`,e.currentHistoryStepId="E2",e}i(Y0,"test_fillet_angle");function gt(e,t){const r=e?.faces?.[t];return r?.name?r.name:t===0?e?.userData?.faceA||null:t===1&&e?.userData?.faceB||null}i(gt,"getFaceName");function vt(e,t,r){if(!Array.isArray(e)||e.length===0)return{max:0,avg:0,count:0};let n=0,o=0,a=0;for(const l of e){if(!l)continue;const c=c0(t,l,null,r);if(!c)continue;const d=l.x-c.x,p=l.y-c.y,u=l.z-c.z,f=Math.hypot(d,p,u);Number.isFinite(f)&&(f>n&&(n=f),o+=f,a++)}const s=a?o/a:0;return{max:n,avg:s,count:a}}i(vt,"maxProjectionDistance");async function J0(e){const t=e.features.find(v=>v?.type==="F");if(!t)throw new Error("Fillet feature missing from part file.");const n=(Array.isArray(t.inputParams?.edges)?t.inputParams.edges:[]).find(v=>typeof v=="string")||null;if(!n)throw new Error("Fillet edge name not found in test part file.");const o=e.getObjectByName(n);if(!o)throw new Error(`Edge object "${n}" not found after extrude.`);const a=Number(t.inputParams?.radius)||2,s=String(t.inputParams?.direction||"INSET").toUpperCase(),l=Ot(o,a,s);if(!l||!Array.isArray(l.tangentA)||!Array.isArray(l.tangentB))throw new Error("computeFilletCenterline did not return tangent polylines.");const c=gt(o,0),d=gt(o,1),p=o.parentSolid||o.parent;if(!p||!c||!d)throw new Error("Edge faces could not be resolved for tangent validation.");const u=p.getFace(c),f=p.getFace(d);if(!Array.isArray(u)||!u.length||!Array.isArray(f)||!f.length)throw new Error("Face triangle data missing for tangent validation.");const m=vt(l.tangentA,u,c),h=vt(l.tangentB,f,d),x=Math.max(.001,a*.02);if(m.max>x||h.max>x){const v=["Tangent projection error too large (angle=35).",`FaceA max=${m.max.toFixed(6)} avg=${m.avg.toFixed(6)} count=${m.count}`,`FaceB max=${h.max.toFixed(6)} avg=${h.avg.toFixed(6)} count=${h.count}`,`tol=${x}`].join(" ");throw new Error(v)}console.log(`✓ Fillet angle test passed: maxA=${m.max.toFixed(6)} maxB=${h.max.toFixed(6)} tol=${x}`)}i(J0,"afterRun_fillet_angle");const V0="src/tests/partFiles/fillet_test.BREP.json";async function X0(e){const t=await P.promises.readFile(V0,"utf8");return await e.reset(),await e.fromJSON(t),e.currentHistoryStepId="E7",e}i(X0,"test_fillet_edge_degenerate_segment");function G0(e){const t=[];if(!Array.isArray(e))return t;for(let r=0;r<e.length-1;r++){const n=e[r],o=e[r+1];if(!n||!o)continue;const a=Math.hypot(o.x-n.x,o.y-n.y,o.z-n.z);Number.isFinite(a)&&t.push(a)}return t}i(G0,"segmentLengths");function Z0(e,t){const r=Math.min(Array.isArray(e)?e.length:0,Array.isArray(t)?t.length:0);let n=0;for(let o=0;o<r-1;o++){const a=e[o],s=e[o+1],l=t[o],c=t[o+1];if(!a||!s||!l||!c)continue;const d=s.x-a.x,p=s.y-a.y,u=s.z-a.z,f=c.x-l.x,m=c.y-l.y,h=c.z-l.z,x=Math.hypot(d,p,u),v=Math.hypot(f,m,h);if(!(x>1e-12)||!(v>1e-12))continue;(d*f+p*m+u*h)/(x*v)<-1e-6&&n++}return n}i(Z0,"countBackwardSegments");function K0(e,t){const r=Math.min(Array.isArray(e)?e.length:0,Array.isArray(t)?t.length:0),n=[];for(let o=0;o<r;o++){const a=e[o],s=t[o];if(!a||!s)continue;const l=Math.hypot(a.x-s.x,a.y-s.y,a.z-s.z);Number.isFinite(l)&&n.push(l)}return n.length?{min:Math.min(...n),max:Math.max(...n),count:n.length}:null}i(K0,"centerlineDistanceRange");async function q0(e){const t=e.features.find(m=>m?.type==="F");if(!t)throw new Error("Fillet feature missing from part file.");const r=Array.isArray(t.inputParams?.edges)?t.inputParams.edges[0]:null;if(!r)throw new Error("Fillet edge reference missing from part file.");const n=typeof r=="object"?r:e.getObjectByName(String(r));if(!n)throw new Error(`Fillet source edge not found: ${String(r)}`);const o=Number(t.inputParams?.radius)||1,a=Ot(n,o,"INSET");if(!a||!Array.isArray(a.points)||!Array.isArray(a.edge)||a.edge.length<2)throw new Error("computeFilletCenterline returned invalid edge samples.");const s=G0(a.edge);if(!s.length)throw new Error("Fillet edge samples have no measurable segments.");const l=Math.max(...s),c=Math.max(1e-6,l*1e-5),d=s.filter(m=>m<c);if(d.length>0)throw new Error(`Fillet edge samples contain near-zero segments (tol=${c}, tiny=${d.map(m=>m.toExponential(6)).join(", ")})`);const p=Z0(a.points,a.edge);if(p>0)throw new Error(`Fillet edge samples backtrack against the centerline on ${p} segment(s).`);const u=K0(a.points,a.edge);if(!u)throw new Error("Failed to compute centerline-edge distance range.");const f=2.1;if(u.max>u.min*f)throw new Error(`Fillet centerline has endpoint distance outlier (min=${u.min}, max=${u.max}, allowedRatio=${f})`);console.log(`✓ Fillet degenerate-edge test passed: segments=${s.length}, tinyTol=${c.toExponential(3)}, distMin=${u.min.toExponential(3)}, distMax=${u.max.toExponential(3)}`)}i(q0,"afterRun_fillet_edge_degenerate_segment");async function Q0(e){const t=await e.newFeature("P.CU");t.inputParams.width=10,t.inputParams.height=10,t.inputParams.depth=10;const r=await e.newFeature("F");return r.inputParams.edges=[`${t.inputParams.featureID}_NX|${t.inputParams.featureID}_NY[0]`],r.inputParams.radius=.5,r.inputParams.inflate=.1,r.inputParams.direction="INSET",r.inputParams.smoothGeneratedEdges=!0,e}i(Q0,"test_Fillet_NonClosed");async function H0(e){const t=e.features.find(a=>a?.type==="F");if(!t)throw new Error("Fillet feature missing from history");const r=t?.persistentData?.edgeSmoothing;if(!r||!Number.isFinite(Number(r.consideredEdges)))throw new Error("Fillet feature should record edge-smoothing statistics.");if((Number(r.consideredEdges)||0)<=0)throw new Error("Fillet edge smoothing should consider at least one generated edge.");if(!Number.isFinite(Number(r.smoothStrength)))throw new Error("Fillet edge smoothing should report the localized smoothing strength.");if(!Number.isFinite(Number(r.constrainedVertices))||!Number.isFinite(Number(r.rejectedVertices)))throw new Error("Fillet edge smoothing should report constrained and rejected vertex counts.");const n=(e.scene?.children||[]).find(a=>a?.owningFeatureID===t.inputParams.featureID);if(!n)throw new Error("Fillet group not found in scene");let o=0;if(n.traverse(a=>{a?.type==="SOLID"&&o++}),o===0)throw new Error("Fillet feature should produce at least one solid");console.log(`✓ Non-closed fillet test passed: ${o} solid(s) created`),console.log("✓ Tube centerline extended at both ends for non-closed loop")}i(H0,"afterRun_Fillet_NonClosed");async function er(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution="128";const r=await e.newFeature("P.CU");r.inputParams.sizeX=5,r.inputParams.sizeY=2,r.inputParams.sizeZ=10,r.inputParams.boolean.targets=[t.inputParams.featureID],r.inputParams.boolean.operation="UNION";const n=await e.newFeature("F");n.inputParams.edges=[`${t.inputParams.featureID}_S|${r.inputParams.featureID}_PY[0]`],n.inputParams.radius=1,n.inputParams.inflate=.1,n.inputParams.direction="AUTO",n.inputParams.debug="NONE";const o=await e.newFeature("F");return o.inputParams.edges=[`${t.inputParams.featureID}_S|${t.inputParams.featureID}_T[0]`],o.inputParams.radius=1,o.inputParams.inflate=.1,o.inputParams.direction="AUTO",o.inputParams.debug="NONE",e}i(er,"test_filletsMoreDifficult");async function tr(e){return er(e)}i(tr,"test_fillets_more_dificult");async function rr(e){await e.newFeature("P.CU")}i(rr,"test_history_expand_does_not_dirty");async function nr(e){const t=Array.isArray(e?.features)?e.features[0]:null;if(!t)throw new Error("Expand-state dirty test requires one feature in history.");const r=Number(t.timestamp);if(!Number.isFinite(r))throw new Error("Feature timestamp missing after initial run.");const n=t.lastRun;if(!n||n.ok!==!0)throw new Error("Feature lastRun state missing after initial run.");if(t.inputParams=t.inputParams||{},t.inputParams.__open=!0,await new Promise(o=>setTimeout(o,5)),await e.runHistory(),Number(t.timestamp)!==r)throw new Error("Expanding a feature should not mark it dirty or rerun.");if(t.lastRun!==n)throw new Error("Expanding a feature should not replace lastRun metadata.");if(t.inputParams.__open=!1,await new Promise(o=>setTimeout(o,5)),await e.runHistory(),Number(t.timestamp)!==r)throw new Error("Collapsing a feature should not mark it dirty or rerun.");if(t.lastRun!==n)throw new Error("Collapsing a feature should not replace lastRun metadata.")}i(nr,"afterRun_history_expand_does_not_dirty");const Oe=i((e,t,r,n,o=100)=>({points:[{id:0,x:e,y:t,fixed:!0},{id:1,x:r,y:t,fixed:!1},{id:2,x:r,y:n,fixed:!1},{id:3,x:e,y:n,fixed:!1}],geometries:[{id:o+0,type:"line",points:[0,1],construction:!1},{id:o+1,type:"line",points:[1,2],construction:!1},{id:o+2,type:"line",points:[2,3],construction:!1},{id:o+3,type:"line",points:[3,0],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeRectSketch"),or=i((e,t,r,n,o=200)=>({points:[{id:0,x:e,y:t,fixed:!0},{id:1,x:r,y:n,fixed:!1}],geometries:[{id:o,type:"line",points:[0,1],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeLineSketch");async function ar(e){const t=await e.newFeature("D");t.inputParams.transform={position:[1,2,3],rotationEuler:[0,30,0],scale:[1,1,1]};const r=await e.newFeature("SP");r.persistentData.spline={points:[{id:"p0",position:[0,0,0],forwardDistance:1,backwardDistance:1,flipDirection:!1},{id:"p1",position:[5,2,0],forwardDistance:1,backwardDistance:1,flipDirection:!1},{id:"p2",position:[10,0,0],forwardDistance:1,backwardDistance:1,flipDirection:!1}]};const n=await e.newFeature("HX");n.inputParams.radius=2,n.inputParams.endRadius=1.5,n.inputParams.height=8,n.inputParams.turns=2,n.inputParams.resolution=32;const o=await e.newFeature("P");o.inputParams.orientation="XY";const a=await e.newFeature("P");a.inputParams.orientation="XY",a.inputParams.offset_distance=5;const s=await e.newFeature("S");s.inputParams.sketchPlane=o.inputParams.featureID,s.persistentData.sketch=Oe(0,0,10,10,100);const l=await e.newFeature("S");l.inputParams.sketchPlane=a.inputParams.featureID,l.persistentData.sketch=Oe(2,2,8,8,200);const c=await e.newFeature("LOFT");c.inputParams.profiles=[s.inputParams.featureID,l.inputParams.featureID];const d=await e.newFeature("S");d.inputParams.sketchPlane=o.inputParams.featureID,d.persistentData.sketch=or(0,-5,0,5,300);const p=`${d.inputParams.featureID}:G300`,u=await e.newFeature("S");u.inputParams.sketchPlane=o.inputParams.featureID,u.persistentData.sketch=Oe(4,-2,7,2,400);const f=await e.newFeature("R");f.inputParams.profile=u.inputParams.featureID,f.inputParams.axis=p,f.inputParams.angle=180,f.inputParams.resolution=32;const m=await e.newFeature("P.CU"),h=await e.newFeature("RM");h.inputParams.targetSolid=m.inputParams.featureID,h.inputParams.mode="Simplify",h.inputParams.tolerance=.05;const x=await e.newFeature("P.CU"),v=await e.newFeature("XFORM");v.inputParams.solids=[x.inputParams.featureID],v.inputParams.translate=[2,0,0],v.inputParams.rotateEulerDeg=[0,0,45],v.inputParams.copy=!0;const g=await e.newFeature("P.CU"),y=await e.newFeature("OVL");y.inputParams.targetSolid=g.inputParams.featureID,y.inputParams.distance=5e-4;const _=await e.newFeature("P.CU"),S=await e.newFeature("PATLIN");S.inputParams.solids=[_.inputParams.featureID],S.inputParams.count=3,S.inputParams.offset={position:[3,0,0],rotationEuler:[0,0,0],scale:[1,1,1]};const N=await e.newFeature("P.CU"),T=await e.newFeature("PATRAD");T.inputParams.solids=[N.inputParams.featureID],T.inputParams.axisRef=p,T.inputParams.count=4,T.inputParams.totalAngleDeg=180;const j=await e.newFeature("P.CU"),I=await e.newFeature("PATTERN");I.inputParams.solids=[j.inputParams.featureID],I.inputParams.mode="LINEAR",I.inputParams.count=2;const U=await e.newFeature("ACOMP");U.inputParams.componentName="missing_component";const G=await e.newFeature("IMAGE");G.inputParams.fileToImport="";const D=await e.newFeature("HEIGHTMAP");return D.inputParams.fileToImport="",e}i(ar,"test_history_features_basic");async function sr(e){const t=i((r,n)=>{const o=e.features.find(l=>l?.type===r);if(!o)throw new Error(`${n} feature missing from history`);const a=o?.inputParams?.featureID;if(!a)throw new Error(`${n} feature missing featureID`);if(!e.scene.getObjectByName(a))throw new Error(`${n} object not found in scene`)},"requireFeatureObject");t("D","Datium"),t("SP","Spline"),t("HX","Helix"),t("LOFT","Loft"),t("R","Revolve")}i(sr,"afterRun_history_features_basic");const w=12,Qe=2,Jt=6,Vt=90,ir=6,Xt=6,Ye=3,Gt=7,lr=1e-6;function xe(e,t){const r=[{id:0,x:0,y:0,fixed:!0},...t.map((n,o)=>({id:o+1,x:n[0],y:n[1],fixed:!1}))];e.persistentData.sketch={points:r,geometries:[],constraints:[{id:0,type:"⏚",points:[0]}]}}i(xe,"buildSketchWithPoints");function ge(e){return e.features.find(t=>t?.type==="H")||null}i(ge,"findHoleFeature");function He(e){let t=0;for(const r of e){const n=r?._faceMetadata;if(n instanceof Map)for(const o of n.values())o?.hole&&t++}return t}i(He,"countHoleMetadata");function et(e){return(e.scene?.children||[]).filter(r=>r?.type==="SOLID")[0]||null}i(et,"getPrimarySolid");function he(e,t,r){if(!Number.isFinite(e)||Math.abs(e-t)>lr)throw new Error(`${r} expected ${t}, got ${e}`)}i(he,"expectApprox$1");async function cr(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=w,t.inputParams.sizeY=w,t.inputParams.sizeZ=w;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,xe(n,[[w*.5,w*.5]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="SIMPLE",o.inputParams.diameter=Qe,o.inputParams.throughAll=!0,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(cr,"test_hole_through");async function dr(e){const t=ge(e);if(!t)throw new Error("[hole_through] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_through] No hole records");if(!r[0]?.throughAll)throw new Error("[hole_through] Expected through-all hole record");if(String(r[0]?.type||"").toUpperCase()!=="SIMPLE")throw new Error(`[hole_through] Expected SIMPLE hole, got ${r[0]?.type}`);const n=et(e);if(!n)throw new Error("[hole_through] No solids created");if((n._faceNameToID?.size||0)<=6)throw new Error("[hole_through] Hole did not add faces");if(He([n])===0)throw new Error("[hole_through] No hole face metadata found")}i(dr,"afterRun_hole_through");async function ur(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=w,t.inputParams.sizeY=w,t.inputParams.sizeZ=w;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,xe(n,[[w*.35,w*.35]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="THREADED",o.inputParams.depth=6,o.inputParams.throughAll=!1,o.inputParams.threadStandard="ISO_METRIC",o.inputParams.threadDesignation="M6x1",o.inputParams.threadMode="SYMBOLIC",o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(ur,"test_hole_thread_symbolic");async function fr(e){const t=ge(e);if(!t)throw new Error("[hole_thread_symbolic] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_thread_symbolic] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="THREADED")throw new Error(`[hole_thread_symbolic] Expected THREADED hole, got ${n?.type}`);if(!n?.thread||String(n.thread.mode||"").toUpperCase()!=="SYMBOLIC")throw new Error("[hole_thread_symbolic] Expected symbolic thread metadata")}i(fr,"afterRun_hole_thread_symbolic");async function pr(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=w,t.inputParams.sizeY=w,t.inputParams.sizeZ=w;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,xe(n,[[w*.65,w*.35]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="THREADED",o.inputParams.depth=4,o.inputParams.throughAll=!1,o.inputParams.threadStandard="ISO_METRIC",o.inputParams.threadDesignation="M6x1",o.inputParams.threadMode="MODELED",o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(pr,"test_hole_thread_modeled");async function mr(e){const t=ge(e);if(!t)throw new Error("[hole_thread_modeled] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_thread_modeled] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="THREADED")throw new Error(`[hole_thread_modeled] Expected THREADED hole, got ${n?.type}`);if(!n?.thread||String(n.thread.mode||"").toUpperCase()!=="MODELED")throw new Error("[hole_thread_modeled] Expected modeled thread metadata")}i(mr,"afterRun_hole_thread_modeled");async function hr(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=w,t.inputParams.sizeY=w,t.inputParams.sizeZ=w;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,xe(n,[[w*.25,w*.65]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="COUNTERSINK",o.inputParams.diameter=Qe,o.inputParams.depth=ir,o.inputParams.throughAll=!1,o.inputParams.countersinkDiameter=Jt,o.inputParams.countersinkAngle=Vt,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(hr,"test_hole_countersink");async function xr(e){const t=ge(e);if(!t)throw new Error("[hole_countersink] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_countersink] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="COUNTERSINK")throw new Error(`[hole_countersink] Expected COUNTERSINK hole, got ${n?.type}`);if(n?.throughAll)throw new Error("[hole_countersink] Expected non-through hole");if(!(n?.countersinkHeight>0))throw new Error("[hole_countersink] Expected countersink height > 0");he(n?.countersinkDiameter,Jt,"[hole_countersink] countersink diameter"),he(n?.countersinkAngle,Vt,"[hole_countersink] countersink angle");const o=et(e);if(!o)throw new Error("[hole_countersink] No solids created");if(He([o])===0)throw new Error("[hole_countersink] No hole face metadata found")}i(xr,"afterRun_hole_countersink");async function gr(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=w,t.inputParams.sizeY=w,t.inputParams.sizeZ=w;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,xe(n,[[w*.75,w*.65]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="COUNTERBORE",o.inputParams.diameter=Qe,o.inputParams.depth=Gt,o.inputParams.throughAll=!1,o.inputParams.counterboreDiameter=Xt,o.inputParams.counterboreDepth=Ye,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(gr,"test_hole_counterbore");async function vr(e){const t=ge(e);if(!t)throw new Error("[hole_counterbore] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_counterbore] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="COUNTERBORE")throw new Error(`[hole_counterbore] Expected COUNTERBORE hole, got ${n?.type}`);if(n?.throughAll)throw new Error("[hole_counterbore] Expected non-through hole");he(n?.counterboreDiameter,Xt,"[hole_counterbore] counterbore diameter"),he(n?.counterboreDepth,Ye,"[hole_counterbore] counterbore depth"),he(n?.straightDepth,Gt-Ye,"[hole_counterbore] straight depth");const o=et(e);if(!o)throw new Error("[hole_counterbore] No solids created");if(He([o])===0)throw new Error("[hole_counterbore] No hole face metadata found")}i(vr,"afterRun_hole_counterbore");const Zt="IMPORT3D_DECIMATION_BASELINE",Kt="IMPORT3D_DECIMATION_REDUCED",Je="IMPORT3D_DECIMATION_STABILITY",fe="IMPORT3D_DECIMATION_RESTORE",pe="IMPORT3D_DECIMATION_LEGACY_CACHE",Ee="IMPORT3D_DECIMATION_SNAPSHOT_CLONE_RESILIENCE";function C(e){const t=Number(e);return!Number.isFinite(t)||Math.abs(t)<1e-16?"0":t.toFixed(9)}i(C,"formatNumber$2");function we(e,t,r,n){const o=r[0]-t[0],a=r[1]-t[1],s=r[2]-t[2],l=n[0]-t[0],c=n[1]-t[1],d=n[2]-t[2];let p=a*d-s*c,u=s*l-o*d,f=o*c-a*l;const m=Math.hypot(p,u,f)||1;p/=m,u/=m,f/=m,e.push(` facet normal ${C(p)} ${C(u)} ${C(f)}`),e.push(" outer loop"),e.push(` vertex ${C(t[0])} ${C(t[1])} ${C(t[2])}`),e.push(` vertex ${C(r[0])} ${C(r[1])} ${C(r[2])}`),e.push(` vertex ${C(n[0])} ${C(n[1])} ${C(n[2])}`),e.push(" endloop"),e.push(" endfacet")}i(we,"appendFacet$2");function ve({radius:e=6,height:t=10,segments:r=96}={}){const n=Math.max(24,Number(r)|0),o=Math.max(.1,Number(e)||1),s=Math.max(.1,Number(t)||1)*.5,l=[0,s,0],c=[0,-s,0],d=["solid import3d_decimation_cylinder"];for(let p=0;p<n;p+=1){const u=p/n*Math.PI*2,f=(p+1)/n*Math.PI*2,m=Math.cos(u),h=Math.sin(u),x=Math.cos(f),v=Math.sin(f),g=[o*m,-s,o*h],y=[o*x,-s,o*v],_=[o*m,s,o*h],S=[o*x,s,o*v];we(d,g,y,S),we(d,g,S,_),we(d,l,S,_),we(d,c,g,y)}return d.push("endsolid import3d_decimation_cylinder"),d.join(`
|