@rulecad/cad 0.7.3 → 0.7.5
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 +4 -0
- package/bin/cad.mjs +14 -2
- package/lib/live.mjs +164 -0
- package/lib/optimise.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -369,6 +369,10 @@ with numbers as expressions like an object's (schema: `schemas/problem.schema.js
|
|
|
369
369
|
gives, and draws the layout in `.preview/`. The result is kept, keyed by everything it's made from, so it's only
|
|
370
370
|
worked out again when something it depends on changes.
|
|
371
371
|
|
|
372
|
+
`cad optimise <project>/<problem> --watch [port]` runs it afresh and serves a live view at `http://127.0.0.1:8090/`:
|
|
373
|
+
the densities as they change (a 3D part from three sides), a chart of its compliance and how much it still changes, with a scrubber to look back at any earlier step, its run time and time left, the machine it runs on, and a button that stops the run. It shows the end for ten minutes after the run finishes.
|
|
374
|
+
It listens on this computer only. To watch from elsewhere, reach it through a private network such as Tailscale.
|
|
375
|
+
|
|
372
376
|
A design uses it through a variable of type `problem`, which picks a problem by name:
|
|
373
377
|
|
|
374
378
|
```json
|
package/bin/cad.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import { optimised, readProblem, analysePart, picture, problemFile } from '../li
|
|
|
20
20
|
import { evaluate } from '../lib/rules.mjs';
|
|
21
21
|
import { setVariables, addToAssembly, parseValue } from '../lib/edit.mjs';
|
|
22
22
|
import { threemf, slotOf } from '../lib/threemf.mjs';
|
|
23
|
+
import { liveView } from '../lib/live.mjs';
|
|
23
24
|
import { filaments, slots, linkTo, objectModel, assemblyModel, VIEW } from '../lib/links.mjs';
|
|
24
25
|
|
|
25
26
|
// What the print file asks of the AMS: which filament each kind of part prints in
|
|
@@ -48,6 +49,7 @@ const HELP = `cad: JSCAD designs you can trace, check, share and print (rulecad)
|
|
|
48
49
|
cad preview <project>/<object> four views as a PNG in .preview/ (prints the path)
|
|
49
50
|
cad optimise <project>/<problem> the stiffest layout for a problem in the project's problems/ (name:variant for a
|
|
50
51
|
variant): a picture in .preview/, the result kept for designs [--fresh] [--json]
|
|
52
|
+
[--watch [port]: a live view of it at http://127.0.0.1:8090/, with a stop button]
|
|
51
53
|
cad export <project>/<object> a 3MF for Bambu Studio in exports/ [--open: open it in Bambu Studio]
|
|
52
54
|
cad show <project>/<object> the model on display through your show target, with its rules [--ttl 10m]
|
|
53
55
|
cad link <project>/<object> links to open the model in a browser, and to download its STL or 3MF
|
|
@@ -121,8 +123,18 @@ async function optimiseProblem(ref) {
|
|
|
121
123
|
if (bad.length) { report(bad); process.exitCode = 1; return; }
|
|
122
124
|
}
|
|
123
125
|
const live = !opt('json') && process.stderr.isTTY;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
// --watch [port]: the live view, served while it runs (a watched run is always run afresh, so there is something to watch)
|
|
127
|
+
const watch = opt('watch'), view = watch ? await liveView({ port: watch === true ? 8090 : Number(watch), title: `cad optimise ${ref}` }) : null;
|
|
128
|
+
if (view) say(`watching at ${view.url}`);
|
|
129
|
+
let r;
|
|
130
|
+
try {
|
|
131
|
+
r = await optimised(project, name, { fresh: !!opt('fresh') || !!view, onStep: (s) => {
|
|
132
|
+
if (live) process.stderr.write(`\r\x1b[Kstep ${s.step}/${s.steps} compliance ${s.compliance.toPrecision(5)} N·mm change ${s.change.toFixed(3)} sharpness ${s.beta}`);
|
|
133
|
+
if (view) { view.step(s); if (view.stopped()) throw new Error(`stopped from the live view at step ${s.step}`); }
|
|
134
|
+
} });
|
|
135
|
+
} catch (e) { await view?.close(e.message); throw e; } finally { if (live) process.stderr.write('\r\x1b[K'); }
|
|
136
|
+
// The page keeps showing the end for ten minutes (the process waits for it), so a finished run isn't a dead link
|
|
137
|
+
if (view) { view.close(`finished: ${r.steps} steps${r.converged ? '' : ', not settled'}`, { hold: 10 * 60e3 }); say(`the live view shows the result for ten more minutes (Ctrl-C to stop it)`); }
|
|
126
138
|
const p = await readProblem(project, name), cells = r.dim === 3 ? `${r.grid.nx} × ${r.grid.ny} × ${r.grid.nz}` : `${r.grid.nx} × ${r.grid.ny}`;
|
|
127
139
|
const lines = [`${p.material.name}${r.dim === 2 ? `, ${fmt(r.thickness)} mm thick` : ''}: ${r.cases.map((c) => `${c.name} ${sig(c.deflection)} mm (${sig(c.stiffness)} N/mm)`).join(', ')}`,
|
|
128
140
|
`${fmt(r.volume * 100)}% of the space, ${cells} cells of ${fmt(r.grid.h)} mm, ${r.steps} steps${r.converged ? '' : ' (stopped: not settled)'}${r.overhang ? `, printable built ${r.overhang}` : ''}${r.stress ? `, peak stress ${sig(r.stress.peak)} MPa (limit ${sig(r.stress.limit)})` : ''}`];
|
package/lib/live.mjs
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// The live view of an optimisation: `cad optimise <ref> --watch [port]` serves a page that draws the densities as
|
|
2
|
+
// they change, charts the progress and can stop the run. The optimiser runs on the main thread and blocks it, so the
|
|
3
|
+
// server runs in a worker: the main thread posts each step to it, and the page's stop button sets a shared flag the
|
|
4
|
+
// main thread reads between steps.
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import http from 'node:http';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import { Worker, isMainThread, parentPort, workerData } from 'node:worker_threads';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Starts the server; resolves once it listens.
|
|
12
|
+
* @param {{ port?: number, host?: string, title: string }} o host: 127.0.0.1 unless asked (Tailscale's userspace mode
|
|
13
|
+
* forwards to it; plain 0.0.0.0 would open it to the local network)
|
|
14
|
+
* @returns {Promise<{ url: string, step: (s: object) => void, stopped: () => boolean, close: (summary?: string) => Promise<void> }>}
|
|
15
|
+
*/
|
|
16
|
+
export function liveView({ port = 8090, host = '127.0.0.1', title }) {
|
|
17
|
+
const flag = new Int32Array(new SharedArrayBuffer(4));
|
|
18
|
+
const worker = new Worker(new URL(import.meta.url), { workerData: { port, host, title, flag } });
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
worker.once('error', reject);
|
|
21
|
+
worker.once('message', (m) => {
|
|
22
|
+
if (m.error) { worker.terminate(); reject(new Error(`the live view can't listen on ${host}:${port}: ${m.error}`)); return; }
|
|
23
|
+
worker.off('error', reject).on('error', (e) => console.error(`the live view stopped: ${e.message}`));
|
|
24
|
+
resolve({
|
|
25
|
+
url: `http://${host === '0.0.0.0' ? 'localhost' : host}:${m.listening}/`,
|
|
26
|
+
step: (s) => {
|
|
27
|
+
const list = views(s.density, s.grid);
|
|
28
|
+
const { nx, ny, nz, h } = s.grid;
|
|
29
|
+
worker.postMessage({ grid: { nx, ny, nz, h }, step: s.step, steps: s.steps, compliance: s.compliance, change: s.change, beta: s.beta, volume: s.volume, stress: s.stress, views: list }, list.map((v) => v.image.buffer));
|
|
30
|
+
},
|
|
31
|
+
stopped: () => Atomics.load(flag, 0) === 1,
|
|
32
|
+
// hold: keep showing the end for this long (ms), for whoever opens the page late
|
|
33
|
+
close: (summary, { hold = 0 } = {}) => new Promise((done) => { worker.once('exit', () => done()); worker.postMessage({ done: summary ?? 'finished', hold }); }),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Densities as bytes, one per pixel: a 2D layout as it is, a 3D grid as three views, each pixel the densest cell
|
|
40
|
+
// along its line of sight
|
|
41
|
+
function views(d, { nx, ny, nz = 1 }) {
|
|
42
|
+
const view = (name, w, h) => ({ name, w, h, image: new Uint8Array(w * h) });
|
|
43
|
+
const z = view(nz > 1 ? 'along z' : '', nx, ny), y = view('along y', nx, nz), x = view('along x', ny, nz);
|
|
44
|
+
for (let k = 0; k < nz; k++) for (let j = 0; j < ny; j++) for (let i = 0; i < nx; i++) {
|
|
45
|
+
const v = Math.round(d[(k * ny + j) * nx + i] * 255);
|
|
46
|
+
if (v > z.image[j * nx + i]) z.image[j * nx + i] = v;
|
|
47
|
+
if (v > y.image[k * nx + i]) y.image[k * nx + i] = v;
|
|
48
|
+
if (v > x.image[k * ny + j]) x.image[k * ny + j] = v;
|
|
49
|
+
}
|
|
50
|
+
return nz > 1 ? [y, x, z] : [z];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const page = (title) => `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
54
|
+
<title>${title}</title>
|
|
55
|
+
<style>body{font:15px system-ui;background:#111;color:#eee;margin:16px;max-width:900px}canvas{background:#000;border-radius:6px}.chart{width:100%}#views{display:flex;gap:8px;align-items:flex-end}figure{flex:1;min-width:0;margin:0;text-align:center}figure canvas{width:100%;height:40vh;object-fit:contain;background:none}figcaption{color:#aaa;font-size:13px;text-align:center}
|
|
56
|
+
#chart{height:160px;touch-action:none}#scrub{display:flex;gap:8px;align-items:center}#scrub input{flex:1}#live{background:#357}table{border-collapse:collapse;margin:10px 0;width:100%}td{padding:3px 8px 3px 0;vertical-align:top}td:first-child{color:#999;white-space:nowrap;width:1%}button{font:inherit;padding:8px 16px;border-radius:6px;border:0;background:#d33;color:#fff}button:disabled{background:#555}#state{margin:10px 0}</style>
|
|
57
|
+
<h2>${title}</h2><div id="state">waiting for the first step…</div><div id="views"></div><canvas class="chart" id="chart" width="900" height="160"></canvas><div id="scrub"><input type="range" id="at" min="0" max="0" value="0"><button id="live" disabled>Live</button></div><table id="facts"></table>
|
|
58
|
+
<p><button id="stop">Stop the run</button> <span id="note"></span></p>
|
|
59
|
+
<script>
|
|
60
|
+
const views = document.getElementById('views'), facts = document.getElementById('facts'), state = document.getElementById('state'), stop = document.getElementById('stop');
|
|
61
|
+
let history = { compliance: [], change: [] }, about = [], last = null, finished = null, follow = true, shown = 0, newest = null;
|
|
62
|
+
const at = document.getElementById('at'), live = document.getElementById('live'), chart = document.getElementById('chart');
|
|
63
|
+
const fig = (n) => Number(n.toPrecision(3)), esc = (t) => String(t).replace(/[&<]/g, (c) => c === '&' ? '&' : '<');
|
|
64
|
+
const time = (s) => s == null ? '…' : s < 60 ? s.toFixed(s < 10 ? 1 : 0) + ' s' : Math.floor(s / 60) + ' min ' + Math.round(s % 60) + ' s';
|
|
65
|
+
function table() {
|
|
66
|
+
const f = last, rows = f ? [
|
|
67
|
+
['Step', f.step + ' of at most ' + f.steps + (follow ? '' : ' (looking back: ' + history.compliance.length + ' so far)')],
|
|
68
|
+
['Run time', time(f.elapsed)], ['Per step', time(f.perStep) + ' (the last ten)'],
|
|
69
|
+
...(finished || !follow ? [] : [['Time left', 'at most ' + time(f.left) + ' (it may settle sooner)']]),
|
|
70
|
+
['Compliance', fig(f.compliance) + ' N·mm, from ' + fig(history.compliance[0]) + (history.compliance[0] > f.compliance ? ': ' + fig(history.compliance[0] / f.compliance) + ' times as stiff' : '')],
|
|
71
|
+
['Change', fig(f.change) + ' (the most any cell moved this step)'], ['Sharpness', f.beta],
|
|
72
|
+
...(f.volume != null ? [['Material', fig(f.volume * 100) + '% of the space']] : []), ...(f.stress != null ? [['Peak stress', fig(f.stress) + ' MPa']] : []),
|
|
73
|
+
['Cells', [f.grid.nx, f.grid.ny, f.grid.nz].filter(Boolean).join(' × ') + (f.grid.h ? ' of ' + f.grid.h + ' mm' : '') + ' (' + (f.grid.nx * f.grid.ny * (f.grid.nz || 1)).toLocaleString('en-GB') + ')'],
|
|
74
|
+
] : [];
|
|
75
|
+
facts.innerHTML = [...(finished ? [['Result', finished]] : []), ...rows, ...about].map(([k, v]) => '<tr><td>' + esc(k) + '</td><td>' + esc(v) + '</td></tr>').join('');
|
|
76
|
+
}
|
|
77
|
+
function draw(f) {
|
|
78
|
+
if (views.children.length !== f.views.length) views.innerHTML = f.views.map((v) => '<figure><canvas></canvas><figcaption>' + v.name + '</figcaption></figure>').join('');
|
|
79
|
+
f.views.forEach((v, n) => {
|
|
80
|
+
const c = views.children[n].firstChild; if (c.width !== v.w) { c.width = v.w; c.height = v.h; }
|
|
81
|
+
const ctx = c.getContext('2d'), img = ctx.createImageData(v.w, v.h), d = atob(v.image);
|
|
82
|
+
for (let j = 0; j < v.h; j++) for (let i = 0; i < v.w; i++) { const g = 255 - d.charCodeAt(j * v.w + i), o = ((v.h - 1 - j) * v.w + i) * 4; img.data[o] = img.data[o + 1] = img.data[o + 2] = g; img.data[o + 3] = 255; }
|
|
83
|
+
ctx.putImageData(img, 0, 0);
|
|
84
|
+
});
|
|
85
|
+
last = f; state.textContent = finished ? finished : 'step ' + f.step + ' · ' + time(f.elapsed);
|
|
86
|
+
}
|
|
87
|
+
// Both against step: compliance on the left axis, change on the right on a log scale (it falls by orders of
|
|
88
|
+
// magnitude); the step shown marked
|
|
89
|
+
function plot() {
|
|
90
|
+
const c = chart.getContext('2d'), w = chart.width, h = chart.height, n = history.compliance.length; c.clearRect(0, 0, w, h);
|
|
91
|
+
if (n < 2) return;
|
|
92
|
+
const line = (data, log, colour) => {
|
|
93
|
+
const ys = data.map((v) => log ? Math.log10(Math.max(v, 1e-6)) : v), lo = Math.min(...ys), hi = Math.max(...ys);
|
|
94
|
+
c.strokeStyle = colour; c.lineWidth = 2; c.beginPath();
|
|
95
|
+
ys.forEach((v, k) => { const x = k / (n - 1) * w, y = h - 8 - (v - lo) / (hi - lo || 1) * (h - 28); k ? c.lineTo(x, y) : c.moveTo(x, y); });
|
|
96
|
+
c.stroke();
|
|
97
|
+
};
|
|
98
|
+
line(history.compliance, false, '#6cf'); line(history.change, true, '#fc6');
|
|
99
|
+
const x = shown / (n - 1) * w; c.strokeStyle = '#fff8'; c.lineWidth = 1; c.beginPath(); c.moveTo(x, 0); c.lineTo(x, h); c.stroke();
|
|
100
|
+
c.font = '12px system-ui'; c.fillStyle = '#6cf'; c.fillText('compliance, N·mm: ' + fig(history.compliance[0]) + ' to ' + fig(history.compliance.at(-1)), 8, 14);
|
|
101
|
+
c.fillStyle = '#fc6'; c.textAlign = 'right'; c.fillText('change (log scale): ' + fig(history.change[0]) + ' to ' + fig(history.change.at(-1)), w - 8, 14); c.textAlign = 'left';
|
|
102
|
+
}
|
|
103
|
+
function show(f) { draw(f); plot(); table(); }
|
|
104
|
+
// Scrubbing: any earlier step, fetched when asked for; the newest only while following
|
|
105
|
+
let asked = 0;
|
|
106
|
+
async function lookAt(k) {
|
|
107
|
+
const n = history.compliance.length; k = Math.max(0, Math.min(n - 1, k)); shown = k; at.value = k;
|
|
108
|
+
follow = k === n - 1; live.disabled = follow;
|
|
109
|
+
if (follow && newest) return show(newest);
|
|
110
|
+
const ask = ++asked, f = await (await fetch('frame/' + k)).json();
|
|
111
|
+
if (ask === asked) show(f);
|
|
112
|
+
}
|
|
113
|
+
at.oninput = () => lookAt(Number(at.value));
|
|
114
|
+
live.onclick = () => lookAt(history.compliance.length - 1);
|
|
115
|
+
chart.onpointerdown = chart.onpointermove = (e) => { if (e.type === 'pointermove' && !e.buttons) return; const r = chart.getBoundingClientRect(); lookAt(Math.round((e.clientX - r.left) / r.width * (history.compliance.length - 1))); };
|
|
116
|
+
const events = new EventSource('events');
|
|
117
|
+
events.onmessage = (e) => { const m = JSON.parse(e.data); if (m.about) about = m.about; if (m.history) history = m.history;
|
|
118
|
+
if (m.done) { finished = m.done; stop.disabled = true; events.close(); }
|
|
119
|
+
at.max = Math.max(0, history.compliance.length - 1);
|
|
120
|
+
if (m.frame) newest = m.frame;
|
|
121
|
+
if (follow) { shown = Number(at.max); at.value = shown; if (newest) draw(newest); }
|
|
122
|
+
if (finished) state.textContent = finished;
|
|
123
|
+
plot(); table(); };
|
|
124
|
+
stop.onclick = async () => { stop.disabled = true; await fetch('stop', { method: 'POST' }); document.getElementById('note').textContent = 'stopping after this step'; };
|
|
125
|
+
</script>`;
|
|
126
|
+
|
|
127
|
+
if (!isMainThread && workerData?.flag) {
|
|
128
|
+
const { port, host, title, flag } = workerData, clients = new Set(), history = { compliance: [], change: [] }, frames = [], times = [], t0 = Date.now();
|
|
129
|
+
// What a reader might want beside the numbers of each step: what ran it, where and when
|
|
130
|
+
const cpus = os.cpus(), about = [['Started', new Date(t0).toLocaleString('en-GB')], ['Machine', `${cpus[0]?.model.trim() ?? os.arch()}, ${cpus.length} cores, ${Math.round(os.totalmem() / 2 ** 30)} GB`],
|
|
131
|
+
['Software', `@rulecad/cad ${JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version}, Node ${process.versions.node}, ${os.type()}`]];
|
|
132
|
+
let latest = null, sent = null, done = null;
|
|
133
|
+
const send = (res, m) => res.write(`data: ${JSON.stringify(m)}\n\n`);
|
|
134
|
+
const frame = (f) => ({ ...f, views: f.views.map((v) => ({ ...v, image: Buffer.from(v.image).toString('base64') })) });
|
|
135
|
+
const server = http.createServer((req, res) => {
|
|
136
|
+
if (req.url === '/events') {
|
|
137
|
+
res.writeHead(200, { 'content-type': 'text/event-stream', 'cache-control': 'no-cache' });
|
|
138
|
+
send(res, { about, history, ...(latest ? { frame: latest } : {}), ...(done ? { done } : {}) });
|
|
139
|
+
clients.add(res); req.on('close', () => clients.delete(res));
|
|
140
|
+
// Any earlier step, for the scrubber: every one is kept (about a byte a pixel of its views)
|
|
141
|
+
} else if (req.url.startsWith('/frame/') && frames[Number(req.url.slice(7))]) { res.writeHead(200, { 'content-type': 'application/json' }); res.end(JSON.stringify(frames[Number(req.url.slice(7))]));
|
|
142
|
+
} else if (req.url === '/stop' && req.method === 'POST') { Atomics.store(flag, 0, 1); res.end('stopping'); }
|
|
143
|
+
else if (req.url === '/') { res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' }); res.end(page(title)); }
|
|
144
|
+
else { res.writeHead(404); res.end(); }
|
|
145
|
+
});
|
|
146
|
+
// At most four frames a second, whatever the optimiser's pace
|
|
147
|
+
const tick = setInterval(() => { if (latest && latest !== sent) { sent = latest; const m = { history, frame: latest }; for (const c of clients) send(c, m); } }, 250);
|
|
148
|
+
parentPort.on('message', (m) => {
|
|
149
|
+
if (m.done) {
|
|
150
|
+
done = m.done; clearInterval(tick);
|
|
151
|
+
for (const c of clients) { send(c, { history, ...(latest ? { frame: latest } : {}), done }); c.end(); }
|
|
152
|
+
const shut = () => { server.close(); server.closeAllConnections(); parentPort.close(); };
|
|
153
|
+
if (m.hold) setTimeout(shut, m.hold); else shut();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// Timing: the mean of the last ten steps, and what's left at that pace (at most: it may settle sooner)
|
|
157
|
+
const now = Date.now(); times.push(now);
|
|
158
|
+
const last = times.slice(-11), perStep = last.length > 1 ? (last.at(-1) - last[0]) / (last.length - 1) / 1000 : null;
|
|
159
|
+
latest = frame({ ...m, elapsed: (now - t0) / 1000, perStep, left: perStep && (m.steps - m.step) * perStep }); frames.push(latest);
|
|
160
|
+
history.compliance.push(m.compliance); history.change.push(m.change);
|
|
161
|
+
});
|
|
162
|
+
server.once('error', (e) => parentPort.postMessage({ error: e.code || e.message }));
|
|
163
|
+
server.listen(port, host, () => parentPort.postMessage({ listening: server.address().port }));
|
|
164
|
+
}
|
package/lib/optimise.mjs
CHANGED
|
@@ -93,7 +93,7 @@ export async function optimised(project, ref, { onStep, fresh = false } = {}) {
|
|
|
93
93
|
const hash = digest([VERSION, r.problem, r.outline, topopt, source('@rulecad/fea')]), file = paths.cache('optimise', `${hash}.json`);
|
|
94
94
|
if (!fresh && !process.env.CAD_NO_CACHE && host.exists(file)) return { ...JSON.parse(host.readText(file)), cached: true };
|
|
95
95
|
const spec = discretise(r.problem), densities = paths.cache('densities', `${digest([VERSION, r.problem, solver, source('@rulecad/fea')])}.json`);
|
|
96
|
-
const o = !fresh && !process.env.CAD_NO_CACHE && host.exists(densities) ? (({ density, ...x }) => ({ ...x, density: Float64Array.from(density) }))(JSON.parse(host.readText(densities))) : optimise(spec, { onStep });
|
|
96
|
+
const o = !fresh && !process.env.CAD_NO_CACHE && host.exists(densities) ? (({ density, ...x }) => ({ ...x, density: Float64Array.from(density) }))(JSON.parse(host.readText(densities))) : optimise(spec, { onStep: onStep && ((st) => onStep({ ...st, grid: spec.grid })) });
|
|
97
97
|
if (!host.exists(densities)) host.writeText(densities, JSON.stringify({ ...o, density: Array.from(o.density) }));
|
|
98
98
|
// Regions as data: a part's triangles are named, not copied
|
|
99
99
|
const named = (list) => list.map(({ triangles, ...x }) => x);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/cad",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "The cad command: JSCAD designs from traceable rules, checked for printing and fit, versioned by what fits, shared as links and exported as Bambu 3MF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|