@modular-circuit/transpiler 0.0.58 → 0.0.61
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 +25 -109
- package/build/builder/graph_to_kicad/index.js +9 -61
- package/build/builder/index.js +5 -1
- package/build/converter/graph_to_netlist/context.js +2 -0
- package/build/converter/graph_to_netlist/graph_converter.js +57 -173
- package/build/converter/graph_to_netlist/index.js +18 -2
- package/build/converter/index.js +19 -3
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +7 -4
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +4 -1
- package/build/converter/kicad_sexpr/eeschema/index.js +18 -2
- package/build/converter/kicad_sexpr/eeschema/printer.js +232 -281
- package/build/converter/kicad_sexpr/index.js +18 -2
- package/build/converter/kicad_sexpr/pcb/index.js +2 -1
- package/build/converter/link_to_netlist/context.js +2 -0
- package/build/converter/link_to_netlist/converter.js +84 -138
- package/build/converter/link_to_netlist/index.js +18 -2
- package/build/converter/link_to_netlist/links/converter_base.js +44 -131
- package/build/converter/link_to_netlist/links/converters.js +333 -556
- package/build/converter/link_to_netlist/links/index.js +18 -2
- package/build/converter/netlist_to_kicad/context.js +2 -0
- package/build/converter/netlist_to_kicad/index.js +19 -3
- package/build/converter/netlist_to_kicad/layout.js +26 -25
- package/build/converter/netlist_to_kicad/netlist_converter.js +93 -182
- package/build/index.js +21 -5
- package/build/kicad/constraints/index.js +4 -1
- package/build/kicad/label/index.js +18 -2
- package/build/kicad/label/net_label.js +10 -6
- package/build/kicad/label/sheet_pin.js +19 -23
- package/build/kicad/project/index.js +18 -2
- package/build/kicad/project/kicad_prl.js +7 -3
- package/build/kicad/project/kicad_pro.js +9 -5
- package/build/kicad/project/kicad_project_achieve.js +40 -50
- package/build/kicad/project/wildcards_and_files_ext.js +65 -61
- package/build/kicad/sheet/index.js +17 -1
- package/build/kicad/sheet/sheet.js +12 -8
- package/build/kicad/symbols/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/gnd.js +24 -20
- package/build/kicad/symbols/lib_symbol/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/vcc.js +25 -21
- package/build/kicad/symbols/sch_symbol/gnd.js +23 -19
- package/build/kicad/symbols/sch_symbol/index.js +18 -2
- package/build/kicad/symbols/sch_symbol/vcc.js +23 -19
- package/build/kicad/symbols/symbol_utils.js +5 -1
- package/build/utils/collect_sub_sheets.js +35 -146
- package/build/utils/constraints.js +9 -6
- package/build/utils/filter_null_undefined.js +6 -32
- package/build/utils/index.js +20 -4
- package/build/utils/string_formatter.js +27 -29
- package/package.json +5 -5
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./converters"), exports);
|
|
18
|
+
__exportStar(require("./converter_base"), exports);
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./context"), exports);
|
|
18
|
+
__exportStar(require("./layout"), exports);
|
|
19
|
+
__exportStar(require("./netlist_converter"), exports);
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Layout = exports.BLOCK_PIN_GAP = void 0;
|
|
4
|
+
exports.get_power_pos = get_power_pos;
|
|
5
|
+
const constraints_1 = require("../../utils/constraints");
|
|
6
|
+
const POWER_START_Y = 30;
|
|
7
|
+
const POWER_START_X = constraints_1.PAPER_SIZE.A4.height - 30;
|
|
8
|
+
const POWER_Y_STEP = 16;
|
|
9
|
+
function get_power_pos(pwr_number) {
|
|
6
10
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 = {
|
|
12
|
+
const BLOCK_START_Y = 36;
|
|
13
|
+
const BLOCK_START_X = BLOCK_START_Y;
|
|
14
|
+
exports.BLOCK_PIN_GAP = 4;
|
|
15
|
+
const BLOCK_MARGIN_TOP = 8;
|
|
16
|
+
const BLOCK_WIDTH = 36;
|
|
17
|
+
const BLOCK_MARGIN_LEFT = 16;
|
|
18
|
+
const BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
19
|
+
class Layout {
|
|
20
|
+
width = BLOCK_START_X;
|
|
21
|
+
height = BLOCK_START_Y;
|
|
22
|
+
max_height = 0;
|
|
23
|
+
get_block_rect(pin_num) {
|
|
24
|
+
const block_height = (exports.BLOCK_PIN_GAP * pin_num) / 2 + exports.BLOCK_PIN_GAP * 2;
|
|
25
|
+
const rect = {
|
|
24
26
|
pos: {
|
|
25
27
|
x: this.width,
|
|
26
28
|
y: this.height,
|
|
@@ -38,7 +40,6 @@ var Layout = /** @class */ (function () {
|
|
|
38
40
|
this.max_height = 0;
|
|
39
41
|
}
|
|
40
42
|
return rect;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export { Layout };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Layout = Layout;
|
|
@@ -1,96 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
import { PowerShape } from '@modular-circuit/electronics-model';
|
|
29
|
-
import { MODULAR_CIRCUIT_SCH_EXT } from '@modular-circuit/ir';
|
|
30
|
-
import { replaceAll } from '@modular-circuit/utils';
|
|
31
|
-
import { gen_hierarchical_label, gen_net_label, gen_sheet_pin } from '../../kicad/label';
|
|
32
|
-
import { gen_sch_sheet } from '../../kicad/sheet';
|
|
33
|
-
import { gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc } from '../../kicad/symbols';
|
|
34
|
-
import { GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/constraints';
|
|
35
|
-
import { BLOCK_PIN_GAP, Layout, get_power_pos } from './layout';
|
|
36
|
-
var NetListConverter = /** @class */ (function () {
|
|
37
|
-
function NetListConverter(ctx) {
|
|
38
|
-
var e_1, _a, e_2, _b;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetListConverter = void 0;
|
|
4
|
+
const electronics_model_1 = require("@modular-circuit/electronics-model");
|
|
5
|
+
const ir_1 = require("@modular-circuit/ir");
|
|
6
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
7
|
+
const label_1 = require("../../kicad/label");
|
|
8
|
+
const sheet_1 = require("../../kicad/sheet");
|
|
9
|
+
const symbols_1 = require("../../kicad/symbols");
|
|
10
|
+
const constraints_1 = require("../../utils/constraints");
|
|
11
|
+
const layout_1 = require("./layout");
|
|
12
|
+
class NetListConverter {
|
|
13
|
+
ctx;
|
|
14
|
+
block_calc;
|
|
15
|
+
sheet_pwr_count = 0;
|
|
16
|
+
net_name = {};
|
|
17
|
+
constructor(ctx) {
|
|
39
18
|
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);
|
|
19
|
+
for (const net of this.ctx.netlist.nets) {
|
|
20
|
+
for (const it of net.pins) {
|
|
21
|
+
this.net_name[it] = net.name;
|
|
64
22
|
}
|
|
65
|
-
finally { if (e_1) throw e_1.error; }
|
|
66
23
|
}
|
|
67
24
|
}
|
|
68
|
-
|
|
25
|
+
pin_is_connected(id) {
|
|
69
26
|
return this.net_name[id] !== undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
27
|
+
}
|
|
28
|
+
get_pin_net_name(id) {
|
|
72
29
|
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; }
|
|
30
|
+
}
|
|
31
|
+
convert_to_kicad() {
|
|
32
|
+
const all_sch = {};
|
|
33
|
+
for (const [k, v] of Object.entries(this.ctx.netlist.schematics)) {
|
|
34
|
+
this.sheet_pwr_count = 0;
|
|
35
|
+
this.block_calc = new layout_1.Layout();
|
|
36
|
+
all_sch[k] = this.convert_sch(k, v);
|
|
91
37
|
}
|
|
92
38
|
return all_sch;
|
|
93
|
-
}
|
|
39
|
+
}
|
|
94
40
|
/**
|
|
95
41
|
* Convert a schematic to a kicad schematic
|
|
96
42
|
* @param name The name of the graph ,also the file name of the converted schematic
|
|
@@ -98,20 +44,18 @@ var NetListConverter = /** @class */ (function () {
|
|
|
98
44
|
* no need to handle them before the other types of label are introduced, e.g. global or hierarchical
|
|
99
45
|
* @returns
|
|
100
46
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
generator: GENERATOR_NAME,
|
|
108
|
-
generator_version: GENERATOR_VERSION,
|
|
47
|
+
convert_sch(name, schematic) {
|
|
48
|
+
const powers = new Set();
|
|
49
|
+
const sch = {
|
|
50
|
+
version: constraints_1.SCH_VERSION,
|
|
51
|
+
generator: constraints_1.GENERATOR_NAME,
|
|
52
|
+
generator_version: constraints_1.GENERATOR_VERSION,
|
|
109
53
|
paper: {
|
|
110
54
|
size: 'A4',
|
|
111
55
|
},
|
|
112
56
|
title_block: {
|
|
113
|
-
title: name.replace(
|
|
114
|
-
date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
|
|
57
|
+
title: name.replace(`.${ir_1.MODULAR_CIRCUIT_SCH_EXT}`, ''),
|
|
58
|
+
date: (0, utils_1.replaceAll)(new Date().toISOString().slice(0, 10), '-', '/'),
|
|
115
59
|
rev: '1.0',
|
|
116
60
|
comment: {
|
|
117
61
|
1: 'https://www.eda.cn',
|
|
@@ -127,111 +71,78 @@ var NetListConverter = /** @class */ (function () {
|
|
|
127
71
|
labels: [],
|
|
128
72
|
sheets: [],
|
|
129
73
|
};
|
|
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);
|
|
74
|
+
for (const it of schematic.powers) {
|
|
75
|
+
if (!powers.has(it.value)) {
|
|
76
|
+
switch (it.shape) {
|
|
77
|
+
case electronics_model_1.PowerShape.VCC:
|
|
78
|
+
sch.lib_symbols?.symbols.push((0, symbols_1.gen_lib_vcc)(it.value));
|
|
79
|
+
break;
|
|
80
|
+
case electronics_model_1.PowerShape.GND:
|
|
81
|
+
sch.lib_symbols?.symbols.push((0, symbols_1.gen_lib_gnd)(it.value));
|
|
82
|
+
break;
|
|
143
83
|
}
|
|
144
|
-
|
|
84
|
+
powers.add(it.value);
|
|
145
85
|
}
|
|
86
|
+
this.convert_pwr_symbol(it, (0, layout_1.get_power_pos)(this.sheet_pwr_count++), sch);
|
|
146
87
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
finally { if (e_4) throw e_4.error; }
|
|
88
|
+
const sheet_names_count = new Map();
|
|
89
|
+
for (const it of schematic.sheet_symbols.sort((a, b) => {
|
|
90
|
+
return b.pins.length - a.pins.length;
|
|
91
|
+
})) {
|
|
92
|
+
this.convert_sheet_symbol(it, this.block_calc.get_block_rect(it.pins.length), sch, sheet_names_count);
|
|
153
93
|
}
|
|
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; }
|
|
94
|
+
// Finally the hierarchical labels
|
|
95
|
+
for (const it of schematic.hiera_labels) {
|
|
96
|
+
this.convert_hierarchical_label(it, sch);
|
|
183
97
|
}
|
|
184
98
|
return sch;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
NetListConverter.prototype.convert_pwr_symbol = function (pwr, at, sch) {
|
|
99
|
+
}
|
|
100
|
+
convert_hierarchical_label(pin, sch) {
|
|
101
|
+
const pin_pos = this.block_calc.get_block_rect(1).pos;
|
|
102
|
+
sch.labels?.push((0, label_1.gen_hierarchical_label)(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
|
|
103
|
+
}
|
|
104
|
+
convert_pwr_symbol(pwr, at, sch) {
|
|
192
105
|
// NOTE : The power uuid is used as the uuid of its pin ,cause all power symbols have only one pin
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
? gen_sch_vcc(pwr.value, this.sheet_pwr_count, pin_id, at)
|
|
196
|
-
: gen_sch_gnd(pwr.value, this.sheet_pwr_count, pin_id, at);
|
|
106
|
+
const pin_id = pwr.uuid;
|
|
107
|
+
const sch_pwr_symbol = pwr.shape === electronics_model_1.PowerShape.VCC
|
|
108
|
+
? (0, symbols_1.gen_sch_vcc)(pwr.value, this.sheet_pwr_count, pin_id, at)
|
|
109
|
+
: (0, symbols_1.gen_sch_gnd)(pwr.value, this.sheet_pwr_count, pin_id, at);
|
|
197
110
|
sch.symbols.push(sch_pwr_symbol);
|
|
198
111
|
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
|
-
|
|
112
|
+
}
|
|
113
|
+
convert_sheet_symbol(sheet_sym, rect, sch, sheet_names_count) {
|
|
114
|
+
const port_count = sheet_sym.pins.length;
|
|
115
|
+
const pins = [];
|
|
116
|
+
for (let i = 0; i < port_count; i++) {
|
|
117
|
+
const is_left = i < port_count / 2;
|
|
118
|
+
const x = is_left ? rect.pos.x : rect.pos.x + rect.size.x;
|
|
119
|
+
const y = rect.pos.y + layout_1.BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
|
|
120
|
+
const justify = is_left ? 'left' : 'right';
|
|
121
|
+
const rotation = is_left ? 180 : 0;
|
|
122
|
+
pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x, y }, sch, justify, rotation));
|
|
123
|
+
}
|
|
124
|
+
let sheet_name = sheet_sym.sheet_name;
|
|
212
125
|
if (sheet_names_count.has(sheet_name)) {
|
|
213
|
-
|
|
214
|
-
sheet_name +=
|
|
126
|
+
const count = sheet_names_count.get(sheet_name);
|
|
127
|
+
sheet_name += `_${count}`;
|
|
215
128
|
sheet_names_count.set(sheet_name, count + 1);
|
|
216
129
|
}
|
|
217
130
|
else {
|
|
218
131
|
sheet_names_count.set(sheet_name, 1);
|
|
219
132
|
}
|
|
220
|
-
sch.sheets.push(gen_sch_sheet(rect, pins, {
|
|
133
|
+
sch.sheets.push((0, sheet_1.gen_sch_sheet)(rect, pins, {
|
|
221
134
|
Sheetfile: sheet_sym.sheet_file_name,
|
|
222
135
|
Sheetname: sheet_name,
|
|
223
136
|
}));
|
|
224
|
-
}
|
|
225
|
-
|
|
137
|
+
}
|
|
138
|
+
convert_sheet_pin(pin, pin_pos, sch, horizontal, rotation) {
|
|
226
139
|
if (this.pin_is_connected(pin.uuid)) {
|
|
227
140
|
this.convert_net_label(this.get_pin_net_name(pin.uuid), pin_pos, sch, horizontal === 'left' ? 'right' : 'left');
|
|
228
141
|
}
|
|
229
|
-
return gen_sheet_pin(pin.name, pin_pos, { horizontal
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}());
|
|
237
|
-
export { NetListConverter };
|
|
142
|
+
return (0, label_1.gen_sheet_pin)(pin.name, pin_pos, { horizontal, vertical: 'bottom' }, rotation, pin.shape);
|
|
143
|
+
}
|
|
144
|
+
convert_net_label(net_name, pin_pos, sch, horizontal = 'right') {
|
|
145
|
+
sch.labels.push((0, label_1.gen_net_label)(net_name, pin_pos, { horizontal, vertical: 'bottom' }));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.NetListConverter = NetListConverter;
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./converter"), exports);
|
|
18
|
+
__exportStar(require("./builder"), exports);
|
|
19
|
+
__exportStar(require("./kicad/project"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./kicad/symbols"), exports);
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./net_label"), exports);
|
|
18
|
+
__exportStar(require("./sheet_pin"), exports);
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_net_label = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../constraints");
|
|
6
|
+
const gen_net_label = (name, at, justify) => ({
|
|
4
7
|
label_type: 'label',
|
|
5
8
|
text: name,
|
|
6
9
|
fields: [],
|
|
7
10
|
fields_autoplaced: true,
|
|
8
11
|
at: { position: at, rotation: 0 },
|
|
9
12
|
effects: {
|
|
10
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
13
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
11
14
|
justify: justify,
|
|
12
15
|
},
|
|
13
|
-
uuid: gen_uuid(),
|
|
14
|
-
});
|
|
16
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
17
|
+
});
|
|
18
|
+
exports.gen_net_label = gen_net_label;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { gen_uuid } from '@modular-circuit/utils';
|
|
13
|
-
import { DEFAULT_FONT_SIZE } from '../constraints';
|
|
14
|
-
var gen_base_hierarchical_label = function (text, at, justify, rotation, shape) { return ({
|
|
15
|
-
shape: shape,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_hierarchical_label = exports.gen_sheet_pin = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../constraints");
|
|
6
|
+
const gen_base_hierarchical_label = (text, at, justify, rotation, shape) => ({
|
|
7
|
+
shape,
|
|
16
8
|
effects: {
|
|
17
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
18
|
-
justify
|
|
9
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
10
|
+
justify,
|
|
19
11
|
},
|
|
20
|
-
text
|
|
21
|
-
at: { position: at, rotation
|
|
22
|
-
uuid: gen_uuid(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
text,
|
|
13
|
+
at: { position: at, rotation },
|
|
14
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
15
|
+
});
|
|
16
|
+
const gen_sheet_pin = (text, at, justify, rotation, shape) => ({
|
|
17
|
+
label_type: 'hierarchical_label',
|
|
18
|
+
...gen_base_hierarchical_label(text, at, justify, rotation, shape),
|
|
19
|
+
});
|
|
20
|
+
exports.gen_sheet_pin = gen_sheet_pin;
|
|
21
|
+
exports.gen_hierarchical_label = exports.gen_sheet_pin;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./wildcards_and_files_ext"), exports);
|
|
18
|
+
__exportStar(require("./kicad_project_achieve"), exports);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kicad_prl = void 0;
|
|
4
|
+
const kicad_prl = (prj_name) => ({
|
|
2
5
|
board: {
|
|
3
6
|
active_layer: 0,
|
|
4
7
|
active_layer_preset: '',
|
|
@@ -41,10 +44,11 @@ export var kicad_prl = function (prj_name) { return ({
|
|
|
41
44
|
ssh_key: '',
|
|
42
45
|
},
|
|
43
46
|
meta: {
|
|
44
|
-
filename:
|
|
47
|
+
filename: `${prj_name}.kicad_prl`,
|
|
45
48
|
version: 3,
|
|
46
49
|
},
|
|
47
50
|
project: {
|
|
48
51
|
files: [],
|
|
49
52
|
},
|
|
50
|
-
});
|
|
53
|
+
});
|
|
54
|
+
exports.kicad_prl = kicad_prl;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kicad_pro = void 0;
|
|
4
|
+
const wildcards_and_files_ext_1 = require("./wildcards_and_files_ext");
|
|
5
|
+
const kicad_pro = (project_name) => ({
|
|
3
6
|
board: {
|
|
4
7
|
'3dviewports': [],
|
|
5
8
|
ipc2581: {
|
|
@@ -76,7 +79,7 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
76
79
|
pinned_symbol_libs: [],
|
|
77
80
|
},
|
|
78
81
|
meta: {
|
|
79
|
-
filename:
|
|
82
|
+
filename: `${project_name}.kicad_pro`,
|
|
80
83
|
version: 1,
|
|
81
84
|
},
|
|
82
85
|
net_settings: {
|
|
@@ -208,7 +211,7 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
208
211
|
version: 1,
|
|
209
212
|
},
|
|
210
213
|
net_format_name: '',
|
|
211
|
-
page_layout_descr_file:
|
|
214
|
+
page_layout_descr_file: `${project_name}.${wildcards_and_files_ext_1.DrawingSheetFileExtension}`,
|
|
212
215
|
plot_directory: '',
|
|
213
216
|
spice_current_sheet_as_root: false,
|
|
214
217
|
spice_external_command: 'spice "%I"',
|
|
@@ -221,4 +224,5 @@ export var kicad_pro = function (project_name) { return ({
|
|
|
221
224
|
},
|
|
222
225
|
sheets: [],
|
|
223
226
|
text_variables: {},
|
|
224
|
-
});
|
|
227
|
+
});
|
|
228
|
+
exports.kicad_pro = kicad_pro;
|