@modular-circuit/transpiler 0.0.58 → 0.0.59
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/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +19 -106
- package/build/builder/graph_to_kicad/index.js +4 -59
- package/build/converter/graph_to_netlist/graph_converter.js +51 -171
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -1
- package/build/converter/kicad_sexpr/eeschema/printer.js +228 -281
- package/build/converter/link_to_netlist/converter.js +77 -135
- package/build/converter/link_to_netlist/links/converter_base.js +38 -131
- package/build/converter/link_to_netlist/links/converters.js +316 -554
- package/build/converter/netlist_to_kicad/layout.js +19 -23
- package/build/converter/netlist_to_kicad/netlist_converter.js +74 -167
- package/build/kicad/constraints/index.js +1 -1
- package/build/kicad/label/net_label.js +2 -2
- package/build/kicad/label/sheet_pin.js +11 -19
- package/build/kicad/project/kicad_prl.js +3 -3
- package/build/kicad/project/kicad_pro.js +4 -4
- package/build/kicad/project/kicad_project_achieve.js +31 -45
- package/build/kicad/project/wildcards_and_files_ext.js +61 -61
- package/build/kicad/sheet/sheet.js +3 -3
- package/build/kicad/symbols/lib_symbol/gnd.js +6 -6
- package/build/kicad/symbols/lib_symbol/vcc.js +7 -7
- package/build/kicad/symbols/sch_symbol/gnd.js +9 -9
- package/build/kicad/symbols/sch_symbol/vcc.js +9 -9
- package/build/kicad/symbols/symbol_utils.js +1 -1
- package/build/utils/collect_sub_sheets.js +32 -146
- package/build/utils/constraints.js +6 -6
- package/build/utils/filter_null_undefined.js +2 -31
- package/build/utils/string_formatter.js +23 -29
- package/package.json +5 -5
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { PAPER_SIZE } from '../../utils/constraints';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const POWER_START_Y = 30;
|
|
3
|
+
const POWER_START_X = PAPER_SIZE.A4.height - 30;
|
|
4
|
+
const POWER_Y_STEP = 16;
|
|
5
5
|
export function get_power_pos(pwr_number) {
|
|
6
6
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var block_height = (BLOCK_PIN_GAP * pin_num) / 2 + BLOCK_PIN_GAP * 2;
|
|
23
|
-
var rect = {
|
|
8
|
+
const BLOCK_START_Y = 36;
|
|
9
|
+
const BLOCK_START_X = BLOCK_START_Y;
|
|
10
|
+
export const BLOCK_PIN_GAP = 4;
|
|
11
|
+
const BLOCK_MARGIN_TOP = 8;
|
|
12
|
+
const BLOCK_WIDTH = 36;
|
|
13
|
+
const BLOCK_MARGIN_LEFT = 16;
|
|
14
|
+
const BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
15
|
+
export class Layout {
|
|
16
|
+
width = BLOCK_START_X;
|
|
17
|
+
height = BLOCK_START_Y;
|
|
18
|
+
max_height = 0;
|
|
19
|
+
get_block_rect(pin_num) {
|
|
20
|
+
const block_height = (BLOCK_PIN_GAP * pin_num) / 2 + BLOCK_PIN_GAP * 2;
|
|
21
|
+
const rect = {
|
|
24
22
|
pos: {
|
|
25
23
|
x: this.width,
|
|
26
24
|
y: this.height,
|
|
@@ -38,7 +36,5 @@ var Layout = /** @class */ (function () {
|
|
|
38
36
|
this.max_height = 0;
|
|
39
37
|
}
|
|
40
38
|
return rect;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}());
|
|
44
|
-
export { Layout };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
var __values = (this && this.__values) || function(o) {
|
|
2
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
-
if (m) return m.call(o);
|
|
4
|
-
if (o && typeof o.length === "number") return {
|
|
5
|
-
next: function () {
|
|
6
|
-
if (o && i >= o.length) o = void 0;
|
|
7
|
-
return { value: o && o[i++], done: !o };
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
-
};
|
|
12
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
-
if (!m) return o;
|
|
15
|
-
var i = m.call(o), r, ar = [], e;
|
|
16
|
-
try {
|
|
17
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
-
}
|
|
19
|
-
catch (error) { e = { error: error }; }
|
|
20
|
-
finally {
|
|
21
|
-
try {
|
|
22
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
-
}
|
|
24
|
-
finally { if (e) throw e.error; }
|
|
25
|
-
}
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
1
|
import { PowerShape } from '@modular-circuit/electronics-model';
|
|
29
2
|
import { MODULAR_CIRCUIT_SCH_EXT } from '@modular-circuit/ir';
|
|
30
3
|
import { replaceAll } from '@modular-circuit/utils';
|
|
@@ -33,64 +6,34 @@ import { gen_sch_sheet } from '../../kicad/sheet';
|
|
|
33
6
|
import { gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc } from '../../kicad/symbols';
|
|
34
7
|
import { GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/constraints';
|
|
35
8
|
import { BLOCK_PIN_GAP, Layout, get_power_pos } from './layout';
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
9
|
+
export class NetListConverter {
|
|
10
|
+
ctx;
|
|
11
|
+
block_calc;
|
|
12
|
+
sheet_pwr_count = 0;
|
|
13
|
+
net_name = {};
|
|
14
|
+
constructor(ctx) {
|
|
39
15
|
this.ctx = ctx;
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (var _c = __values(this.ctx.netlist.nets), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
44
|
-
var net = _d.value;
|
|
45
|
-
try {
|
|
46
|
-
for (var _e = (e_2 = void 0, __values(net.pins)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
47
|
-
var it_1 = _f.value;
|
|
48
|
-
this.net_name[it_1] = net.name;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
52
|
-
finally {
|
|
53
|
-
try {
|
|
54
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
55
|
-
}
|
|
56
|
-
finally { if (e_2) throw e_2.error; }
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
16
|
+
for (const net of this.ctx.netlist.nets) {
|
|
17
|
+
for (const it of net.pins) {
|
|
18
|
+
this.net_name[it] = net.name;
|
|
64
19
|
}
|
|
65
|
-
finally { if (e_1) throw e_1.error; }
|
|
66
20
|
}
|
|
67
21
|
}
|
|
68
|
-
|
|
22
|
+
pin_is_connected(id) {
|
|
69
23
|
return this.net_name[id] !== undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
24
|
+
}
|
|
25
|
+
get_pin_net_name(id) {
|
|
72
26
|
return this.net_name[id];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.sheet_pwr_count = 0;
|
|
81
|
-
this.block_calc = new Layout();
|
|
82
|
-
all_sch[k] = this.convert_sch(k, v);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
86
|
-
finally {
|
|
87
|
-
try {
|
|
88
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
89
|
-
}
|
|
90
|
-
finally { if (e_3) throw e_3.error; }
|
|
27
|
+
}
|
|
28
|
+
convert_to_kicad() {
|
|
29
|
+
const all_sch = {};
|
|
30
|
+
for (const [k, v] of Object.entries(this.ctx.netlist.schematics)) {
|
|
31
|
+
this.sheet_pwr_count = 0;
|
|
32
|
+
this.block_calc = new Layout();
|
|
33
|
+
all_sch[k] = this.convert_sch(k, v);
|
|
91
34
|
}
|
|
92
35
|
return all_sch;
|
|
93
|
-
}
|
|
36
|
+
}
|
|
94
37
|
/**
|
|
95
38
|
* Convert a schematic to a kicad schematic
|
|
96
39
|
* @param name The name of the graph ,also the file name of the converted schematic
|
|
@@ -98,11 +41,9 @@ var NetListConverter = /** @class */ (function () {
|
|
|
98
41
|
* no need to handle them before the other types of label are introduced, e.g. global or hierarchical
|
|
99
42
|
* @returns
|
|
100
43
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var powers = new Set();
|
|
105
|
-
var sch = {
|
|
44
|
+
convert_sch(name, schematic) {
|
|
45
|
+
const powers = new Set();
|
|
46
|
+
const sch = {
|
|
106
47
|
version: SCH_VERSION,
|
|
107
48
|
generator: GENERATOR_NAME,
|
|
108
49
|
generator_version: GENERATOR_VERSION,
|
|
@@ -110,7 +51,7 @@ var NetListConverter = /** @class */ (function () {
|
|
|
110
51
|
size: 'A4',
|
|
111
52
|
},
|
|
112
53
|
title_block: {
|
|
113
|
-
title: name.replace(
|
|
54
|
+
title: name.replace(`.${MODULAR_CIRCUIT_SCH_EXT}`, ''),
|
|
114
55
|
date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
|
|
115
56
|
rev: '1.0',
|
|
116
57
|
comment: {
|
|
@@ -127,91 +68,60 @@ var NetListConverter = /** @class */ (function () {
|
|
|
127
68
|
labels: [],
|
|
128
69
|
sheets: [],
|
|
129
70
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(_e = sch.lib_symbols) === null || _e === void 0 ? void 0 : _e.symbols.push(gen_lib_gnd(it_2.value));
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
powers.add(it_2.value);
|
|
71
|
+
for (const it of schematic.powers) {
|
|
72
|
+
if (!powers.has(it.value)) {
|
|
73
|
+
switch (it.shape) {
|
|
74
|
+
case PowerShape.VCC:
|
|
75
|
+
sch.lib_symbols?.symbols.push(gen_lib_vcc(it.value));
|
|
76
|
+
break;
|
|
77
|
+
case PowerShape.GND:
|
|
78
|
+
sch.lib_symbols?.symbols.push(gen_lib_gnd(it.value));
|
|
79
|
+
break;
|
|
143
80
|
}
|
|
144
|
-
|
|
81
|
+
powers.add(it.value);
|
|
145
82
|
}
|
|
83
|
+
this.convert_pwr_symbol(it, get_power_pos(this.sheet_pwr_count++), sch);
|
|
146
84
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
finally { if (e_4) throw e_4.error; }
|
|
85
|
+
const sheet_names_count = new Map();
|
|
86
|
+
for (const it of schematic.sheet_symbols.sort((a, b) => {
|
|
87
|
+
return b.pins.length - a.pins.length;
|
|
88
|
+
})) {
|
|
89
|
+
this.convert_sheet_symbol(it, this.block_calc.get_block_rect(it.pins.length), sch, sheet_names_count);
|
|
153
90
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return b.pins.length - a.pins.length;
|
|
158
|
-
})), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
159
|
-
var it_3 = _j.value;
|
|
160
|
-
this.convert_sheet_symbol(it_3, this.block_calc.get_block_rect(it_3.pins.length), sch, sheet_names_count);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
164
|
-
finally {
|
|
165
|
-
try {
|
|
166
|
-
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
167
|
-
}
|
|
168
|
-
finally { if (e_5) throw e_5.error; }
|
|
169
|
-
}
|
|
170
|
-
try {
|
|
171
|
-
// Finally the hierarchical labels
|
|
172
|
-
for (var _k = __values(schematic.hiera_labels), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
173
|
-
var it_4 = _l.value;
|
|
174
|
-
this.convert_hierarchical_label(it_4, sch);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
178
|
-
finally {
|
|
179
|
-
try {
|
|
180
|
-
if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
|
|
181
|
-
}
|
|
182
|
-
finally { if (e_6) throw e_6.error; }
|
|
91
|
+
// Finally the hierarchical labels
|
|
92
|
+
for (const it of schematic.hiera_labels) {
|
|
93
|
+
this.convert_hierarchical_label(it, sch);
|
|
183
94
|
}
|
|
184
95
|
return sch;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
NetListConverter.prototype.convert_pwr_symbol = function (pwr, at, sch) {
|
|
96
|
+
}
|
|
97
|
+
convert_hierarchical_label(pin, sch) {
|
|
98
|
+
const pin_pos = this.block_calc.get_block_rect(1).pos;
|
|
99
|
+
sch.labels?.push(gen_hierarchical_label(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
|
|
100
|
+
}
|
|
101
|
+
convert_pwr_symbol(pwr, at, sch) {
|
|
192
102
|
// NOTE : The power uuid is used as the uuid of its pin ,cause all power symbols have only one pin
|
|
193
|
-
|
|
194
|
-
|
|
103
|
+
const pin_id = pwr.uuid;
|
|
104
|
+
const sch_pwr_symbol = pwr.shape === PowerShape.VCC
|
|
195
105
|
? gen_sch_vcc(pwr.value, this.sheet_pwr_count, pin_id, at)
|
|
196
106
|
: gen_sch_gnd(pwr.value, this.sheet_pwr_count, pin_id, at);
|
|
197
107
|
sch.symbols.push(sch_pwr_symbol);
|
|
198
108
|
this.convert_net_label(pwr.value, at, sch);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
for (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x
|
|
210
|
-
}
|
|
211
|
-
|
|
109
|
+
}
|
|
110
|
+
convert_sheet_symbol(sheet_sym, rect, sch, sheet_names_count) {
|
|
111
|
+
const port_count = sheet_sym.pins.length;
|
|
112
|
+
const pins = [];
|
|
113
|
+
for (let i = 0; i < port_count; i++) {
|
|
114
|
+
const is_left = i < port_count / 2;
|
|
115
|
+
const x = is_left ? rect.pos.x : rect.pos.x + rect.size.x;
|
|
116
|
+
const y = rect.pos.y + BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
|
|
117
|
+
const justify = is_left ? 'left' : 'right';
|
|
118
|
+
const rotation = is_left ? 180 : 0;
|
|
119
|
+
pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x, y }, sch, justify, rotation));
|
|
120
|
+
}
|
|
121
|
+
let sheet_name = sheet_sym.sheet_name;
|
|
212
122
|
if (sheet_names_count.has(sheet_name)) {
|
|
213
|
-
|
|
214
|
-
sheet_name +=
|
|
123
|
+
const count = sheet_names_count.get(sheet_name);
|
|
124
|
+
sheet_name += `_${count}`;
|
|
215
125
|
sheet_names_count.set(sheet_name, count + 1);
|
|
216
126
|
}
|
|
217
127
|
else {
|
|
@@ -221,17 +131,14 @@ var NetListConverter = /** @class */ (function () {
|
|
|
221
131
|
Sheetfile: sheet_sym.sheet_file_name,
|
|
222
132
|
Sheetname: sheet_name,
|
|
223
133
|
}));
|
|
224
|
-
}
|
|
225
|
-
|
|
134
|
+
}
|
|
135
|
+
convert_sheet_pin(pin, pin_pos, sch, horizontal, rotation) {
|
|
226
136
|
if (this.pin_is_connected(pin.uuid)) {
|
|
227
137
|
this.convert_net_label(this.get_pin_net_name(pin.uuid), pin_pos, sch, horizontal === 'left' ? 'right' : 'left');
|
|
228
138
|
}
|
|
229
|
-
return gen_sheet_pin(pin.name, pin_pos, { horizontal
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return NetListConverter;
|
|
236
|
-
}());
|
|
237
|
-
export { NetListConverter };
|
|
139
|
+
return gen_sheet_pin(pin.name, pin_pos, { horizontal, vertical: 'bottom' }, rotation, pin.shape);
|
|
140
|
+
}
|
|
141
|
+
convert_net_label(net_name, pin_pos, sch, horizontal = 'right') {
|
|
142
|
+
sch.labels.push(gen_net_label(net_name, pin_pos, { horizontal, vertical: 'bottom' }));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gen_uuid } from '@modular-circuit/utils';
|
|
2
2
|
import { DEFAULT_FONT_SIZE } from '../constraints';
|
|
3
|
-
export
|
|
3
|
+
export const gen_net_label = (name, at, justify) => ({
|
|
4
4
|
label_type: 'label',
|
|
5
5
|
text: name,
|
|
6
6
|
fields: [],
|
|
@@ -11,4 +11,4 @@ export var gen_net_label = function (name, at, justify) { return ({
|
|
|
11
11
|
justify: justify,
|
|
12
12
|
},
|
|
13
13
|
uuid: gen_uuid(),
|
|
14
|
-
});
|
|
14
|
+
});
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { gen_uuid } from '@modular-circuit/utils';
|
|
13
2
|
import { DEFAULT_FONT_SIZE } from '../constraints';
|
|
14
|
-
|
|
15
|
-
shape
|
|
3
|
+
const gen_base_hierarchical_label = (text, at, justify, rotation, shape) => ({
|
|
4
|
+
shape,
|
|
16
5
|
effects: {
|
|
17
6
|
font: { size: DEFAULT_FONT_SIZE },
|
|
18
|
-
justify
|
|
7
|
+
justify,
|
|
19
8
|
},
|
|
20
|
-
text
|
|
21
|
-
at: { position: at, rotation
|
|
9
|
+
text,
|
|
10
|
+
at: { position: at, rotation },
|
|
22
11
|
uuid: gen_uuid(),
|
|
23
|
-
});
|
|
24
|
-
export
|
|
25
|
-
|
|
12
|
+
});
|
|
13
|
+
export const gen_sheet_pin = (text, at, justify, rotation, shape) => ({
|
|
14
|
+
label_type: 'hierarchical_label',
|
|
15
|
+
...gen_base_hierarchical_label(text, at, justify, rotation, shape),
|
|
16
|
+
});
|
|
17
|
+
export const gen_hierarchical_label = gen_sheet_pin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const kicad_prl = (prj_name) => ({
|
|
2
2
|
board: {
|
|
3
3
|
active_layer: 0,
|
|
4
4
|
active_layer_preset: '',
|
|
@@ -41,10 +41,10 @@ export var kicad_prl = function (prj_name) { return ({
|
|
|
41
41
|
ssh_key: '',
|
|
42
42
|
},
|
|
43
43
|
meta: {
|
|
44
|
-
filename:
|
|
44
|
+
filename: `${prj_name}.kicad_prl`,
|
|
45
45
|
version: 3,
|
|
46
46
|
},
|
|
47
47
|
project: {
|
|
48
48
|
files: [],
|
|
49
49
|
},
|
|
50
|
-
});
|
|
50
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DrawingSheetFileExtension } from './wildcards_and_files_ext';
|
|
2
|
-
export
|
|
2
|
+
export const kicad_pro = (project_name) => ({
|
|
3
3
|
board: {
|
|
4
4
|
'3dviewports': [],
|
|
5
5
|
ipc2581: {
|
|
@@ -76,7 +76,7 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
76
76
|
pinned_symbol_libs: [],
|
|
77
77
|
},
|
|
78
78
|
meta: {
|
|
79
|
-
filename:
|
|
79
|
+
filename: `${project_name}.kicad_pro`,
|
|
80
80
|
version: 1,
|
|
81
81
|
},
|
|
82
82
|
net_settings: {
|
|
@@ -208,7 +208,7 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
208
208
|
version: 1,
|
|
209
209
|
},
|
|
210
210
|
net_format_name: '',
|
|
211
|
-
page_layout_descr_file:
|
|
211
|
+
page_layout_descr_file: `${project_name}.${DrawingSheetFileExtension}`,
|
|
212
212
|
plot_directory: '',
|
|
213
213
|
spice_current_sheet_as_root: false,
|
|
214
214
|
spice_external_command: 'spice "%I"',
|
|
@@ -221,4 +221,4 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
221
221
|
},
|
|
222
222
|
sheets: [],
|
|
223
223
|
text_variables: {},
|
|
224
|
-
});
|
|
224
|
+
});
|
|
@@ -1,53 +1,39 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { zipFiles } from '@modular-circuit/utils';
|
|
13
2
|
import { get_sch_default_drawing_sheet } from '../../converter';
|
|
14
3
|
import { kicad_prl } from './kicad_prl';
|
|
15
4
|
import { kicad_pro } from './kicad_pro';
|
|
16
5
|
import { DrawingSheetFileExtension, ProjectFileExtension, ProjectLocalSettingsFileExtension, } from './wildcards_and_files_ext';
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
export const KICAD_SCH_FRAME = get_sch_default_drawing_sheet();
|
|
7
|
+
export class KiCadProjectAchieve {
|
|
8
|
+
project_name;
|
|
9
|
+
sheets;
|
|
10
|
+
kicad_sym;
|
|
11
|
+
fp_lib_table;
|
|
12
|
+
layout_frame;
|
|
13
|
+
pcb;
|
|
14
|
+
sym_lib_table;
|
|
15
|
+
get sch_frame() {
|
|
16
|
+
return KICAD_SCH_FRAME;
|
|
17
|
+
}
|
|
18
|
+
get kicad_prl() {
|
|
19
|
+
return kicad_prl(this.project_name);
|
|
20
|
+
}
|
|
21
|
+
get kicad_pro() {
|
|
22
|
+
return kicad_pro(this.project_name);
|
|
23
|
+
}
|
|
24
|
+
constructor(project_name, sheets) {
|
|
20
25
|
this.project_name = project_name;
|
|
21
26
|
this.sheets = sheets;
|
|
22
27
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
configurable: true
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(KiCadProjectAchieve.prototype, "kicad_pro", {
|
|
38
|
-
get: function () {
|
|
39
|
-
return kicad_pro(this.project_name);
|
|
40
|
-
},
|
|
41
|
-
enumerable: false,
|
|
42
|
-
configurable: true
|
|
43
|
-
});
|
|
44
|
-
KiCadProjectAchieve.prototype.get_project_directive_file_name = function (ext) {
|
|
45
|
-
return "".concat(this.project_name, ".").concat(ext);
|
|
46
|
-
};
|
|
47
|
-
KiCadProjectAchieve.prototype.toZip = function () {
|
|
48
|
-
var _a;
|
|
49
|
-
return zipFiles(__assign((_a = {}, _a[this.get_project_directive_file_name(ProjectLocalSettingsFileExtension)] = JSON.stringify(this.kicad_prl), _a[this.get_project_directive_file_name(ProjectFileExtension)] = JSON.stringify(this.kicad_pro), _a[this.get_project_directive_file_name(DrawingSheetFileExtension)] = this.sch_frame, _a), this.sheets));
|
|
50
|
-
};
|
|
51
|
-
return KiCadProjectAchieve;
|
|
52
|
-
}());
|
|
53
|
-
export { KiCadProjectAchieve };
|
|
28
|
+
get_project_directive_file_name(ext) {
|
|
29
|
+
return `${this.project_name}.${ext}`;
|
|
30
|
+
}
|
|
31
|
+
toZip() {
|
|
32
|
+
return zipFiles({
|
|
33
|
+
[this.get_project_directive_file_name(ProjectLocalSettingsFileExtension)]: JSON.stringify(this.kicad_prl),
|
|
34
|
+
[this.get_project_directive_file_name(ProjectFileExtension)]: JSON.stringify(this.kicad_pro),
|
|
35
|
+
[this.get_project_directive_file_name(DrawingSheetFileExtension)]: this.sch_frame,
|
|
36
|
+
...this.sheets,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|