@tscircuit/internal-dynamic-import 0.0.16 → 0.0.17
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 +112 -14
- package/dist/index.d.ts +624 -3
- package/dist/index.js +72 -28
- package/dist/index.js.map +1 -1
- package/lib/create-importer.ts +27 -0
- package/lib/dynamic-import-resolver.ts +58 -0
- package/lib/dynamic-module-registry.ts +37 -0
- package/lib/import-urls.ts +27 -0
- package/lib/index.ts +46 -0
- package/lib/supported-modules.ts +88 -0
- package/lib/type-bundles/@tscircuit/circuit-json-schematic-placement-analysis.d.ts +593 -0
- package/lib/type-bundles/circuit-json-to-3d-png.d.ts +48 -0
- package/lib/type-bundles/circuit-json-to-bom-csv.d.ts +36 -0
- package/lib/type-bundles/circuit-json-to-bpc.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-connectivity-map.d.ts +44 -0
- package/lib/type-bundles/circuit-json-to-fdm-component-box.d.ts +160 -0
- package/lib/type-bundles/circuit-json-to-gerber.d.ts +672 -0
- package/lib/type-bundles/circuit-json-to-gltf.d.ts +273 -0
- package/lib/type-bundles/circuit-json-to-kicad.d.ts +392 -0
- package/lib/type-bundles/circuit-json-to-lbrn.d.ts +54 -0
- package/lib/type-bundles/circuit-json-to-pnp-csv.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-readable-netlist.d.ts +5 -0
- package/lib/type-bundles/circuit-json-to-simple-3d.d.ts +41 -0
- package/lib/type-bundles/circuit-json-to-spice.d.ts +242 -0
- package/lib/type-bundles/circuit-json-to-step.d.ts +28 -0
- package/lib/type-bundles/circuit-json-to-tscircuit.d.ts +14 -0
- package/lib/type-bundles/circuit-to-canvas.d.ts +646 -0
- package/lib/type-bundles/circuit-to-svg.d.ts +399 -0
- package/lib/type-bundles/kicad-to-circuit-json.d.ts +375 -0
- package/package.json +10 -3
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
import { AnyZodObject, z } from 'zod';
|
|
2
|
+
import { LayerRef, AnyCircuitElement } from 'circuit-json';
|
|
3
|
+
|
|
4
|
+
interface ExcellonDrillCommandDef<K extends string, T extends AnyZodObject | z.ZodIntersection<any, any>> {
|
|
5
|
+
command_code: K;
|
|
6
|
+
schema: T;
|
|
7
|
+
stringify: (c: z.infer<T>) => string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const excellon_drill_command_map: {
|
|
11
|
+
G00: ExcellonDrillCommandDef<"G00", z.ZodObject<{
|
|
12
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G00">>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
command_code: "G00";
|
|
15
|
+
}, {
|
|
16
|
+
command_code?: "G00" | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
G01: ExcellonDrillCommandDef<"G01", z.ZodObject<{
|
|
19
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G01">>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
command_code: "G01";
|
|
22
|
+
}, {
|
|
23
|
+
command_code?: "G01" | undefined;
|
|
24
|
+
}>>;
|
|
25
|
+
G85: ExcellonDrillCommandDef<"G85", z.ZodObject<{
|
|
26
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G85">>;
|
|
27
|
+
x: z.ZodNumber;
|
|
28
|
+
y: z.ZodNumber;
|
|
29
|
+
width: z.ZodNumber;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
command_code: "G85";
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
}, {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
width: number;
|
|
39
|
+
command_code?: "G85" | undefined;
|
|
40
|
+
}>>;
|
|
41
|
+
M48: ExcellonDrillCommandDef<"M48", z.ZodObject<{
|
|
42
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M48">>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
command_code: "M48";
|
|
45
|
+
}, {
|
|
46
|
+
command_code?: "M48" | undefined;
|
|
47
|
+
}>>;
|
|
48
|
+
M95: ExcellonDrillCommandDef<"M95", z.ZodObject<{
|
|
49
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M95">>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
command_code: "M95";
|
|
52
|
+
}, {
|
|
53
|
+
command_code?: "M95" | undefined;
|
|
54
|
+
}>>;
|
|
55
|
+
FMAT: ExcellonDrillCommandDef<"FMAT", z.ZodObject<{
|
|
56
|
+
command_code: z.ZodDefault<z.ZodLiteral<"FMAT">>;
|
|
57
|
+
format: z.ZodNumber;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
command_code: "FMAT";
|
|
60
|
+
format: number;
|
|
61
|
+
}, {
|
|
62
|
+
format: number;
|
|
63
|
+
command_code?: "FMAT" | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
unit_format: ExcellonDrillCommandDef<"unit_format", z.ZodObject<{
|
|
66
|
+
command_code: z.ZodDefault<z.ZodLiteral<"unit_format">>;
|
|
67
|
+
unit: z.ZodUnion<[z.ZodLiteral<"INCH">, z.ZodLiteral<"METRIC">]>;
|
|
68
|
+
lz: z.ZodDefault<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"LZ">, z.ZodLiteral<"TZ">]>>>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
command_code: "unit_format";
|
|
71
|
+
unit: "INCH" | "METRIC";
|
|
72
|
+
lz: "LZ" | "TZ" | null;
|
|
73
|
+
}, {
|
|
74
|
+
unit: "INCH" | "METRIC";
|
|
75
|
+
command_code?: "unit_format" | undefined;
|
|
76
|
+
lz?: "LZ" | "TZ" | null | undefined;
|
|
77
|
+
}>>;
|
|
78
|
+
aper_function_header: ExcellonDrillCommandDef<"aper_function_header", z.ZodObject<{
|
|
79
|
+
command_code: z.ZodDefault<z.ZodLiteral<"aper_function_header">>;
|
|
80
|
+
is_plated: z.ZodBoolean;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
command_code: "aper_function_header";
|
|
83
|
+
is_plated: boolean;
|
|
84
|
+
}, {
|
|
85
|
+
is_plated: boolean;
|
|
86
|
+
command_code?: "aper_function_header" | undefined;
|
|
87
|
+
}>>;
|
|
88
|
+
percent_sign: ExcellonDrillCommandDef<"percent_sign", z.ZodObject<{
|
|
89
|
+
command_code: z.ZodDefault<z.ZodLiteral<"percent_sign">>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
command_code: "percent_sign";
|
|
92
|
+
}, {
|
|
93
|
+
command_code?: "percent_sign" | undefined;
|
|
94
|
+
}>>;
|
|
95
|
+
T: ExcellonDrillCommandDef<"define_tool", z.ZodObject<{
|
|
96
|
+
command_code: z.ZodDefault<z.ZodLiteral<"define_tool">>;
|
|
97
|
+
tool_number: z.ZodNumber;
|
|
98
|
+
diameter: z.ZodNumber;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
command_code: "define_tool";
|
|
101
|
+
tool_number: number;
|
|
102
|
+
diameter: number;
|
|
103
|
+
}, {
|
|
104
|
+
tool_number: number;
|
|
105
|
+
diameter: number;
|
|
106
|
+
command_code?: "define_tool" | undefined;
|
|
107
|
+
}>>;
|
|
108
|
+
define_tool: ExcellonDrillCommandDef<"define_tool", z.ZodObject<{
|
|
109
|
+
command_code: z.ZodDefault<z.ZodLiteral<"define_tool">>;
|
|
110
|
+
tool_number: z.ZodNumber;
|
|
111
|
+
diameter: z.ZodNumber;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
command_code: "define_tool";
|
|
114
|
+
tool_number: number;
|
|
115
|
+
diameter: number;
|
|
116
|
+
}, {
|
|
117
|
+
tool_number: number;
|
|
118
|
+
diameter: number;
|
|
119
|
+
command_code?: "define_tool" | undefined;
|
|
120
|
+
}>>;
|
|
121
|
+
use_tool: ExcellonDrillCommandDef<"use_tool", z.ZodObject<{
|
|
122
|
+
command_code: z.ZodDefault<z.ZodLiteral<"use_tool">>;
|
|
123
|
+
tool_number: z.ZodNumber;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
command_code: "use_tool";
|
|
126
|
+
tool_number: number;
|
|
127
|
+
}, {
|
|
128
|
+
tool_number: number;
|
|
129
|
+
command_code?: "use_tool" | undefined;
|
|
130
|
+
}>>;
|
|
131
|
+
G90: ExcellonDrillCommandDef<"G90", z.ZodObject<{
|
|
132
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G90">>;
|
|
133
|
+
}, "strip", z.ZodTypeAny, {
|
|
134
|
+
command_code: "G90";
|
|
135
|
+
}, {
|
|
136
|
+
command_code?: "G90" | undefined;
|
|
137
|
+
}>>;
|
|
138
|
+
G05: ExcellonDrillCommandDef<"G05", z.ZodObject<{
|
|
139
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G05">>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
command_code: "G05";
|
|
142
|
+
}, {
|
|
143
|
+
command_code?: "G05" | undefined;
|
|
144
|
+
}>>;
|
|
145
|
+
M15: ExcellonDrillCommandDef<"M15", z.ZodObject<{
|
|
146
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M15">>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
command_code: "M15";
|
|
149
|
+
}, {
|
|
150
|
+
command_code?: "M15" | undefined;
|
|
151
|
+
}>>;
|
|
152
|
+
M16: ExcellonDrillCommandDef<"M16", z.ZodObject<{
|
|
153
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M16">>;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
command_code: "M16";
|
|
156
|
+
}, {
|
|
157
|
+
command_code?: "M16" | undefined;
|
|
158
|
+
}>>;
|
|
159
|
+
M30: ExcellonDrillCommandDef<"M30", z.ZodObject<{
|
|
160
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M30">>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
command_code: "M30";
|
|
163
|
+
}, {
|
|
164
|
+
command_code?: "M30" | undefined;
|
|
165
|
+
}>>;
|
|
166
|
+
drill_at: ExcellonDrillCommandDef<"drill_at", z.ZodObject<{
|
|
167
|
+
command_code: z.ZodDefault<z.ZodLiteral<"drill_at">>;
|
|
168
|
+
x: z.ZodNumber;
|
|
169
|
+
y: z.ZodNumber;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
command_code: "drill_at";
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
}, {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
command_code?: "drill_at" | undefined;
|
|
178
|
+
}>>;
|
|
179
|
+
header_comment: ExcellonDrillCommandDef<"header_comment", z.ZodObject<{
|
|
180
|
+
command_code: z.ZodDefault<z.ZodLiteral<"header_comment">>;
|
|
181
|
+
text: z.ZodString;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
command_code: "header_comment";
|
|
184
|
+
text: string;
|
|
185
|
+
}, {
|
|
186
|
+
text: string;
|
|
187
|
+
command_code?: "header_comment" | undefined;
|
|
188
|
+
}>>;
|
|
189
|
+
header_attribute: ExcellonDrillCommandDef<"header_attribute", z.ZodObject<{
|
|
190
|
+
command_code: z.ZodDefault<z.ZodLiteral<"header_attribute">>;
|
|
191
|
+
attribute_name: z.ZodString;
|
|
192
|
+
attribute_value: z.ZodString;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
command_code: "header_attribute";
|
|
195
|
+
attribute_name: string;
|
|
196
|
+
attribute_value: string;
|
|
197
|
+
}, {
|
|
198
|
+
attribute_name: string;
|
|
199
|
+
attribute_value: string;
|
|
200
|
+
command_code?: "header_attribute" | undefined;
|
|
201
|
+
}>>;
|
|
202
|
+
rewind: ExcellonDrillCommandDef<"rewind", z.ZodObject<{
|
|
203
|
+
command_code: z.ZodDefault<z.ZodLiteral<"rewind">>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
command_code: "rewind";
|
|
206
|
+
}, {
|
|
207
|
+
command_code?: "rewind" | undefined;
|
|
208
|
+
}>>;
|
|
209
|
+
};
|
|
210
|
+
type AnyExcellonDrillCommand = z.infer<(typeof excellon_drill_command_map)[keyof typeof excellon_drill_command_map]["schema"]>;
|
|
211
|
+
|
|
212
|
+
declare const stringifyExcellonDrill: (commands: Array<AnyExcellonDrillCommand>) => string;
|
|
213
|
+
|
|
214
|
+
type DrillLayerSpan = {
|
|
215
|
+
from_layer: LayerRef;
|
|
216
|
+
to_layer: LayerRef;
|
|
217
|
+
};
|
|
218
|
+
declare const convertSoupToExcellonDrillCommands: ({ circuitJson, is_plated, flip_y_axis, layer_span, }: {
|
|
219
|
+
circuitJson: Array<AnyCircuitElement>;
|
|
220
|
+
is_plated: boolean;
|
|
221
|
+
flip_y_axis?: boolean;
|
|
222
|
+
layer_span?: DrillLayerSpan;
|
|
223
|
+
}) => Array<AnyExcellonDrillCommand>;
|
|
224
|
+
declare const convertSoupToExcellonDrillCommandLayers: ({ circuitJson, flip_y_axis, }: {
|
|
225
|
+
circuitJson: Array<AnyCircuitElement>;
|
|
226
|
+
flip_y_axis?: boolean;
|
|
227
|
+
}) => Record<string, Array<AnyExcellonDrillCommand>>;
|
|
228
|
+
|
|
229
|
+
declare class ExcellonDrillBuilder {
|
|
230
|
+
commands: Array<AnyExcellonDrillCommand>;
|
|
231
|
+
constructor();
|
|
232
|
+
add<T extends keyof typeof excellon_drill_command_map>(cmd: T, props: z.input<(typeof excellon_drill_command_map)[T]["schema"]>): ExcellonDrillBuilder;
|
|
233
|
+
build(): Array<AnyExcellonDrillCommand>;
|
|
234
|
+
}
|
|
235
|
+
declare const excellonDrill: () => ExcellonDrillBuilder;
|
|
236
|
+
|
|
237
|
+
interface GerberCommandDef<K extends string, T extends AnyZodObject | z.ZodIntersection<any, any>> {
|
|
238
|
+
command_code: K;
|
|
239
|
+
schema: T;
|
|
240
|
+
stringify: (c: z.infer<T>) => string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare const gerber_command_map: {
|
|
244
|
+
readonly add_attribute_on_aperture: GerberCommandDef<"TA", z.ZodObject<{
|
|
245
|
+
command_code: z.ZodDefault<z.ZodLiteral<"TA">>;
|
|
246
|
+
attribute_name: z.ZodString;
|
|
247
|
+
attribute_value: z.ZodString;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
command_code: "TA";
|
|
250
|
+
attribute_name: string;
|
|
251
|
+
attribute_value: string;
|
|
252
|
+
}, {
|
|
253
|
+
attribute_name: string;
|
|
254
|
+
attribute_value: string;
|
|
255
|
+
command_code?: "TA" | undefined;
|
|
256
|
+
}>>;
|
|
257
|
+
readonly add_attribute_on_file: GerberCommandDef<"TF", z.ZodObject<{
|
|
258
|
+
command_code: z.ZodDefault<z.ZodLiteral<"TF">>;
|
|
259
|
+
attribute_name: z.ZodString;
|
|
260
|
+
attribute_value: z.ZodString;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
command_code: "TF";
|
|
263
|
+
attribute_name: string;
|
|
264
|
+
attribute_value: string;
|
|
265
|
+
}, {
|
|
266
|
+
attribute_name: string;
|
|
267
|
+
attribute_value: string;
|
|
268
|
+
command_code?: "TF" | undefined;
|
|
269
|
+
}>>;
|
|
270
|
+
readonly add_attribute_on_object: GerberCommandDef<"TO", z.ZodObject<{
|
|
271
|
+
command_code: z.ZodDefault<z.ZodLiteral<"TO">>;
|
|
272
|
+
attribute_name: z.ZodString;
|
|
273
|
+
attribute_value: z.ZodString;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
command_code: "TO";
|
|
276
|
+
attribute_name: string;
|
|
277
|
+
attribute_value: string;
|
|
278
|
+
}, {
|
|
279
|
+
attribute_name: string;
|
|
280
|
+
attribute_value: string;
|
|
281
|
+
command_code?: "TO" | undefined;
|
|
282
|
+
}>>;
|
|
283
|
+
readonly aperture_block: GerberCommandDef<"AB", z.ZodObject<{
|
|
284
|
+
command_code: z.ZodDefault<z.ZodLiteral<"AB">>;
|
|
285
|
+
block: z.ZodString;
|
|
286
|
+
}, "strip", z.ZodTypeAny, {
|
|
287
|
+
command_code: "AB";
|
|
288
|
+
block: string;
|
|
289
|
+
}, {
|
|
290
|
+
block: string;
|
|
291
|
+
command_code?: "AB" | undefined;
|
|
292
|
+
}>>;
|
|
293
|
+
readonly comment: GerberCommandDef<"G04", z.ZodObject<{
|
|
294
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G04">>;
|
|
295
|
+
comment: z.ZodString;
|
|
296
|
+
}, "strip", z.ZodTypeAny, {
|
|
297
|
+
command_code: "G04";
|
|
298
|
+
comment: string;
|
|
299
|
+
}, {
|
|
300
|
+
comment: string;
|
|
301
|
+
command_code?: "G04" | undefined;
|
|
302
|
+
}>>;
|
|
303
|
+
readonly create_arc: GerberCommandDef<"G75", z.ZodObject<{
|
|
304
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G75">>;
|
|
305
|
+
}, "strip", z.ZodTypeAny, {
|
|
306
|
+
command_code: "G75";
|
|
307
|
+
}, {
|
|
308
|
+
command_code?: "G75" | undefined;
|
|
309
|
+
}>>;
|
|
310
|
+
readonly define_aperture: GerberCommandDef<"AD", z.ZodObject<{
|
|
311
|
+
command_code: z.ZodDefault<z.ZodLiteral<"AD">>;
|
|
312
|
+
aperture_code: z.ZodString;
|
|
313
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
|
+
command_code: "AD";
|
|
315
|
+
aperture_code: string;
|
|
316
|
+
}, {
|
|
317
|
+
aperture_code: string;
|
|
318
|
+
command_code?: "AD" | undefined;
|
|
319
|
+
}>>;
|
|
320
|
+
readonly define_macro_aperture_template: GerberCommandDef<"AM", z.ZodObject<{
|
|
321
|
+
command_code: z.ZodDefault<z.ZodLiteral<"AM">>;
|
|
322
|
+
macro_name: z.ZodString;
|
|
323
|
+
template_code: z.ZodString;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
command_code: "AM";
|
|
326
|
+
macro_name: string;
|
|
327
|
+
template_code: string;
|
|
328
|
+
}, {
|
|
329
|
+
macro_name: string;
|
|
330
|
+
template_code: string;
|
|
331
|
+
command_code?: "AM" | undefined;
|
|
332
|
+
}>>;
|
|
333
|
+
readonly delete_attribute: GerberCommandDef<"TD", z.ZodObject<{
|
|
334
|
+
command_code: z.ZodDefault<z.ZodLiteral<"TD">>;
|
|
335
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
command_code: "TD";
|
|
338
|
+
attribute?: string | undefined;
|
|
339
|
+
}, {
|
|
340
|
+
command_code?: "TD" | undefined;
|
|
341
|
+
attribute?: string | undefined;
|
|
342
|
+
}>>;
|
|
343
|
+
readonly end_of_file: GerberCommandDef<"M02", z.ZodObject<{
|
|
344
|
+
command_code: z.ZodDefault<z.ZodLiteral<"M02">>;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
command_code: "M02";
|
|
347
|
+
}, {
|
|
348
|
+
command_code?: "M02" | undefined;
|
|
349
|
+
}>>;
|
|
350
|
+
readonly move_operation: GerberCommandDef<"D02", z.ZodObject<{
|
|
351
|
+
command_code: z.ZodDefault<z.ZodLiteral<"D02">>;
|
|
352
|
+
x: z.ZodNumber;
|
|
353
|
+
y: z.ZodNumber;
|
|
354
|
+
}, "strip", z.ZodTypeAny, {
|
|
355
|
+
command_code: "D02";
|
|
356
|
+
x: number;
|
|
357
|
+
y: number;
|
|
358
|
+
}, {
|
|
359
|
+
x: number;
|
|
360
|
+
y: number;
|
|
361
|
+
command_code?: "D02" | undefined;
|
|
362
|
+
}>>;
|
|
363
|
+
readonly flash_operation: GerberCommandDef<"D03", z.ZodObject<{
|
|
364
|
+
command_code: z.ZodDefault<z.ZodLiteral<"D03">>;
|
|
365
|
+
x: z.ZodNumber;
|
|
366
|
+
y: z.ZodNumber;
|
|
367
|
+
}, "strip", z.ZodTypeAny, {
|
|
368
|
+
command_code: "D03";
|
|
369
|
+
x: number;
|
|
370
|
+
y: number;
|
|
371
|
+
}, {
|
|
372
|
+
x: number;
|
|
373
|
+
y: number;
|
|
374
|
+
command_code?: "D03" | undefined;
|
|
375
|
+
}>>;
|
|
376
|
+
readonly end_region_statement: GerberCommandDef<"G37", z.ZodObject<{
|
|
377
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G37">>;
|
|
378
|
+
}, "strip", z.ZodTypeAny, {
|
|
379
|
+
command_code: "G37";
|
|
380
|
+
}, {
|
|
381
|
+
command_code?: "G37" | undefined;
|
|
382
|
+
}>>;
|
|
383
|
+
readonly format_specification: GerberCommandDef<"FS", z.ZodObject<{
|
|
384
|
+
command_code: z.ZodDefault<z.ZodLiteral<"FS">>;
|
|
385
|
+
zero_omission_mode: z.ZodDefault<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"L">, z.ZodLiteral<"T">]>>>;
|
|
386
|
+
coordinate_notation: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"A">, z.ZodLiteral<"I">]>>;
|
|
387
|
+
x_integer_digits: z.ZodDefault<z.ZodNumber>;
|
|
388
|
+
x_decimal_digits: z.ZodDefault<z.ZodNumber>;
|
|
389
|
+
y_integer_digits: z.ZodDefault<z.ZodNumber>;
|
|
390
|
+
y_decimal_digits: z.ZodDefault<z.ZodNumber>;
|
|
391
|
+
}, "strip", z.ZodTypeAny, {
|
|
392
|
+
command_code: "FS";
|
|
393
|
+
zero_omission_mode: "T" | "L" | null;
|
|
394
|
+
coordinate_notation: "A" | "I";
|
|
395
|
+
x_integer_digits: number;
|
|
396
|
+
x_decimal_digits: number;
|
|
397
|
+
y_integer_digits: number;
|
|
398
|
+
y_decimal_digits: number;
|
|
399
|
+
}, {
|
|
400
|
+
command_code?: "FS" | undefined;
|
|
401
|
+
zero_omission_mode?: "T" | "L" | null | undefined;
|
|
402
|
+
coordinate_notation?: "A" | "I" | undefined;
|
|
403
|
+
x_integer_digits?: number | undefined;
|
|
404
|
+
x_decimal_digits?: number | undefined;
|
|
405
|
+
y_integer_digits?: number | undefined;
|
|
406
|
+
y_decimal_digits?: number | undefined;
|
|
407
|
+
}>>;
|
|
408
|
+
readonly load_rotation: GerberCommandDef<"LR", z.ZodObject<{
|
|
409
|
+
command_code: z.ZodDefault<z.ZodLiteral<"LR">>;
|
|
410
|
+
rotation_degrees: z.ZodNumber;
|
|
411
|
+
}, "strip", z.ZodTypeAny, {
|
|
412
|
+
command_code: "LR";
|
|
413
|
+
rotation_degrees: number;
|
|
414
|
+
}, {
|
|
415
|
+
rotation_degrees: number;
|
|
416
|
+
command_code?: "LR" | undefined;
|
|
417
|
+
}>>;
|
|
418
|
+
readonly plot_operation: GerberCommandDef<"D01", z.ZodObject<{
|
|
419
|
+
command_code: z.ZodDefault<z.ZodLiteral<"D01">>;
|
|
420
|
+
x: z.ZodNumber;
|
|
421
|
+
y: z.ZodNumber;
|
|
422
|
+
i: z.ZodOptional<z.ZodNumber>;
|
|
423
|
+
j: z.ZodOptional<z.ZodNumber>;
|
|
424
|
+
}, "strip", z.ZodTypeAny, {
|
|
425
|
+
command_code: "D01";
|
|
426
|
+
x: number;
|
|
427
|
+
y: number;
|
|
428
|
+
i?: number | undefined;
|
|
429
|
+
j?: number | undefined;
|
|
430
|
+
}, {
|
|
431
|
+
x: number;
|
|
432
|
+
y: number;
|
|
433
|
+
command_code?: "D01" | undefined;
|
|
434
|
+
i?: number | undefined;
|
|
435
|
+
j?: number | undefined;
|
|
436
|
+
}>>;
|
|
437
|
+
readonly define_aperture_template: GerberCommandDef<"ADD", z.ZodIntersection<z.ZodUnion<[z.ZodDiscriminatedUnion<"standard_template_code", [z.ZodObject<{
|
|
438
|
+
standard_template_code: z.ZodLiteral<"C">;
|
|
439
|
+
diameter: z.ZodNumber;
|
|
440
|
+
hole_diameter: z.ZodOptional<z.ZodNumber>;
|
|
441
|
+
}, "strip", z.ZodTypeAny, {
|
|
442
|
+
diameter: number;
|
|
443
|
+
standard_template_code: "C";
|
|
444
|
+
hole_diameter?: number | undefined;
|
|
445
|
+
}, {
|
|
446
|
+
diameter: number;
|
|
447
|
+
standard_template_code: "C";
|
|
448
|
+
hole_diameter?: number | undefined;
|
|
449
|
+
}>, z.ZodObject<{
|
|
450
|
+
standard_template_code: z.ZodLiteral<"R">;
|
|
451
|
+
x_size: z.ZodNumber;
|
|
452
|
+
y_size: z.ZodNumber;
|
|
453
|
+
hole_diameter: z.ZodOptional<z.ZodNumber>;
|
|
454
|
+
}, "strip", z.ZodTypeAny, {
|
|
455
|
+
standard_template_code: "R";
|
|
456
|
+
x_size: number;
|
|
457
|
+
y_size: number;
|
|
458
|
+
hole_diameter?: number | undefined;
|
|
459
|
+
}, {
|
|
460
|
+
standard_template_code: "R";
|
|
461
|
+
x_size: number;
|
|
462
|
+
y_size: number;
|
|
463
|
+
hole_diameter?: number | undefined;
|
|
464
|
+
}>, z.ZodObject<{
|
|
465
|
+
standard_template_code: z.ZodLiteral<"O">;
|
|
466
|
+
x_size: z.ZodNumber;
|
|
467
|
+
y_size: z.ZodNumber;
|
|
468
|
+
hole_diameter: z.ZodOptional<z.ZodNumber>;
|
|
469
|
+
}, "strip", z.ZodTypeAny, {
|
|
470
|
+
standard_template_code: "O";
|
|
471
|
+
x_size: number;
|
|
472
|
+
y_size: number;
|
|
473
|
+
hole_diameter?: number | undefined;
|
|
474
|
+
}, {
|
|
475
|
+
standard_template_code: "O";
|
|
476
|
+
x_size: number;
|
|
477
|
+
y_size: number;
|
|
478
|
+
hole_diameter?: number | undefined;
|
|
479
|
+
}>, z.ZodObject<{
|
|
480
|
+
standard_template_code: z.ZodLiteral<"P">;
|
|
481
|
+
outer_diameter: z.ZodNumber;
|
|
482
|
+
number_of_vertices: z.ZodNumber;
|
|
483
|
+
rotation: z.ZodOptional<z.ZodNumber>;
|
|
484
|
+
hole_diameter: z.ZodOptional<z.ZodNumber>;
|
|
485
|
+
}, "strip", z.ZodTypeAny, {
|
|
486
|
+
standard_template_code: "P";
|
|
487
|
+
outer_diameter: number;
|
|
488
|
+
number_of_vertices: number;
|
|
489
|
+
hole_diameter?: number | undefined;
|
|
490
|
+
rotation?: number | undefined;
|
|
491
|
+
}, {
|
|
492
|
+
standard_template_code: "P";
|
|
493
|
+
outer_diameter: number;
|
|
494
|
+
number_of_vertices: number;
|
|
495
|
+
hole_diameter?: number | undefined;
|
|
496
|
+
rotation?: number | undefined;
|
|
497
|
+
}>]>, z.ZodDiscriminatedUnion<"macro_name", [z.ZodObject<{
|
|
498
|
+
macro_name: z.ZodLiteral<"HORZPILL">;
|
|
499
|
+
x_size: z.ZodNumber;
|
|
500
|
+
y_size: z.ZodNumber;
|
|
501
|
+
circle_diameter: z.ZodNumber;
|
|
502
|
+
circle_center_offset: z.ZodNumber;
|
|
503
|
+
}, "strip", z.ZodTypeAny, {
|
|
504
|
+
macro_name: "HORZPILL";
|
|
505
|
+
x_size: number;
|
|
506
|
+
y_size: number;
|
|
507
|
+
circle_diameter: number;
|
|
508
|
+
circle_center_offset: number;
|
|
509
|
+
}, {
|
|
510
|
+
macro_name: "HORZPILL";
|
|
511
|
+
x_size: number;
|
|
512
|
+
y_size: number;
|
|
513
|
+
circle_diameter: number;
|
|
514
|
+
circle_center_offset: number;
|
|
515
|
+
}>, z.ZodObject<{
|
|
516
|
+
macro_name: z.ZodLiteral<"VERTPILL">;
|
|
517
|
+
x_size: z.ZodNumber;
|
|
518
|
+
y_size: z.ZodNumber;
|
|
519
|
+
circle_diameter: z.ZodNumber;
|
|
520
|
+
circle_center_offset: z.ZodNumber;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
macro_name: "VERTPILL";
|
|
523
|
+
x_size: number;
|
|
524
|
+
y_size: number;
|
|
525
|
+
circle_diameter: number;
|
|
526
|
+
circle_center_offset: number;
|
|
527
|
+
}, {
|
|
528
|
+
macro_name: "VERTPILL";
|
|
529
|
+
x_size: number;
|
|
530
|
+
y_size: number;
|
|
531
|
+
circle_diameter: number;
|
|
532
|
+
circle_center_offset: number;
|
|
533
|
+
}>, z.ZodObject<{
|
|
534
|
+
macro_name: z.ZodLiteral<"ROUNDRECT">;
|
|
535
|
+
corner_radius: z.ZodNumber;
|
|
536
|
+
corner_1_x: z.ZodNumber;
|
|
537
|
+
corner_1_y: z.ZodNumber;
|
|
538
|
+
corner_2_x: z.ZodNumber;
|
|
539
|
+
corner_2_y: z.ZodNumber;
|
|
540
|
+
corner_3_x: z.ZodNumber;
|
|
541
|
+
corner_3_y: z.ZodNumber;
|
|
542
|
+
corner_4_x: z.ZodNumber;
|
|
543
|
+
corner_4_y: z.ZodNumber;
|
|
544
|
+
}, "strip", z.ZodTypeAny, {
|
|
545
|
+
macro_name: "ROUNDRECT";
|
|
546
|
+
corner_radius: number;
|
|
547
|
+
corner_1_x: number;
|
|
548
|
+
corner_1_y: number;
|
|
549
|
+
corner_2_x: number;
|
|
550
|
+
corner_2_y: number;
|
|
551
|
+
corner_3_x: number;
|
|
552
|
+
corner_3_y: number;
|
|
553
|
+
corner_4_x: number;
|
|
554
|
+
corner_4_y: number;
|
|
555
|
+
}, {
|
|
556
|
+
macro_name: "ROUNDRECT";
|
|
557
|
+
corner_radius: number;
|
|
558
|
+
corner_1_x: number;
|
|
559
|
+
corner_1_y: number;
|
|
560
|
+
corner_2_x: number;
|
|
561
|
+
corner_2_y: number;
|
|
562
|
+
corner_3_x: number;
|
|
563
|
+
corner_3_y: number;
|
|
564
|
+
corner_4_x: number;
|
|
565
|
+
corner_4_y: number;
|
|
566
|
+
}>]>]>, z.ZodObject<{
|
|
567
|
+
command_code: z.ZodDefault<z.ZodLiteral<"ADD">>;
|
|
568
|
+
aperture_number: z.ZodNumber;
|
|
569
|
+
}, "strip", z.ZodTypeAny, {
|
|
570
|
+
command_code: "ADD";
|
|
571
|
+
aperture_number: number;
|
|
572
|
+
}, {
|
|
573
|
+
aperture_number: number;
|
|
574
|
+
command_code?: "ADD" | undefined;
|
|
575
|
+
}>>>;
|
|
576
|
+
readonly set_movement_mode_to_clockwise_circular: GerberCommandDef<"G02", z.ZodObject<{
|
|
577
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G02">>;
|
|
578
|
+
}, "strip", z.ZodTypeAny, {
|
|
579
|
+
command_code: "G02";
|
|
580
|
+
}, {
|
|
581
|
+
command_code?: "G02" | undefined;
|
|
582
|
+
}>>;
|
|
583
|
+
readonly set_movement_mode_to_counterclockwise_circular: GerberCommandDef<"G03", z.ZodObject<{
|
|
584
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G03">>;
|
|
585
|
+
}, "strip", z.ZodTypeAny, {
|
|
586
|
+
command_code: "G03";
|
|
587
|
+
}, {
|
|
588
|
+
command_code?: "G03" | undefined;
|
|
589
|
+
}>>;
|
|
590
|
+
readonly set_movement_mode_to_linear: GerberCommandDef<"G01", z.ZodObject<{
|
|
591
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G01">>;
|
|
592
|
+
}, "strip", z.ZodTypeAny, {
|
|
593
|
+
command_code: "G01";
|
|
594
|
+
}, {
|
|
595
|
+
command_code?: "G01" | undefined;
|
|
596
|
+
}>>;
|
|
597
|
+
readonly select_aperture: GerberCommandDef<"D", z.ZodObject<{
|
|
598
|
+
command_code: z.ZodDefault<z.ZodLiteral<"D">>;
|
|
599
|
+
aperture_number: z.ZodNumber;
|
|
600
|
+
}, "strip", z.ZodTypeAny, {
|
|
601
|
+
command_code: "D";
|
|
602
|
+
aperture_number: number;
|
|
603
|
+
}, {
|
|
604
|
+
aperture_number: number;
|
|
605
|
+
command_code?: "D" | undefined;
|
|
606
|
+
}>>;
|
|
607
|
+
readonly set_unit: GerberCommandDef<"MO", z.ZodObject<{
|
|
608
|
+
command_code: z.ZodDefault<z.ZodLiteral<"MO">>;
|
|
609
|
+
unit: z.ZodEnum<["MM", "in"]>;
|
|
610
|
+
}, "strip", z.ZodTypeAny, {
|
|
611
|
+
command_code: "MO";
|
|
612
|
+
unit: "MM" | "in";
|
|
613
|
+
}, {
|
|
614
|
+
unit: "MM" | "in";
|
|
615
|
+
command_code?: "MO" | undefined;
|
|
616
|
+
}>>;
|
|
617
|
+
readonly set_layer_polarity: GerberCommandDef<"LP", z.ZodObject<{
|
|
618
|
+
command_code: z.ZodDefault<z.ZodLiteral<"LP">>;
|
|
619
|
+
polarity: z.ZodEnum<["D", "C"]>;
|
|
620
|
+
}, "strip", z.ZodTypeAny, {
|
|
621
|
+
command_code: "LP";
|
|
622
|
+
polarity: "C" | "D";
|
|
623
|
+
}, {
|
|
624
|
+
polarity: "C" | "D";
|
|
625
|
+
command_code?: "LP" | undefined;
|
|
626
|
+
}>>;
|
|
627
|
+
readonly start_region_statement: GerberCommandDef<"G36", z.ZodObject<{
|
|
628
|
+
command_code: z.ZodDefault<z.ZodLiteral<"G36">>;
|
|
629
|
+
}, "strip", z.ZodTypeAny, {
|
|
630
|
+
command_code: "G36";
|
|
631
|
+
}, {
|
|
632
|
+
command_code?: "G36" | undefined;
|
|
633
|
+
}>>;
|
|
634
|
+
};
|
|
635
|
+
type AnyGerberCommand = z.infer<(typeof gerber_command_map)[keyof typeof gerber_command_map]["schema"]>;
|
|
636
|
+
|
|
637
|
+
declare const gerberBuilder: () => GerberBuilder;
|
|
638
|
+
declare class GerberBuilder {
|
|
639
|
+
commands: Array<AnyGerberCommand>;
|
|
640
|
+
constructor();
|
|
641
|
+
$if(condition: boolean, fn: (gb: GerberBuilder) => GerberBuilder): GerberBuilder;
|
|
642
|
+
add<T extends keyof typeof gerber_command_map>(cmd: T, props: z.input<(typeof gerber_command_map)[T]["schema"]>): GerberBuilder;
|
|
643
|
+
build(): Array<AnyGerberCommand>;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
declare const stringifyGerberCommandLayers: (commandLayers: Record<string, AnyGerberCommand[]>) => Record<string, string>;
|
|
647
|
+
|
|
648
|
+
declare const stringifyGerberCommand: (command: AnyGerberCommand) => string;
|
|
649
|
+
|
|
650
|
+
declare const stringifyGerberCommands: (commands: AnyGerberCommand[]) => string;
|
|
651
|
+
|
|
652
|
+
type LayerToGerberCommandsMap = {
|
|
653
|
+
[key: string]: AnyGerberCommand[];
|
|
654
|
+
F_Cu: AnyGerberCommand[];
|
|
655
|
+
F_SilkScreen: AnyGerberCommand[];
|
|
656
|
+
F_Mask: AnyGerberCommand[];
|
|
657
|
+
F_Paste: AnyGerberCommand[];
|
|
658
|
+
B_Cu: AnyGerberCommand[];
|
|
659
|
+
B_SilkScreen: AnyGerberCommand[];
|
|
660
|
+
B_Mask: AnyGerberCommand[];
|
|
661
|
+
B_Paste: AnyGerberCommand[];
|
|
662
|
+
Edge_Cuts: AnyGerberCommand[];
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Converts Circuit JSON to arrays of Gerber commands for each layer
|
|
667
|
+
*/
|
|
668
|
+
declare const convertSoupToGerberCommands: (circuitJson: AnyCircuitElement[], opts?: {
|
|
669
|
+
flip_y_axis?: boolean;
|
|
670
|
+
}) => LayerToGerberCommandsMap;
|
|
671
|
+
|
|
672
|
+
export { type DrillLayerSpan, convertSoupToExcellonDrillCommandLayers, convertSoupToExcellonDrillCommands, convertSoupToGerberCommands, excellonDrill, gerberBuilder, stringifyExcellonDrill, stringifyGerberCommand, stringifyGerberCommandLayers, stringifyGerberCommands };
|