@rulecad/cad 0.8.0 → 0.9.0
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/AGENTS.md +24 -10
- package/CHANGELOG.md +404 -0
- package/EXAMPLES.md +40 -38
- package/README.md +193 -67
- package/TUTORIAL.md +2 -2
- package/bin/cad.mjs +2250 -512
- package/lib/animate.mjs +173 -49
- package/lib/assembly.mjs +1847 -434
- package/lib/beams.mjs +256 -52
- package/lib/belts.mjs +66 -15
- package/lib/board-work.mjs +12 -0
- package/lib/bought.mjs +309 -53
- package/lib/buildpage.mjs +179 -29
- package/lib/carried.mjs +201 -0
- package/lib/clone.mjs +194 -42
- package/lib/design.mjs +649 -121
- package/lib/drive.mjs +187 -63
- package/lib/edit.mjs +899 -191
- package/lib/errors.mjs +16 -3
- package/lib/explain.mjs +62 -13
- package/lib/fasten.mjs +2702 -507
- package/lib/fittings.mjs +715 -121
- package/lib/fixings.mjs +21 -9
- package/lib/framebuild.mjs +790 -175
- package/lib/framecheck.mjs +1901 -368
- package/lib/framegen.mjs +100 -22
- package/lib/frameheat.mjs +225 -42
- package/lib/frameprint.mjs +513 -108
- package/lib/frames.mjs +81 -17
- package/lib/framesize.mjs +792 -120
- package/lib/frametip.mjs +235 -0
- package/lib/gait.mjs +135 -23
- package/lib/grip.mjs +62 -13
- package/lib/guides.mjs +1403 -230
- package/lib/host.mjs +123 -21
- package/lib/inplace.mjs +171 -36
- package/lib/jigs.mjs +360 -78
- package/lib/joins.mjs +697 -118
- package/lib/jsonedit.mjs +88 -26
- package/lib/kept.mjs +84 -0
- package/lib/kit.mjs +438 -68
- package/lib/layout.mjs +2 -1
- package/lib/links.mjs +149 -42
- package/lib/list.mjs +326 -64
- package/lib/live-guard.mjs +68 -0
- package/lib/live-shape.mjs +96 -24
- package/lib/live.mjs +189 -59
- package/lib/loads.mjs +579 -130
- package/lib/machine.mjs +372 -74
- package/lib/magnets.mjs +162 -44
- package/lib/measured.mjs +417 -94
- package/lib/mesh.mjs +526 -119
- package/lib/meshcmd.mjs +215 -60
- package/lib/motors.mjs +1021 -213
- package/lib/motorsvg.mjs +114 -32
- package/lib/names.mjs +3 -1
- package/lib/optimise.mjs +978 -283
- package/lib/order.mjs +519 -112
- package/lib/panels.mjs +482 -94
- package/lib/parts.mjs +78 -23
- package/lib/pins.mjs +163 -44
- package/lib/plates.mjs +223 -35
- package/lib/player.mjs +37 -9
- package/lib/power.mjs +64 -13
- package/lib/preview.mjs +83 -16
- package/lib/profilemeasure.mjs +572 -129
- package/lib/rules.mjs +15 -5
- package/lib/sandbox-hooks.mjs +77 -19
- package/lib/sandbox-run.mjs +117 -18
- package/lib/sandbox.mjs +509 -60
- package/lib/schema.mjs +42 -11
- package/lib/seats.mjs +227 -49
- package/lib/services.mjs +261 -52
- package/lib/sheet.mjs +851 -178
- package/lib/slotnuts.mjs +213 -34
- package/lib/targets/gist.mjs +4 -1
- package/lib/targets.mjs +22 -4
- package/lib/task.mjs +376 -79
- package/lib/versions.mjs +111 -28
- package/lib/wires.mjs +228 -45
- package/lib/workspace.mjs +197 -12
- package/package.json +19 -19
- package/schemas/assembly.schema.json +2 -2
package/lib/clone.mjs
CHANGED
|
@@ -10,7 +10,8 @@ import { pcbEngine } from './design.mjs';
|
|
|
10
10
|
|
|
11
11
|
const today = () => new Date().toISOString().slice(0, 10);
|
|
12
12
|
// Licences that ask boards made from the source to stay under them (or forbid that use): said when cloning
|
|
13
|
-
export const reciprocal = (s) =>
|
|
13
|
+
export const reciprocal = (s) =>
|
|
14
|
+
/CERN-OHL-S|CERN Open Hardware Licence Version 2 - Strongly|GPL|share-?alike|\bSA\b/i.test(String(s || ''));
|
|
14
15
|
export const limiting = (s) => /\b(NC|ND)\b|non-?commercial|no-?deriv/i.test(String(s || ''));
|
|
15
16
|
|
|
16
17
|
// A GitHub file link (github.com/<owner>/<repo>/blob/<ref>/<path>) -> { owner, repo, ref, file }, else null
|
|
@@ -30,37 +31,118 @@ async function getJSON(url) {
|
|
|
30
31
|
async function fetchBoard(ref, o) {
|
|
31
32
|
const gh = githubFile(ref);
|
|
32
33
|
if (!gh) {
|
|
33
|
-
if (!fs.existsSync(ref))
|
|
34
|
-
|
|
34
|
+
if (!fs.existsSync(ref))
|
|
35
|
+
throw new Error(
|
|
36
|
+
`no file ${ref}: give a .kicad_pcb file, or a GitHub link to one (https://github.com/<owner>/<repo>/blob/<branch>/<path>.kicad_pcb)`,
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
text: fs.readFileSync(ref, 'utf8'),
|
|
40
|
+
source: o.source || path.basename(ref),
|
|
41
|
+
licence: o.licence || null,
|
|
42
|
+
dir: path.dirname(path.resolve(ref)),
|
|
43
|
+
};
|
|
35
44
|
}
|
|
36
45
|
const base = `https://api.github.com/repos/${gh.owner}/${gh.repo}`;
|
|
37
46
|
const commit = (await getJSON(`${base}/commits/${encodeURIComponent(gh.ref)}`)).sha;
|
|
38
|
-
const raw = await fetch(
|
|
47
|
+
const raw = await fetch(
|
|
48
|
+
`https://raw.githubusercontent.com/${gh.owner}/${gh.repo}/${commit}/${gh.file.split('/').map(encodeURIComponent).join('/')}`,
|
|
49
|
+
);
|
|
39
50
|
if (!raw.ok) throw new Error(`couldn't download ${gh.file} at ${commit.slice(0, 7)} (${raw.status})`);
|
|
40
51
|
let licence = o.licence || null;
|
|
41
52
|
if (!licence) {
|
|
42
53
|
const l = await getJSON(`${base}/license?ref=${commit}`).catch(() => null);
|
|
43
|
-
const first = l?.content
|
|
54
|
+
const first = l?.content
|
|
55
|
+
? Buffer.from(l.content, 'base64')
|
|
56
|
+
.toString('utf8')
|
|
57
|
+
.split('\n')
|
|
58
|
+
.map((s) => s.trim())
|
|
59
|
+
.find(Boolean)
|
|
60
|
+
: null;
|
|
44
61
|
licence = l?.license?.spdx_id && l.license.spdx_id !== 'NOASSERTION' ? l.license.spdx_id : first;
|
|
45
62
|
}
|
|
46
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
text: await raw.text(),
|
|
65
|
+
source: `https://github.com/${gh.owner}/${gh.repo}/blob/${commit}/${gh.file}`,
|
|
66
|
+
licence,
|
|
67
|
+
commit,
|
|
68
|
+
github: { ...gh, commit },
|
|
69
|
+
};
|
|
47
70
|
}
|
|
48
71
|
|
|
49
72
|
// ---- the parts' 3D models ----
|
|
50
73
|
// KiCad's own library, by the version its path variable names (6 and later name it; older boards say KISYS3DMOD)
|
|
51
74
|
const KICAD = { 6: '6.0.11', 7: '7.0.11', 8: '8.0.8' };
|
|
52
|
-
const KICAD_LICENCE =
|
|
53
|
-
const fetchText = async (url) => {
|
|
75
|
+
const KICAD_LICENCE = "CC-BY-SA-4.0 with the KiCad libraries exception (designs using the models aren't bound by it)";
|
|
76
|
+
const fetchText = async (url) => {
|
|
77
|
+
const r = await fetch(url);
|
|
78
|
+
if (!r.ok) throw new Error(`${r.status} for ${url}`);
|
|
79
|
+
return r.text();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Whether file is in the folder dir, or a folder in it (by its name, and by where a link in the way leads)
|
|
83
|
+
function inside(dir, file) {
|
|
84
|
+
const within = (d, f) => {
|
|
85
|
+
const rel = nodePath.relative(d, f);
|
|
86
|
+
return rel !== '' && rel !== '..' && !rel.startsWith(`..${nodePath.sep}`) && !nodePath.isAbsolute(rel);
|
|
87
|
+
};
|
|
88
|
+
if (!within(dir, file)) return false;
|
|
89
|
+
try {
|
|
90
|
+
return within(fs.realpathSync(dir), fs.realpathSync(file));
|
|
91
|
+
} catch {
|
|
92
|
+
return true; // (no such file yet: reading it finds nothing, and says so)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// base + rest, refused if the address it makes leads out of base. (A web address reads "%2e%2e" and a backslash as
|
|
97
|
+
// ".." and "/", so a path the checks on its words pass can still climb to another repository, or out of KiCad's
|
|
98
|
+
// library, and be copied in under a licence that isn't its own.)
|
|
99
|
+
function under(base, rest, what) {
|
|
100
|
+
const url = base + rest;
|
|
101
|
+
if (!new URL(url).pathname.startsWith(new URL(base).pathname))
|
|
102
|
+
throw new Error(`its path leaves ${what}, so cad clone doesn't follow it`);
|
|
103
|
+
return url;
|
|
104
|
+
}
|
|
54
105
|
|
|
55
|
-
|
|
56
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Where a model's file comes from: { url, licence } (or { file } for a board read from a file), or null. A path that
|
|
108
|
+
* leads out of the board's folder, its repository or KiCad's library is refused.
|
|
109
|
+
* @param {string} path the model's path as the board gives it
|
|
110
|
+
* @param {{ dir?: string, github?: { owner: string, repo: string, commit: string, file: string }, licence?: string }} got where the board came from
|
|
111
|
+
* @returns {Promise<{ url?: string, file?: string, dir?: string, licence?: string | null, kicad?: boolean } | null>}
|
|
112
|
+
*/
|
|
113
|
+
export async function modelSource(path, got) {
|
|
57
114
|
const kicad = path.match(/^\$\{(?:KICAD(\d+)_3DMODEL_DIR|KISYS3DMOD)\}\/(.+)$/);
|
|
58
|
-
if (kicad)
|
|
115
|
+
if (kicad)
|
|
116
|
+
return {
|
|
117
|
+
url: under(
|
|
118
|
+
`https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/${KICAD[kicad[1]] ?? KICAD[6]}/`,
|
|
119
|
+
kicad[2],
|
|
120
|
+
"KiCad's model library",
|
|
121
|
+
),
|
|
122
|
+
licence: KICAD_LICENCE,
|
|
123
|
+
kicad: true,
|
|
124
|
+
};
|
|
59
125
|
const own = path.match(/^\$\{KIPRJMOD\}\/(.+)$/);
|
|
60
126
|
if (!own) return null;
|
|
61
|
-
|
|
127
|
+
// A board's own models are in its folder: a path that climbs out of it (../, or one from the top of the disc) is
|
|
128
|
+
// refused, so a board from elsewhere can't have cad clone copy a file of this computer into the workspace. (From
|
|
129
|
+
// GitHub, the path may lead anywhere in the board's repository, which is fetched from GitHub, never from this disc.)
|
|
130
|
+
if (!got.github) {
|
|
131
|
+
if (!got.dir) return null;
|
|
132
|
+
const file = nodePath.resolve(got.dir, own[1]);
|
|
133
|
+
if (!inside(got.dir, file)) throw new Error(`its path leaves the board's folder, so cad clone doesn't follow it`);
|
|
134
|
+
return { file, dir: got.dir };
|
|
135
|
+
}
|
|
62
136
|
// In the source's repository, next to its board; a path into a submodule goes on in the submodule's repository
|
|
63
|
-
const { owner, repo, commit, file } = got.github,
|
|
137
|
+
const { owner, repo, commit, file } = got.github,
|
|
138
|
+
parts = nodePath.posix.normalize(nodePath.posix.join(nodePath.posix.dirname(file), own[1])).split('/');
|
|
139
|
+
if (parts[0] === '..' || parts[0] === '')
|
|
140
|
+
throw new Error(`its path leaves the board's repository, so cad clone doesn't follow it`);
|
|
141
|
+
const inRepo = under(
|
|
142
|
+
`https://raw.githubusercontent.com/${owner}/${repo}/${commit}/`,
|
|
143
|
+
parts.join('/'),
|
|
144
|
+
"the board's repository",
|
|
145
|
+
);
|
|
64
146
|
const api = (o, r, x) => getJSON(`https://api.github.com/repos/${o}/${r}/${x}`);
|
|
65
147
|
const top = await api(owner, repo, `contents/${encodeURIComponent(parts[0])}?ref=${commit}`).catch(() => null);
|
|
66
148
|
const licenceOf = async (o, r) => (await api(o, r, 'license').catch(() => null))?.license?.spdx_id;
|
|
@@ -68,37 +150,76 @@ async function modelSource(path, got) {
|
|
|
68
150
|
const m = top.submodule_git_url.match(/github\.com[:/]([\w.-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
69
151
|
if (!m) return null;
|
|
70
152
|
const lic = await licenceOf(m[1], m[2]);
|
|
71
|
-
return {
|
|
153
|
+
return {
|
|
154
|
+
url: under(
|
|
155
|
+
`https://raw.githubusercontent.com/${m[1]}/${m[2]}/${top.sha}/`,
|
|
156
|
+
parts.slice(1).join('/'),
|
|
157
|
+
"the board's repository",
|
|
158
|
+
),
|
|
159
|
+
licence: lic && lic !== 'NOASSERTION' ? lic : null,
|
|
160
|
+
};
|
|
72
161
|
}
|
|
73
|
-
return {
|
|
162
|
+
return {
|
|
163
|
+
url: inRepo,
|
|
164
|
+
licence: got.licence,
|
|
165
|
+
};
|
|
74
166
|
}
|
|
75
167
|
|
|
76
168
|
// Each model the circuit's parts name, fetched once into the workspace's models/ (a mesh, where its licence lets it be
|
|
77
169
|
// shared and it comes as VRML) or kept as its size (a STEP file, or a shape with no licence): circuit.models[path]
|
|
78
170
|
async function fetchModels(circuit, got, { wrlMesh, stepBounds }, notes) {
|
|
79
|
-
const out = {},
|
|
171
|
+
const out = {},
|
|
172
|
+
paths = [...new Set(circuit.parts.filter((p) => p.model).map((p) => p.model.path))];
|
|
80
173
|
for (const path of paths) {
|
|
81
174
|
try {
|
|
82
175
|
const src = await modelSource(path, got);
|
|
83
|
-
if (!src) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
176
|
+
if (!src) {
|
|
177
|
+
notes.push(`no 3D model for ${path}: its path isn't one cad clone can follow`);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const name = path
|
|
181
|
+
.split('/')
|
|
182
|
+
.pop()
|
|
183
|
+
.replace(/\.(step|stp|wrl)$/i, ''),
|
|
184
|
+
dir = src.kicad ? `kicad/${path.split('/').slice(-2, -1)[0]}` : 'source';
|
|
185
|
+
const read = async (ext) => {
|
|
186
|
+
if (!src.file) return fetchText(src.url.replace(/\.[^./]+$/, ext));
|
|
187
|
+
const f = src.file.replace(/\.[^.]+$/, ext);
|
|
188
|
+
// (and where a link in the board's folder leads: it must stay in the folder too)
|
|
189
|
+
if (!inside(src.dir, f)) throw new Error(`its path leaves the board's folder, so cad clone doesn't follow it`);
|
|
190
|
+
return fs.promises.readFile(f, 'utf8');
|
|
191
|
+
};
|
|
192
|
+
if (src.licence || src.file) {
|
|
193
|
+
// VRML where there is one (KiCad's library has both): a mesh
|
|
87
194
|
const wrl = /\.wrl$/i.test(path) || src.kicad ? await read('.wrl').catch(() => null) : null;
|
|
88
195
|
if (wrl) {
|
|
89
196
|
const triangles = wrlMesh(wrl).map((t) => t.map((v) => v.map((n) => Math.round(n * 1e3) / 1e3)));
|
|
90
197
|
const file = `models/${dir}/${name}.json`;
|
|
91
198
|
fs.mkdirSync(nodePath.join(WS, nodePath.dirname(file)), { recursive: true });
|
|
92
|
-
fs.writeFileSync(
|
|
199
|
+
fs.writeFileSync(
|
|
200
|
+
nodePath.join(WS, file),
|
|
201
|
+
JSON.stringify({ source: src.url || src.file, licence: src.licence, triangles }),
|
|
202
|
+
);
|
|
93
203
|
out[path] = { mesh: file, licence: src.licence };
|
|
94
204
|
continue;
|
|
95
205
|
}
|
|
96
206
|
}
|
|
97
207
|
const step = await read(nodePath.extname(path) || '.step').catch(() => read('.step'));
|
|
98
208
|
const box = stepBounds(step);
|
|
99
|
-
if (!box) {
|
|
100
|
-
|
|
101
|
-
|
|
209
|
+
if (!box) {
|
|
210
|
+
notes.push(`no 3D model for ${name}: its file has no points to measure`);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
out[path] = {
|
|
214
|
+
box,
|
|
215
|
+
...(src.licence ? { licence: src.licence } : {}),
|
|
216
|
+
size_only: src.licence
|
|
217
|
+
? 'a STEP model: drawn as the box round it'
|
|
218
|
+
: 'no licence: only its size is used, drawn as a box',
|
|
219
|
+
};
|
|
220
|
+
} catch (e) {
|
|
221
|
+
notes.push(`no 3D model for ${path.split('/').pop()}: ${e.message}`);
|
|
222
|
+
}
|
|
102
223
|
}
|
|
103
224
|
return out;
|
|
104
225
|
}
|
|
@@ -108,43 +229,74 @@ async function fetchModels(circuit, got, { wrlMesh, stepBounds }, notes) {
|
|
|
108
229
|
* can't carry yet, and what the licence asks. o: { source, licence, force }.
|
|
109
230
|
*/
|
|
110
231
|
export async function cloneBoard(ref, name, o = {}) {
|
|
111
|
-
if (!ref || !/^[a-z][a-z0-9_]*$/.test(name || ''))
|
|
232
|
+
if (!ref || !/^[a-z][a-z0-9_]*$/.test(name || ''))
|
|
233
|
+
throw new Error(
|
|
234
|
+
'usage: cad clone <board.kicad_pcb | GitHub link> <name> [--source <link>] [--licence <licence>] [--force] (name: lower case, digits and _)',
|
|
235
|
+
);
|
|
112
236
|
const to = path.join(WS, 'rules', `${name}.json`);
|
|
113
237
|
if (fs.existsSync(to) && !o.force) throw new Error(`rules/${name}.json already exists (--force to replace it)`);
|
|
114
238
|
const { fromKicadPcb, clone, learnPlacement, wrlMesh, stepBounds } = await pcbEngine();
|
|
115
239
|
if (!learnPlacement) throw new Error('cad clone needs @rulecad/pcb 0.3.8 or later: npm install @rulecad/pcb@latest');
|
|
116
240
|
const got = await fetchBoard(ref, o);
|
|
117
241
|
const circuit = fromKicadPcb(got.text);
|
|
118
|
-
circuit.source = {
|
|
242
|
+
circuit.source = {
|
|
243
|
+
...circuit.source,
|
|
244
|
+
from: got.source,
|
|
245
|
+
...(got.commit ? { commit: got.commit } : {}),
|
|
246
|
+
read: today(),
|
|
247
|
+
};
|
|
119
248
|
circuit.placement = learnPlacement(circuit); // which small parts stay by which pins: edit max to be stricter or freer
|
|
120
249
|
const modelNotes = [];
|
|
121
250
|
if (!o.noModels && wrlMesh) circuit.models = await fetchModels(circuit, got, { wrlMesh, stepBounds }, modelNotes);
|
|
122
|
-
const extra = {
|
|
251
|
+
const extra = {
|
|
252
|
+
kind: 'derived',
|
|
253
|
+
source: got.source,
|
|
254
|
+
...(got.licence ? { licence: got.licence } : {}),
|
|
255
|
+
checked: today(),
|
|
256
|
+
};
|
|
123
257
|
const rule = (value, unit, text) => ({ value, ...(unit ? { unit } : {}), rule: text, ...extra });
|
|
124
258
|
const rules = {
|
|
125
|
-
width: rule(circuit.width, 'mm',
|
|
126
|
-
height: rule(circuit.height, 'mm',
|
|
127
|
-
layers: rule(circuit.layers, null, `Copper layers on the source board (${circuit.copper.join(', ')})`)
|
|
259
|
+
width: rule(circuit.width, 'mm', "The source board's width, across its outline"),
|
|
260
|
+
height: rule(circuit.height, 'mm', "The source board's height, across its outline"),
|
|
261
|
+
layers: rule(circuit.layers, null, `Copper layers on the source board (${circuit.copper.join(', ')})`),
|
|
128
262
|
};
|
|
129
|
-
if (circuit.thickness) rules.thickness = rule(circuit.thickness, 'mm',
|
|
263
|
+
if (circuit.thickness) rules.thickness = rule(circuit.thickness, 'mm', "The source board's thickness");
|
|
130
264
|
const doc = `Cloned from ${got.source} by cad clone: the circuit of a published board (its parts, pads, nets, planes and outline), for @rulecad/pcb's clone() to redraw by rules.${got.licence ? ` Licence: ${got.licence}.` : ' Licence unknown: find it before sharing anything made from this.'}${reciprocal(got.licence) ? ' Boards made from it must be shared under the same licence, with their design files.' : ''}`;
|
|
131
265
|
fs.mkdirSync(path.dirname(to), { recursive: true });
|
|
132
|
-
fs.writeFileSync(
|
|
266
|
+
fs.writeFileSync(
|
|
267
|
+
to,
|
|
268
|
+
`${JSON.stringify({ _doc: doc, name, ...(got.licence ? { licence: got.licence } : {}), rules, circuit }, null, 1)}\n`,
|
|
269
|
+
);
|
|
133
270
|
|
|
134
|
-
const nets = Object.keys(circuit.nets).length,
|
|
135
|
-
|
|
271
|
+
const nets = Object.keys(circuit.nets).length,
|
|
272
|
+
planes = Object.keys(circuit.planes);
|
|
273
|
+
console.log(
|
|
274
|
+
`made ${path.relative(process.cwd(), to)}: ${circuit.parts.length} parts, ${nets} nets, ${circuit.width} × ${circuit.height} mm, ${circuit.layers} copper layers${planes.length ? `, planes ${planes.join(' ')}` : ''}`,
|
|
275
|
+
);
|
|
136
276
|
console.log(` from ${got.source}`);
|
|
137
|
-
console.log(
|
|
277
|
+
console.log(
|
|
278
|
+
` placement: ${circuit.placement.length} small parts kept near the pins they serve (circuit.placement: edit max to change how near)`,
|
|
279
|
+
);
|
|
138
280
|
if (circuit.models) {
|
|
139
|
-
const all = Object.values(circuit.models),
|
|
140
|
-
|
|
281
|
+
const all = Object.values(circuit.models),
|
|
282
|
+
boxes = all.filter((m) => m.box).length;
|
|
283
|
+
console.log(
|
|
284
|
+
` 3D models: ${all.length - boxes} as meshes (in models/), ${boxes} as boxes the size of the part${all.some((m) => /no licence/.test(m.size_only || '')) ? ' (some have no licence: only their size is used)' : ''}`,
|
|
285
|
+
);
|
|
141
286
|
}
|
|
142
287
|
for (const n of modelNotes) console.log(` note: ${n}`);
|
|
143
|
-
if (!circuit.outline) console.log(
|
|
288
|
+
if (!circuit.outline) console.log(" note: the outline isn't one closed shape: designs get its bounds");
|
|
144
289
|
for (const n of clone(circuit).notes) console.log(` note: ${n}`);
|
|
145
|
-
if (!got.licence)
|
|
146
|
-
|
|
147
|
-
else if (
|
|
148
|
-
|
|
290
|
+
if (!got.licence)
|
|
291
|
+
console.log(" ! no licence given (--licence): find the source's licence before sharing anything made from it");
|
|
292
|
+
else if (limiting(got.licence))
|
|
293
|
+
console.log(` ! licence "${got.licence}" limits what you may make from this: read it before using the circuit`);
|
|
294
|
+
else if (reciprocal(got.licence))
|
|
295
|
+
console.log(
|
|
296
|
+
` ! licence "${got.licence}" is reciprocal: boards made from this must be shared under it too, with their design files. Keep this rule set apart from rules under other licences`,
|
|
297
|
+
);
|
|
298
|
+
console.log(
|
|
299
|
+
` use it in a board: clone(v.${name}.circuit) from @rulecad/pcb gives the parts and nets, each where the source put it`,
|
|
300
|
+
);
|
|
149
301
|
return { to, circuit };
|
|
150
302
|
}
|