kicadts 0.0.1 → 0.0.2
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/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +70 -0
- package/.github/workflows/bun-test.yml +32 -0
- package/.github/workflows/bun-typecheck.yml +26 -0
- package/.vscode/settings.json +1 -1
- package/AGENTS.md +1 -0
- package/LICENSE +21 -0
- package/README.md +101 -91
- package/TODO.md +46 -0
- package/bunfig.toml +2 -2
- package/lib/sexpr/classes/At.ts +15 -0
- package/lib/sexpr/classes/Bus.ts +23 -3
- package/lib/sexpr/classes/BusEntry.ts +30 -3
- package/lib/sexpr/classes/EmbeddedFonts.ts +1 -3
- package/lib/sexpr/classes/Footprint.ts +157 -27
- package/lib/sexpr/classes/FootprintAttr.ts +3 -1
- package/lib/sexpr/classes/FootprintModel.ts +1 -4
- package/lib/sexpr/classes/FootprintNetTiePadGroups.ts +3 -1
- package/lib/sexpr/classes/FootprintPad.ts +206 -54
- package/lib/sexpr/classes/FpArc.ts +23 -0
- package/lib/sexpr/classes/FpCircle.ts +24 -3
- package/lib/sexpr/classes/FpLine.ts +31 -3
- package/lib/sexpr/classes/FpPoly.ts +24 -4
- package/lib/sexpr/classes/FpRect.ts +24 -3
- package/lib/sexpr/classes/FpText.ts +43 -9
- package/lib/sexpr/classes/FpTextBox.ts +43 -5
- package/lib/sexpr/classes/GrLine.ts +20 -1
- package/lib/sexpr/classes/GrText.ts +38 -12
- package/lib/sexpr/classes/Image.ts +38 -11
- package/lib/sexpr/classes/Junction.ts +36 -4
- package/lib/sexpr/classes/KicadPcb.ts +49 -1
- package/lib/sexpr/classes/KicadSch.ts +119 -25
- package/lib/sexpr/classes/Label.ts +45 -5
- package/lib/sexpr/classes/NoConnect.ts +20 -3
- package/lib/sexpr/classes/PadLayers.ts +13 -1
- package/lib/sexpr/classes/PadOptions.ts +4 -5
- package/lib/sexpr/classes/PadPrimitiveGrArc.ts +22 -4
- package/lib/sexpr/classes/PadPrimitiveGrCircle.ts +23 -4
- package/lib/sexpr/classes/PadPrimitives.ts +3 -1
- package/lib/sexpr/classes/PadSize.ts +15 -0
- package/lib/sexpr/classes/PadTeardrops.ts +3 -1
- package/lib/sexpr/classes/PcbGeneral.ts +14 -7
- package/lib/sexpr/classes/PcbLayerDefinition.ts +5 -1
- package/lib/sexpr/classes/Property.ts +64 -9
- package/lib/sexpr/classes/Pts.ts +7 -5
- package/lib/sexpr/classes/SchematicText.ts +39 -9
- package/lib/sexpr/classes/Segment.ts +21 -0
- package/lib/sexpr/classes/SegmentNet.ts +3 -1
- package/lib/sexpr/classes/Setup/PcbPlotParams.ts +10 -50
- package/lib/sexpr/classes/Setup/Setup.ts +12 -11
- package/lib/sexpr/classes/Setup/Stackup.ts +14 -19
- package/lib/sexpr/classes/Setup/StackupLayerProperties.ts +3 -1
- package/lib/sexpr/classes/Setup/StackupProperties.ts +0 -1
- package/lib/sexpr/classes/Setup/base.ts +1 -3
- package/lib/sexpr/classes/Setup/setupMultiValueProperties.ts +0 -1
- package/lib/sexpr/classes/Sheet.ts +85 -3
- package/lib/sexpr/classes/SheetPin.ts +4 -1
- package/lib/sexpr/classes/Symbol.ts +176 -51
- package/lib/sexpr/classes/TextEffects.ts +25 -8
- package/lib/sexpr/classes/TitleBlock.ts +21 -4
- package/lib/sexpr/classes/Via.ts +38 -3
- package/lib/sexpr/classes/ViaNet.ts +2 -1
- package/lib/sexpr/classes/Wire.ts +23 -3
- package/lib/sexpr/classes/Xy.ts +1 -3
- package/lib/sexpr/classes/Zone.ts +1 -3
- package/lib/sexpr/parseToPrimitiveSExpr.ts +6 -1
- package/lib/sexpr/utils/strokeFromArgs.ts +5 -6
- package/lib/sexpr/utils/toStringValue.ts +2 -1
- package/package.json +2 -1
- package/scripts/download-references.ts +24 -22
- package/tests/fixtures/expectEqualPrimitiveSExpr.ts +6 -7
- package/tests/fixtures/png-matcher.ts +109 -0
- package/tests/fixtures/preload.ts +1 -0
- package/tests/sexpr/classes/FootprintPad.test.ts +8 -1
- package/tests/sexpr/classes/Image.test.ts +9 -1
- package/tests/sexpr/classes/KicadSch.test.ts +1 -3
- package/tests/sexpr/classes/Setup.test.ts +0 -1
- package/bun.lock +0 -48
|
@@ -4,20 +4,20 @@ import type { PrimitiveSExpr } from "../parseToPrimitiveSExpr"
|
|
|
4
4
|
import { printSExpr } from "../parseToPrimitiveSExpr"
|
|
5
5
|
import { quoteSExprString } from "../utils/quoteSExprString"
|
|
6
6
|
import { toStringValue } from "../utils/toStringValue"
|
|
7
|
-
import { At } from "./At"
|
|
7
|
+
import { At, type AtInput } from "./At"
|
|
8
8
|
import { PadChamfer } from "./PadChamfer"
|
|
9
9
|
import { PadChamferRatio } from "./PadChamferRatio"
|
|
10
10
|
import { PadClearance } from "./PadClearance"
|
|
11
11
|
import { PadDieLength } from "./PadDieLength"
|
|
12
12
|
import { PadDrill } from "./PadDrill"
|
|
13
|
-
import { PadLayers } from "./PadLayers"
|
|
13
|
+
import { PadLayers, type PadLayersInput } from "./PadLayers"
|
|
14
14
|
import { PadNet } from "./PadNet"
|
|
15
15
|
import { PadOptions } from "./PadOptions"
|
|
16
16
|
import { PadPinFunction } from "./PadPinFunction"
|
|
17
17
|
import { PadPinType } from "./PadPinType"
|
|
18
18
|
import { PadPrimitives } from "./PadPrimitives"
|
|
19
19
|
import { PadRoundrectRratio } from "./PadRoundrectRratio"
|
|
20
|
-
import { PadSize } from "./PadSize"
|
|
20
|
+
import { PadSize, type PadSizeInput } from "./PadSize"
|
|
21
21
|
import { PadSolderMaskMargin } from "./PadSolderMaskMargin"
|
|
22
22
|
import { PadSolderPasteMargin } from "./PadSolderPasteMargin"
|
|
23
23
|
import { PadSolderPasteMarginRatio } from "./PadSolderPasteMarginRatio"
|
|
@@ -77,6 +77,42 @@ const ensureSingle = (
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export interface FootprintPadConstructorParams {
|
|
81
|
+
number?: string
|
|
82
|
+
padType?: string
|
|
83
|
+
shape?: string
|
|
84
|
+
locked?: boolean
|
|
85
|
+
removeUnusedLayers?: boolean
|
|
86
|
+
keepEndLayers?: boolean
|
|
87
|
+
at?: AtInput
|
|
88
|
+
size?: PadSizeInput
|
|
89
|
+
drill?: PadDrill
|
|
90
|
+
layers?: PadLayersInput
|
|
91
|
+
width?: Width | number
|
|
92
|
+
stroke?: Stroke
|
|
93
|
+
properties?: Property[]
|
|
94
|
+
roundrectRatio?: number | PadRoundrectRratio
|
|
95
|
+
chamferRatio?: number | PadChamferRatio
|
|
96
|
+
chamfer?: PadChamfer
|
|
97
|
+
rectDelta?: PadRectDelta
|
|
98
|
+
net?: PadNet
|
|
99
|
+
uuid?: Uuid | string
|
|
100
|
+
pinFunction?: string | PadPinFunction
|
|
101
|
+
pinType?: string | PadPinType
|
|
102
|
+
dieLength?: number | PadDieLength
|
|
103
|
+
solderMaskMargin?: number | PadSolderMaskMargin
|
|
104
|
+
solderPasteMargin?: number | PadSolderPasteMargin
|
|
105
|
+
solderPasteMarginRatio?: number | PadSolderPasteMarginRatio
|
|
106
|
+
clearance?: number | PadClearance
|
|
107
|
+
zoneConnect?: number | PadZoneConnect
|
|
108
|
+
thermalWidth?: number | PadThermalWidth
|
|
109
|
+
thermalGap?: number | PadThermalGap
|
|
110
|
+
thermalBridgeAngle?: number | PadThermalBridgeAngle
|
|
111
|
+
options?: PadOptions
|
|
112
|
+
primitives?: PadPrimitives
|
|
113
|
+
teardrops?: PadTeardrops
|
|
114
|
+
}
|
|
115
|
+
|
|
80
116
|
export class FootprintPad extends SxClass {
|
|
81
117
|
static override token = "pad"
|
|
82
118
|
token = "pad"
|
|
@@ -116,11 +152,61 @@ export class FootprintPad extends SxClass {
|
|
|
116
152
|
private _sxPrimitives?: PadPrimitives
|
|
117
153
|
private _sxTeardrops?: PadTeardrops
|
|
118
154
|
|
|
119
|
-
constructor(
|
|
155
|
+
constructor(
|
|
156
|
+
params?: FootprintPadConstructorParams | string,
|
|
157
|
+
padType?: string,
|
|
158
|
+
shape?: string,
|
|
159
|
+
) {
|
|
120
160
|
super()
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
161
|
+
|
|
162
|
+
// Support legacy string-based constructor
|
|
163
|
+
if (typeof params === "string") {
|
|
164
|
+
this._number = params
|
|
165
|
+
this._padType = padType || ""
|
|
166
|
+
this._shape = shape || ""
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Modern params-based constructor
|
|
171
|
+
const p = params || {}
|
|
172
|
+
if (p.number !== undefined) this.number = p.number
|
|
173
|
+
if (p.padType !== undefined) this.padType = p.padType
|
|
174
|
+
if (p.shape !== undefined) this.shape = p.shape
|
|
175
|
+
if (p.locked !== undefined) this.locked = p.locked
|
|
176
|
+
if (p.removeUnusedLayers !== undefined)
|
|
177
|
+
this.removeUnusedLayer = p.removeUnusedLayers
|
|
178
|
+
if (p.keepEndLayers !== undefined) this.keepEndLayers = p.keepEndLayers
|
|
179
|
+
if (p.at !== undefined) this.at = p.at
|
|
180
|
+
if (p.size !== undefined) this.size = p.size
|
|
181
|
+
if (p.drill !== undefined) this.drill = p.drill
|
|
182
|
+
if (p.layers !== undefined) this.layers = p.layers
|
|
183
|
+
if (p.width !== undefined) this.width = p.width
|
|
184
|
+
if (p.stroke !== undefined) this.stroke = p.stroke
|
|
185
|
+
if (p.properties !== undefined) this.properties = p.properties
|
|
186
|
+
if (p.roundrectRatio !== undefined) this.roundrectRatio = p.roundrectRatio
|
|
187
|
+
if (p.chamferRatio !== undefined) this.chamferRatio = p.chamferRatio
|
|
188
|
+
if (p.chamfer !== undefined) this.chamfer = p.chamfer
|
|
189
|
+
if (p.rectDelta !== undefined) this.rectDelta = p.rectDelta
|
|
190
|
+
if (p.net !== undefined) this.net = p.net
|
|
191
|
+
if (p.uuid !== undefined) this.uuid = p.uuid
|
|
192
|
+
if (p.pinFunction !== undefined) this.pinfunction = p.pinFunction
|
|
193
|
+
if (p.pinType !== undefined) this.pintype = p.pinType
|
|
194
|
+
if (p.dieLength !== undefined) this.dieLength = p.dieLength
|
|
195
|
+
if (p.solderMaskMargin !== undefined)
|
|
196
|
+
this.solderMaskMargin = p.solderMaskMargin
|
|
197
|
+
if (p.solderPasteMargin !== undefined)
|
|
198
|
+
this.solderPasteMargin = p.solderPasteMargin
|
|
199
|
+
if (p.solderPasteMarginRatio !== undefined)
|
|
200
|
+
this.solderPasteMarginRatio = p.solderPasteMarginRatio
|
|
201
|
+
if (p.clearance !== undefined) this.clearance = p.clearance
|
|
202
|
+
if (p.zoneConnect !== undefined) this.zoneConnect = p.zoneConnect
|
|
203
|
+
if (p.thermalWidth !== undefined) this.thermalWidth = p.thermalWidth
|
|
204
|
+
if (p.thermalGap !== undefined) this.thermalGap = p.thermalGap
|
|
205
|
+
if (p.thermalBridgeAngle !== undefined)
|
|
206
|
+
this.thermalBridgeAngle = p.thermalBridgeAngle
|
|
207
|
+
if (p.options !== undefined) this.options = p.options
|
|
208
|
+
if (p.primitives !== undefined) this.primitives = p.primitives
|
|
209
|
+
if (p.teardrops !== undefined) this.teardrops = p.teardrops
|
|
124
210
|
}
|
|
125
211
|
|
|
126
212
|
static override fromSexprPrimitives(
|
|
@@ -234,7 +320,9 @@ export class FootprintPad extends SxClass {
|
|
|
234
320
|
pad._sxRoundrectRatio = propertyMap.roundrect_rratio as
|
|
235
321
|
| PadRoundrectRratio
|
|
236
322
|
| undefined
|
|
237
|
-
pad._sxChamferRatio = propertyMap.chamfer_ratio as
|
|
323
|
+
pad._sxChamferRatio = propertyMap.chamfer_ratio as
|
|
324
|
+
| PadChamferRatio
|
|
325
|
+
| undefined
|
|
238
326
|
pad._sxChamfer = propertyMap.chamfer as PadChamfer | undefined
|
|
239
327
|
pad._sxNet = propertyMap.net as PadNet | undefined
|
|
240
328
|
pad._sxUuid = propertyMap.uuid as Uuid | undefined
|
|
@@ -247,21 +335,24 @@ export class FootprintPad extends SxClass {
|
|
|
247
335
|
pad._sxSolderPasteMargin = propertyMap.solder_paste_margin as
|
|
248
336
|
| PadSolderPasteMargin
|
|
249
337
|
| undefined
|
|
250
|
-
pad._sxSolderPasteMarginRatio =
|
|
251
|
-
|
|
338
|
+
pad._sxSolderPasteMarginRatio = propertyMap.solder_paste_margin_ratio as
|
|
339
|
+
| PadSolderPasteMarginRatio
|
|
340
|
+
| undefined
|
|
252
341
|
pad._sxClearance = propertyMap.clearance as PadClearance | undefined
|
|
253
342
|
pad._sxZoneConnect = propertyMap.zone_connect as PadZoneConnect | undefined
|
|
254
|
-
pad._sxThermalWidth = propertyMap.thermal_width as
|
|
343
|
+
pad._sxThermalWidth = propertyMap.thermal_width as
|
|
344
|
+
| PadThermalWidth
|
|
345
|
+
| undefined
|
|
255
346
|
pad._sxThermalGap = propertyMap.thermal_gap as PadThermalGap | undefined
|
|
256
|
-
pad._sxThermalBridgeAngle =
|
|
257
|
-
|
|
347
|
+
pad._sxThermalBridgeAngle = propertyMap.thermal_bridge_angle as
|
|
348
|
+
| PadThermalBridgeAngle
|
|
349
|
+
| undefined
|
|
258
350
|
pad._sxOptions = propertyMap.options as PadOptions | undefined
|
|
259
351
|
pad._sxPrimitives = propertyMap.primitives as PadPrimitives | undefined
|
|
260
352
|
pad._sxRemoveUnusedLayers =
|
|
261
353
|
(arrayPropertyMap.remove_unused_layers?.[0] as
|
|
262
354
|
| PadRemoveUnusedLayers
|
|
263
|
-
| undefined) ??
|
|
264
|
-
pad._sxRemoveUnusedLayers
|
|
355
|
+
| undefined) ?? pad._sxRemoveUnusedLayers
|
|
265
356
|
pad._sxKeepEndLayers =
|
|
266
357
|
(arrayPropertyMap.keep_end_layers?.[0] as PadKeepEndLayers | undefined) ??
|
|
267
358
|
pad._sxKeepEndLayers
|
|
@@ -318,25 +409,23 @@ export class FootprintPad extends SxClass {
|
|
|
318
409
|
}
|
|
319
410
|
|
|
320
411
|
set keepEndLayers(value: boolean) {
|
|
321
|
-
this._sxKeepEndLayers = value
|
|
322
|
-
? new PadKeepEndLayers({ value })
|
|
323
|
-
: undefined
|
|
412
|
+
this._sxKeepEndLayers = value ? new PadKeepEndLayers({ value }) : undefined
|
|
324
413
|
}
|
|
325
414
|
|
|
326
415
|
get at(): At | undefined {
|
|
327
416
|
return this._sxAt
|
|
328
417
|
}
|
|
329
418
|
|
|
330
|
-
set at(value:
|
|
331
|
-
this._sxAt = value
|
|
419
|
+
set at(value: AtInput | undefined) {
|
|
420
|
+
this._sxAt = value !== undefined ? At.from(value) : undefined
|
|
332
421
|
}
|
|
333
422
|
|
|
334
423
|
get size(): PadSize | undefined {
|
|
335
424
|
return this._sxSize
|
|
336
425
|
}
|
|
337
426
|
|
|
338
|
-
set size(value:
|
|
339
|
-
this._sxSize = value
|
|
427
|
+
set size(value: PadSizeInput | undefined) {
|
|
428
|
+
this._sxSize = value !== undefined ? PadSize.from(value) : undefined
|
|
340
429
|
}
|
|
341
430
|
|
|
342
431
|
get drill(): PadDrill | undefined {
|
|
@@ -351,16 +440,20 @@ export class FootprintPad extends SxClass {
|
|
|
351
440
|
return this._sxLayers
|
|
352
441
|
}
|
|
353
442
|
|
|
354
|
-
set layers(value:
|
|
355
|
-
this._sxLayers = value
|
|
443
|
+
set layers(value: PadLayersInput | undefined) {
|
|
444
|
+
this._sxLayers = value !== undefined ? PadLayers.from(value) : undefined
|
|
356
445
|
}
|
|
357
446
|
|
|
358
447
|
get width(): Width | undefined {
|
|
359
448
|
return this._sxWidth
|
|
360
449
|
}
|
|
361
450
|
|
|
362
|
-
set width(value: Width | undefined) {
|
|
363
|
-
|
|
451
|
+
set width(value: number | Width | undefined) {
|
|
452
|
+
if (value === undefined) {
|
|
453
|
+
this._sxWidth = undefined
|
|
454
|
+
return
|
|
455
|
+
}
|
|
456
|
+
this._sxWidth = typeof value === "number" ? new Width(value) : value
|
|
364
457
|
}
|
|
365
458
|
|
|
366
459
|
get stroke(): Stroke | undefined {
|
|
@@ -383,18 +476,26 @@ export class FootprintPad extends SxClass {
|
|
|
383
476
|
return this._sxRoundrectRatio?.value
|
|
384
477
|
}
|
|
385
478
|
|
|
386
|
-
set roundrectRatio(value: number | undefined) {
|
|
479
|
+
set roundrectRatio(value: number | PadRoundrectRratio | undefined) {
|
|
480
|
+
if (value === undefined) {
|
|
481
|
+
this._sxRoundrectRatio = undefined
|
|
482
|
+
return
|
|
483
|
+
}
|
|
387
484
|
this._sxRoundrectRatio =
|
|
388
|
-
value ===
|
|
485
|
+
typeof value === "number" ? new PadRoundrectRratio(value) : value
|
|
389
486
|
}
|
|
390
487
|
|
|
391
488
|
get chamferRatio(): number | undefined {
|
|
392
489
|
return this._sxChamferRatio?.value
|
|
393
490
|
}
|
|
394
491
|
|
|
395
|
-
set chamferRatio(value: number | undefined) {
|
|
492
|
+
set chamferRatio(value: number | PadChamferRatio | undefined) {
|
|
493
|
+
if (value === undefined) {
|
|
494
|
+
this._sxChamferRatio = undefined
|
|
495
|
+
return
|
|
496
|
+
}
|
|
396
497
|
this._sxChamferRatio =
|
|
397
|
-
value ===
|
|
498
|
+
typeof value === "number" ? new PadChamferRatio(value) : value
|
|
398
499
|
}
|
|
399
500
|
|
|
400
501
|
get chamfer(): PadChamfer | undefined {
|
|
@@ -449,93 +550,145 @@ export class FootprintPad extends SxClass {
|
|
|
449
550
|
return this._sxPinFunction?.value
|
|
450
551
|
}
|
|
451
552
|
|
|
452
|
-
set pinfunction(value: string | undefined) {
|
|
553
|
+
set pinfunction(value: string | PadPinFunction | undefined) {
|
|
554
|
+
if (value === undefined) {
|
|
555
|
+
this._sxPinFunction = undefined
|
|
556
|
+
return
|
|
557
|
+
}
|
|
453
558
|
this._sxPinFunction =
|
|
454
|
-
value ===
|
|
559
|
+
typeof value === "string" ? new PadPinFunction(value) : value
|
|
455
560
|
}
|
|
456
561
|
|
|
457
562
|
get pintype(): string | undefined {
|
|
458
563
|
return this._sxPinType?.value
|
|
459
564
|
}
|
|
460
565
|
|
|
461
|
-
set pintype(value: string | undefined) {
|
|
462
|
-
|
|
566
|
+
set pintype(value: string | PadPinType | undefined) {
|
|
567
|
+
if (value === undefined) {
|
|
568
|
+
this._sxPinType = undefined
|
|
569
|
+
return
|
|
570
|
+
}
|
|
571
|
+
this._sxPinType = typeof value === "string" ? new PadPinType(value) : value
|
|
463
572
|
}
|
|
464
573
|
|
|
465
574
|
get dieLength(): number | undefined {
|
|
466
575
|
return this._sxDieLength?.value
|
|
467
576
|
}
|
|
468
577
|
|
|
469
|
-
set dieLength(value: number | undefined) {
|
|
470
|
-
|
|
578
|
+
set dieLength(value: number | PadDieLength | undefined) {
|
|
579
|
+
if (value === undefined) {
|
|
580
|
+
this._sxDieLength = undefined
|
|
581
|
+
return
|
|
582
|
+
}
|
|
583
|
+
this._sxDieLength =
|
|
584
|
+
typeof value === "number" ? new PadDieLength(value) : value
|
|
471
585
|
}
|
|
472
586
|
|
|
473
587
|
get solderMaskMargin(): number | undefined {
|
|
474
588
|
return this._sxSolderMaskMargin?.value
|
|
475
589
|
}
|
|
476
590
|
|
|
477
|
-
set solderMaskMargin(value: number | undefined) {
|
|
591
|
+
set solderMaskMargin(value: number | PadSolderMaskMargin | undefined) {
|
|
592
|
+
if (value === undefined) {
|
|
593
|
+
this._sxSolderMaskMargin = undefined
|
|
594
|
+
return
|
|
595
|
+
}
|
|
478
596
|
this._sxSolderMaskMargin =
|
|
479
|
-
value ===
|
|
597
|
+
typeof value === "number" ? new PadSolderMaskMargin(value) : value
|
|
480
598
|
}
|
|
481
599
|
|
|
482
600
|
get solderPasteMargin(): number | undefined {
|
|
483
601
|
return this._sxSolderPasteMargin?.value
|
|
484
602
|
}
|
|
485
603
|
|
|
486
|
-
set solderPasteMargin(value: number | undefined) {
|
|
604
|
+
set solderPasteMargin(value: number | PadSolderPasteMargin | undefined) {
|
|
605
|
+
if (value === undefined) {
|
|
606
|
+
this._sxSolderPasteMargin = undefined
|
|
607
|
+
return
|
|
608
|
+
}
|
|
487
609
|
this._sxSolderPasteMargin =
|
|
488
|
-
value ===
|
|
610
|
+
typeof value === "number" ? new PadSolderPasteMargin(value) : value
|
|
489
611
|
}
|
|
490
612
|
|
|
491
613
|
get solderPasteMarginRatio(): number | undefined {
|
|
492
614
|
return this._sxSolderPasteMarginRatio?.value
|
|
493
615
|
}
|
|
494
616
|
|
|
495
|
-
set solderPasteMarginRatio(value:
|
|
617
|
+
set solderPasteMarginRatio(value:
|
|
618
|
+
| number
|
|
619
|
+
| PadSolderPasteMarginRatio
|
|
620
|
+
| undefined) {
|
|
621
|
+
if (value === undefined) {
|
|
622
|
+
this._sxSolderPasteMarginRatio = undefined
|
|
623
|
+
return
|
|
624
|
+
}
|
|
496
625
|
this._sxSolderPasteMarginRatio =
|
|
497
|
-
value ===
|
|
626
|
+
typeof value === "number" ? new PadSolderPasteMarginRatio(value) : value
|
|
498
627
|
}
|
|
499
628
|
|
|
500
629
|
get clearance(): number | undefined {
|
|
501
630
|
return this._sxClearance?.value
|
|
502
631
|
}
|
|
503
632
|
|
|
504
|
-
set clearance(value: number | undefined) {
|
|
505
|
-
|
|
633
|
+
set clearance(value: number | PadClearance | undefined) {
|
|
634
|
+
if (value === undefined) {
|
|
635
|
+
this._sxClearance = undefined
|
|
636
|
+
return
|
|
637
|
+
}
|
|
638
|
+
this._sxClearance =
|
|
639
|
+
typeof value === "number" ? new PadClearance(value) : value
|
|
506
640
|
}
|
|
507
641
|
|
|
508
642
|
get zoneConnect(): number | undefined {
|
|
509
643
|
return this._sxZoneConnect?.value
|
|
510
644
|
}
|
|
511
645
|
|
|
512
|
-
set zoneConnect(value: number | undefined) {
|
|
513
|
-
|
|
646
|
+
set zoneConnect(value: number | PadZoneConnect | undefined) {
|
|
647
|
+
if (value === undefined) {
|
|
648
|
+
this._sxZoneConnect = undefined
|
|
649
|
+
return
|
|
650
|
+
}
|
|
651
|
+
this._sxZoneConnect =
|
|
652
|
+
typeof value === "number" ? new PadZoneConnect(value) : value
|
|
514
653
|
}
|
|
515
654
|
|
|
516
655
|
get thermalWidth(): number | undefined {
|
|
517
656
|
return this._sxThermalWidth?.value
|
|
518
657
|
}
|
|
519
658
|
|
|
520
|
-
set thermalWidth(value: number | undefined) {
|
|
521
|
-
|
|
659
|
+
set thermalWidth(value: number | PadThermalWidth | undefined) {
|
|
660
|
+
if (value === undefined) {
|
|
661
|
+
this._sxThermalWidth = undefined
|
|
662
|
+
return
|
|
663
|
+
}
|
|
664
|
+
this._sxThermalWidth =
|
|
665
|
+
typeof value === "number" ? new PadThermalWidth(value) : value
|
|
522
666
|
}
|
|
523
667
|
|
|
524
668
|
get thermalGap(): number | undefined {
|
|
525
669
|
return this._sxThermalGap?.value
|
|
526
670
|
}
|
|
527
671
|
|
|
528
|
-
set thermalGap(value: number | undefined) {
|
|
529
|
-
|
|
672
|
+
set thermalGap(value: number | PadThermalGap | undefined) {
|
|
673
|
+
if (value === undefined) {
|
|
674
|
+
this._sxThermalGap = undefined
|
|
675
|
+
return
|
|
676
|
+
}
|
|
677
|
+
this._sxThermalGap =
|
|
678
|
+
typeof value === "number" ? new PadThermalGap(value) : value
|
|
530
679
|
}
|
|
531
680
|
|
|
532
681
|
get thermalBridgeAngle(): number | undefined {
|
|
533
682
|
return this._sxThermalBridgeAngle?.value
|
|
534
683
|
}
|
|
535
684
|
|
|
536
|
-
set thermalBridgeAngle(value: number | undefined) {
|
|
685
|
+
set thermalBridgeAngle(value: number | PadThermalBridgeAngle | undefined) {
|
|
686
|
+
if (value === undefined) {
|
|
687
|
+
this._sxThermalBridgeAngle = undefined
|
|
688
|
+
return
|
|
689
|
+
}
|
|
537
690
|
this._sxThermalBridgeAngle =
|
|
538
|
-
value ===
|
|
691
|
+
typeof value === "number" ? new PadThermalBridgeAngle(value) : value
|
|
539
692
|
}
|
|
540
693
|
|
|
541
694
|
get options(): PadOptions | undefined {
|
|
@@ -587,8 +740,7 @@ export class FootprintPad extends SxClass {
|
|
|
587
740
|
if (this._sxZoneConnect) children.push(this._sxZoneConnect)
|
|
588
741
|
if (this._sxThermalWidth) children.push(this._sxThermalWidth)
|
|
589
742
|
if (this._sxThermalGap) children.push(this._sxThermalGap)
|
|
590
|
-
if (this._sxThermalBridgeAngle)
|
|
591
|
-
children.push(this._sxThermalBridgeAngle)
|
|
743
|
+
if (this._sxThermalBridgeAngle) children.push(this._sxThermalBridgeAngle)
|
|
592
744
|
if (this._sxUuid) children.push(this._sxUuid)
|
|
593
745
|
if (this._sxRemoveUnusedLayers) children.push(this._sxRemoveUnusedLayers)
|
|
594
746
|
if (this._sxKeepEndLayers) children.push(this._sxKeepEndLayers)
|
|
@@ -6,6 +6,17 @@ import { Uuid } from "./Uuid"
|
|
|
6
6
|
import { Width } from "./Width"
|
|
7
7
|
import { toNumberValue } from "../utils/toNumberValue"
|
|
8
8
|
|
|
9
|
+
export interface FpArcConstructorParams {
|
|
10
|
+
start?: FpArcStart | { x: number; y: number }
|
|
11
|
+
mid?: FpArcMid | { x: number; y: number }
|
|
12
|
+
end?: FpArcEnd | { x: number; y: number }
|
|
13
|
+
layer?: Layer | string | string[]
|
|
14
|
+
width?: number | Width
|
|
15
|
+
stroke?: Stroke
|
|
16
|
+
uuid?: string | Uuid
|
|
17
|
+
locked?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
export class FpArc extends SxClass {
|
|
10
21
|
static override token = "fp_arc"
|
|
11
22
|
token = "fp_arc"
|
|
@@ -19,6 +30,18 @@ export class FpArc extends SxClass {
|
|
|
19
30
|
private _sxUuid?: Uuid
|
|
20
31
|
private _locked = false
|
|
21
32
|
|
|
33
|
+
constructor(params: FpArcConstructorParams = {}) {
|
|
34
|
+
super()
|
|
35
|
+
if (params.start !== undefined) this.start = params.start
|
|
36
|
+
if (params.mid !== undefined) this.mid = params.mid
|
|
37
|
+
if (params.end !== undefined) this.end = params.end
|
|
38
|
+
if (params.layer !== undefined) this.layer = params.layer
|
|
39
|
+
if (params.width !== undefined) this.width = params.width
|
|
40
|
+
if (params.stroke !== undefined) this.stroke = params.stroke
|
|
41
|
+
if (params.uuid !== undefined) this.uuid = params.uuid
|
|
42
|
+
if (params.locked !== undefined) this.locked = params.locked
|
|
43
|
+
}
|
|
44
|
+
|
|
22
45
|
static override fromSexprPrimitives(
|
|
23
46
|
primitiveSexprs: PrimitiveSExpr[],
|
|
24
47
|
): FpArc {
|
|
@@ -7,6 +7,17 @@ import { Width } from "./Width"
|
|
|
7
7
|
import { toNumberValue } from "../utils/toNumberValue"
|
|
8
8
|
import { toStringValue } from "../utils/toStringValue"
|
|
9
9
|
|
|
10
|
+
export interface FpCircleConstructorParams {
|
|
11
|
+
center?: FpCircleCenter | { x: number; y: number }
|
|
12
|
+
end?: FpCircleEnd | { x: number; y: number }
|
|
13
|
+
layer?: Layer | string | string[]
|
|
14
|
+
width?: number | Width
|
|
15
|
+
stroke?: Stroke
|
|
16
|
+
fill?: boolean | FpCircleFill
|
|
17
|
+
uuid?: string | Uuid
|
|
18
|
+
locked?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
export class FpCircle extends SxClass {
|
|
11
22
|
static override token = "fp_circle"
|
|
12
23
|
token = "fp_circle"
|
|
@@ -20,6 +31,18 @@ export class FpCircle extends SxClass {
|
|
|
20
31
|
private _sxUuid?: Uuid
|
|
21
32
|
private _locked = false
|
|
22
33
|
|
|
34
|
+
constructor(params: FpCircleConstructorParams = {}) {
|
|
35
|
+
super()
|
|
36
|
+
if (params.center !== undefined) this.center = params.center
|
|
37
|
+
if (params.end !== undefined) this.end = params.end
|
|
38
|
+
if (params.layer !== undefined) this.layer = params.layer
|
|
39
|
+
if (params.width !== undefined) this.width = params.width
|
|
40
|
+
if (params.stroke !== undefined) this.stroke = params.stroke
|
|
41
|
+
if (params.fill !== undefined) this.fill = params.fill
|
|
42
|
+
if (params.uuid !== undefined) this.uuid = params.uuid
|
|
43
|
+
if (params.locked !== undefined) this.locked = params.locked
|
|
44
|
+
}
|
|
45
|
+
|
|
23
46
|
static override fromSexprPrimitives(
|
|
24
47
|
primitiveSexprs: PrimitiveSExpr[],
|
|
25
48
|
): FpCircle {
|
|
@@ -51,9 +74,7 @@ export class FpCircle extends SxClass {
|
|
|
51
74
|
return this._sxCenter
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
set center(
|
|
55
|
-
value: FpCircleCenter | { x: number; y: number } | undefined,
|
|
56
|
-
) {
|
|
77
|
+
set center(value: FpCircleCenter | { x: number; y: number } | undefined,) {
|
|
57
78
|
if (value === undefined) {
|
|
58
79
|
this._sxCenter = undefined
|
|
59
80
|
return
|
|
@@ -14,6 +14,16 @@ const SUPPORTED_SINGLE_TOKENS = new Set([
|
|
|
14
14
|
"uuid",
|
|
15
15
|
])
|
|
16
16
|
|
|
17
|
+
export interface FpLineConstructorParams {
|
|
18
|
+
start?: FpLineStart | { x: number; y: number }
|
|
19
|
+
end?: FpLineEnd | { x: number; y: number }
|
|
20
|
+
layer?: Layer | string | string[]
|
|
21
|
+
width?: number
|
|
22
|
+
stroke?: Stroke
|
|
23
|
+
uuid?: Uuid | string
|
|
24
|
+
locked?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
export class FpLine extends SxClass {
|
|
18
28
|
static override token = "fp_line"
|
|
19
29
|
static override parentToken = "footprint"
|
|
@@ -27,6 +37,17 @@ export class FpLine extends SxClass {
|
|
|
27
37
|
private _sxUuid?: Uuid
|
|
28
38
|
private _locked = false
|
|
29
39
|
|
|
40
|
+
constructor(params: FpLineConstructorParams = {}) {
|
|
41
|
+
super()
|
|
42
|
+
if (params.start !== undefined) this.start = params.start
|
|
43
|
+
if (params.end !== undefined) this.end = params.end
|
|
44
|
+
if (params.layer !== undefined) this.layer = params.layer
|
|
45
|
+
if (params.width !== undefined) this.width = params.width
|
|
46
|
+
if (params.stroke !== undefined) this.stroke = params.stroke
|
|
47
|
+
if (params.uuid !== undefined) this.uuid = params.uuid
|
|
48
|
+
if (params.locked !== undefined) this.locked = params.locked
|
|
49
|
+
}
|
|
50
|
+
|
|
30
51
|
static override fromSexprPrimitives(
|
|
31
52
|
primitiveSexprs: PrimitiveSExpr[],
|
|
32
53
|
): FpLine {
|
|
@@ -133,7 +154,8 @@ export class FpLine extends SxClass {
|
|
|
133
154
|
this._sxEnd = undefined
|
|
134
155
|
return
|
|
135
156
|
}
|
|
136
|
-
this._sxEnd =
|
|
157
|
+
this._sxEnd =
|
|
158
|
+
value instanceof FpLineEnd ? value : new FpLineEnd(value.x, value.y)
|
|
137
159
|
}
|
|
138
160
|
|
|
139
161
|
get layer(): Layer | undefined {
|
|
@@ -211,7 +233,10 @@ export class FpLineStart extends SxClass {
|
|
|
211
233
|
static override parentToken = "fp_line"
|
|
212
234
|
override token = "start"
|
|
213
235
|
|
|
214
|
-
constructor(
|
|
236
|
+
constructor(
|
|
237
|
+
public x: number,
|
|
238
|
+
public y: number,
|
|
239
|
+
) {
|
|
215
240
|
super()
|
|
216
241
|
}
|
|
217
242
|
|
|
@@ -242,7 +267,10 @@ export class FpLineEnd extends SxClass {
|
|
|
242
267
|
static override parentToken = "fp_line"
|
|
243
268
|
override token = "end"
|
|
244
269
|
|
|
245
|
-
constructor(
|
|
270
|
+
constructor(
|
|
271
|
+
public x: number,
|
|
272
|
+
public y: number,
|
|
273
|
+
) {
|
|
246
274
|
super()
|
|
247
275
|
}
|
|
248
276
|
|
|
@@ -20,6 +20,16 @@ const SUPPORTED_TOKENS = new Set([
|
|
|
20
20
|
"uuid",
|
|
21
21
|
])
|
|
22
22
|
|
|
23
|
+
export interface FpPolyConstructorParams {
|
|
24
|
+
points?: Pts | Xy[] | Array<{ x: number; y: number }>
|
|
25
|
+
layer?: Layer | string | Array<string | number>
|
|
26
|
+
width?: Width | number
|
|
27
|
+
stroke?: Stroke
|
|
28
|
+
fill?: FpPolyFill | boolean
|
|
29
|
+
locked?: boolean
|
|
30
|
+
uuid?: Uuid | string
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
export class FpPoly extends SxClass {
|
|
24
34
|
static override token = "fp_poly"
|
|
25
35
|
override token = "fp_poly"
|
|
@@ -32,6 +42,17 @@ export class FpPoly extends SxClass {
|
|
|
32
42
|
private _sxLocked?: FpPolyLocked
|
|
33
43
|
private _sxUuid?: Uuid
|
|
34
44
|
|
|
45
|
+
constructor(params: FpPolyConstructorParams = {}) {
|
|
46
|
+
super()
|
|
47
|
+
if (params.points !== undefined) this.points = params.points
|
|
48
|
+
if (params.layer !== undefined) this.layer = params.layer
|
|
49
|
+
if (params.width !== undefined) this.width = params.width
|
|
50
|
+
if (params.stroke !== undefined) this.stroke = params.stroke
|
|
51
|
+
if (params.fill !== undefined) this.fill = params.fill
|
|
52
|
+
if (params.locked !== undefined) this.locked = params.locked
|
|
53
|
+
if (params.uuid !== undefined) this.uuid = params.uuid
|
|
54
|
+
}
|
|
55
|
+
|
|
35
56
|
static override fromSexprPrimitives(
|
|
36
57
|
primitiveSexprs: PrimitiveSExpr[],
|
|
37
58
|
): FpPoly {
|
|
@@ -87,7 +108,8 @@ export class FpPoly extends SxClass {
|
|
|
87
108
|
fpPoly._sxStroke = propertyMap.stroke as Stroke | undefined
|
|
88
109
|
fpPoly._sxFill = propertyMap.fill as FpPolyFill | undefined
|
|
89
110
|
const lockedClass = propertyMap.locked as FpPolyLocked | undefined
|
|
90
|
-
fpPoly._sxLocked =
|
|
111
|
+
fpPoly._sxLocked =
|
|
112
|
+
lockedClass && lockedClass.value ? lockedClass : undefined
|
|
91
113
|
fpPoly._sxUuid = propertyMap.uuid as Uuid | undefined
|
|
92
114
|
|
|
93
115
|
for (const primitive of primitiveSexprs) {
|
|
@@ -161,9 +183,7 @@ export class FpPoly extends SxClass {
|
|
|
161
183
|
}
|
|
162
184
|
|
|
163
185
|
if (Array.isArray(value)) {
|
|
164
|
-
this._sxPts = new Pts(
|
|
165
|
-
value.map(({ x, y }) => new Xy(x, y)),
|
|
166
|
-
)
|
|
186
|
+
this._sxPts = new Pts(value.map(({ x, y }) => new Xy(x, y)))
|
|
167
187
|
return
|
|
168
188
|
}
|
|
169
189
|
|
|
@@ -7,6 +7,17 @@ import { Width } from "./Width"
|
|
|
7
7
|
import { toNumberValue } from "../utils/toNumberValue"
|
|
8
8
|
import { toStringValue } from "../utils/toStringValue"
|
|
9
9
|
|
|
10
|
+
export interface FpRectConstructorParams {
|
|
11
|
+
start?: FpRectStart | { x: number; y: number }
|
|
12
|
+
end?: FpRectEnd | { x: number; y: number }
|
|
13
|
+
layer?: Layer | string | string[]
|
|
14
|
+
width?: number | Width
|
|
15
|
+
stroke?: Stroke
|
|
16
|
+
fill?: boolean | FpRectFill
|
|
17
|
+
uuid?: string | Uuid
|
|
18
|
+
locked?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
export class FpRect extends SxClass {
|
|
11
22
|
static override token = "fp_rect"
|
|
12
23
|
token = "fp_rect"
|
|
@@ -20,6 +31,18 @@ export class FpRect extends SxClass {
|
|
|
20
31
|
private _sxUuid?: Uuid
|
|
21
32
|
private _locked = false
|
|
22
33
|
|
|
34
|
+
constructor(params: FpRectConstructorParams = {}) {
|
|
35
|
+
super()
|
|
36
|
+
if (params.start !== undefined) this.start = params.start
|
|
37
|
+
if (params.end !== undefined) this.end = params.end
|
|
38
|
+
if (params.layer !== undefined) this.layer = params.layer
|
|
39
|
+
if (params.width !== undefined) this.width = params.width
|
|
40
|
+
if (params.stroke !== undefined) this.stroke = params.stroke
|
|
41
|
+
if (params.fill !== undefined) this.fill = params.fill
|
|
42
|
+
if (params.uuid !== undefined) this.uuid = params.uuid
|
|
43
|
+
if (params.locked !== undefined) this.locked = params.locked
|
|
44
|
+
}
|
|
45
|
+
|
|
23
46
|
static override fromSexprPrimitives(
|
|
24
47
|
primitiveSexprs: PrimitiveSExpr[],
|
|
25
48
|
): FpRect {
|
|
@@ -51,9 +74,7 @@ export class FpRect extends SxClass {
|
|
|
51
74
|
return this._sxStart
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
set start(
|
|
55
|
-
value: FpRectStart | { x: number; y: number } | undefined,
|
|
56
|
-
) {
|
|
77
|
+
set start(value: FpRectStart | { x: number; y: number } | undefined,) {
|
|
57
78
|
if (value === undefined) {
|
|
58
79
|
this._sxStart = undefined
|
|
59
80
|
return
|