altium-to-circuit-json 0.0.80 → 0.0.82
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/dist/index.js +247 -90
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1975,7 +1975,7 @@ function addComponentFallbackText({
|
|
|
1975
1975
|
}
|
|
1976
1976
|
|
|
1977
1977
|
// lib/schematic/components/convertComponent.ts
|
|
1978
|
-
import { AltiumSchPinRecord as
|
|
1978
|
+
import { AltiumSchPinRecord as AltiumSchPinRecord5 } from "altiumts";
|
|
1979
1979
|
|
|
1980
1980
|
// lib/schematic/symbols/applyNativeSymbolPortGeometry.ts
|
|
1981
1981
|
import { applyToPoint as applyToPoint6, translate as translate2 } from "transformation-matrix";
|
|
@@ -3220,8 +3220,10 @@ function convertComponentPin({
|
|
|
3220
3220
|
|
|
3221
3221
|
// lib/schematic/components/convertOwnedCustomComponentBody.ts
|
|
3222
3222
|
import {
|
|
3223
|
+
AltiumSchArcRecord,
|
|
3223
3224
|
AltiumSchEllipseRecord,
|
|
3224
3225
|
AltiumSchEllipticalArcRecord,
|
|
3226
|
+
AltiumSchLineRecord,
|
|
3225
3227
|
AltiumSchPolygonRecord,
|
|
3226
3228
|
AltiumSchPolylineRecord
|
|
3227
3229
|
} from "altiumts";
|
|
@@ -3323,16 +3325,23 @@ function convertOwnedCustomComponentBody({
|
|
|
3323
3325
|
identity,
|
|
3324
3326
|
records
|
|
3325
3327
|
}, context) {
|
|
3326
|
-
const
|
|
3327
|
-
(record) =>
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3328
|
+
const bodyPrimitiveKinds = new Set(
|
|
3329
|
+
records.flatMap((record) => {
|
|
3330
|
+
if (record instanceof AltiumSchEllipseRecord) return ["ellipse"];
|
|
3331
|
+
if (record instanceof AltiumSchArcRecord || record instanceof AltiumSchEllipticalArcRecord) {
|
|
3332
|
+
return ["arc"];
|
|
3333
|
+
}
|
|
3334
|
+
if (record instanceof AltiumSchLineRecord) return ["line"];
|
|
3335
|
+
if (record instanceof AltiumSchPolygonRecord || record instanceof AltiumSchPolylineRecord) {
|
|
3336
|
+
return ["polygon"];
|
|
3337
|
+
}
|
|
3338
|
+
return [];
|
|
3339
|
+
})
|
|
3334
3340
|
);
|
|
3335
|
-
|
|
3341
|
+
const bodyPrimitiveCount = records.filter(
|
|
3342
|
+
(record) => record instanceof AltiumSchEllipseRecord || record instanceof AltiumSchArcRecord || record instanceof AltiumSchEllipticalArcRecord || record instanceof AltiumSchLineRecord || record instanceof AltiumSchPolygonRecord || record instanceof AltiumSchPolylineRecord
|
|
3343
|
+
).length;
|
|
3344
|
+
if (bodyPrimitiveCount < 3 || bodyPrimitiveKinds.size < 2) return void 0;
|
|
3336
3345
|
const ownedElements = convertOwnedComponentRecords(
|
|
3337
3346
|
{
|
|
3338
3347
|
ownedRecords: records,
|
|
@@ -3343,6 +3352,11 @@ function convertOwnedCustomComponentBody({
|
|
|
3343
3352
|
return prepareOwnedComponentBodyElements(ownedElements);
|
|
3344
3353
|
}
|
|
3345
3354
|
|
|
3355
|
+
// lib/schematic/components/normalizeLogicGatePinName.ts
|
|
3356
|
+
function normalizeLogicGatePinName(name) {
|
|
3357
|
+
return name?.trim().toUpperCase().replace(/^\d+(?=[A-Z]+$)/u, "");
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3346
3360
|
// lib/schematic/components/convertOwnedLogicGateBody.ts
|
|
3347
3361
|
function convertOwnedLogicGateBody({
|
|
3348
3362
|
identity,
|
|
@@ -3353,7 +3367,7 @@ function convertOwnedLogicGateBody({
|
|
|
3353
3367
|
const logicGateLabels = /* @__PURE__ */ new Set([
|
|
3354
3368
|
...visibleSymbolLabels,
|
|
3355
3369
|
...pins.flatMap((pin) => {
|
|
3356
|
-
const name = pin.getDecoded("NAME")
|
|
3370
|
+
const name = normalizeLogicGatePinName(pin.getDecoded("NAME"));
|
|
3357
3371
|
return name ? [name] : [];
|
|
3358
3372
|
})
|
|
3359
3373
|
]);
|
|
@@ -3386,10 +3400,204 @@ function convertOwnedComponentBody({
|
|
|
3386
3400
|
) ?? convertOwnedCustomComponentBody({ identity, records }, context);
|
|
3387
3401
|
}
|
|
3388
3402
|
|
|
3403
|
+
// lib/schematic/components/convertOwnedSingleInputGateBody.ts
|
|
3404
|
+
import { AltiumSchPinRecord as AltiumSchPinRecord3 } from "altiumts";
|
|
3405
|
+
|
|
3406
|
+
// lib/schematic/components/convertPrimitiveGatePin.ts
|
|
3407
|
+
import { AltiumSchPinRecord as AltiumSchPinRecord2 } from "altiumts";
|
|
3408
|
+
|
|
3409
|
+
// lib/schematic/components/createPinClockSymbol.ts
|
|
3410
|
+
var EDGE_VECTOR_BY_SIDE = {
|
|
3411
|
+
bottom: { x: 0, y: 1 },
|
|
3412
|
+
left: { x: 1, y: 0 },
|
|
3413
|
+
right: { x: -1, y: 0 },
|
|
3414
|
+
top: { x: 0, y: -1 }
|
|
3415
|
+
};
|
|
3416
|
+
function createPinClockSymbol({
|
|
3417
|
+
pin,
|
|
3418
|
+
recordIndex,
|
|
3419
|
+
scale: scale5,
|
|
3420
|
+
schematicPort
|
|
3421
|
+
}) {
|
|
3422
|
+
const side = schematicPort.side_of_component;
|
|
3423
|
+
if (pin.getNumber("SYMBOL_INNEREDGE") !== 3 || !side) return void 0;
|
|
3424
|
+
const edgeVector = EDGE_VECTOR_BY_SIDE[side];
|
|
3425
|
+
const pinLength = schematicPort.distance_from_component_edge ?? 0.4;
|
|
3426
|
+
const bodyPosition = {
|
|
3427
|
+
x: schematicPort.center.x + edgeVector.x * pinLength,
|
|
3428
|
+
y: schematicPort.center.y + edgeVector.y * pinLength
|
|
3429
|
+
};
|
|
3430
|
+
const clockDepth = scaleLength(4, scale5);
|
|
3431
|
+
const clockHalfWidth = scaleLength(2, scale5);
|
|
3432
|
+
const perpendicularVector = { x: -edgeVector.y, y: edgeVector.x };
|
|
3433
|
+
const clockTip = {
|
|
3434
|
+
x: bodyPosition.x + edgeVector.x * clockDepth,
|
|
3435
|
+
y: bodyPosition.y + edgeVector.y * clockDepth
|
|
3436
|
+
};
|
|
3437
|
+
const clockBaseStart = {
|
|
3438
|
+
x: bodyPosition.x + perpendicularVector.x * clockHalfWidth,
|
|
3439
|
+
y: bodyPosition.y + perpendicularVector.y * clockHalfWidth
|
|
3440
|
+
};
|
|
3441
|
+
const clockBaseEnd = {
|
|
3442
|
+
x: bodyPosition.x - perpendicularVector.x * clockHalfWidth,
|
|
3443
|
+
y: bodyPosition.y - perpendicularVector.y * clockHalfWidth
|
|
3444
|
+
};
|
|
3445
|
+
return {
|
|
3446
|
+
type: "schematic_path",
|
|
3447
|
+
fill_color: "transparent",
|
|
3448
|
+
is_dashed: false,
|
|
3449
|
+
is_filled: false,
|
|
3450
|
+
points: [clockTip, clockBaseStart, clockBaseEnd, clockTip],
|
|
3451
|
+
schematic_component_id: schematicPort.schematic_component_id,
|
|
3452
|
+
schematic_path_id: `schematic_pin_clock_altium_${recordIndex}`,
|
|
3453
|
+
schematic_sheet_id: schematicPort.schematic_sheet_id,
|
|
3454
|
+
stroke_color: "#a90000",
|
|
3455
|
+
stroke_width: 0.02
|
|
3456
|
+
};
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
// lib/schematic/components/convertPrimitiveGatePin.ts
|
|
3460
|
+
function convertPrimitiveGatePin(port, context) {
|
|
3461
|
+
const pin = port.record;
|
|
3462
|
+
if (!(pin instanceof AltiumSchPinRecord2) || !port.isSchematicVisible)
|
|
3463
|
+
return [];
|
|
3464
|
+
const index = context.document.records.indexOf(pin);
|
|
3465
|
+
const scale5 = context.options.scale;
|
|
3466
|
+
const color = altiumColorToCss(pin.getCaseInsensitive("COLOR"), "#000000");
|
|
3467
|
+
const renderingContext = {
|
|
3468
|
+
document: context.document,
|
|
3469
|
+
records: context.document.records,
|
|
3470
|
+
scale: scale5,
|
|
3471
|
+
sheetRecord: context.document.records.find(
|
|
3472
|
+
(record) => record.recordKind === "31"
|
|
3473
|
+
)
|
|
3474
|
+
};
|
|
3475
|
+
const elements = renderPin({
|
|
3476
|
+
record: pin,
|
|
3477
|
+
index,
|
|
3478
|
+
context: renderingContext,
|
|
3479
|
+
options: context.options,
|
|
3480
|
+
color
|
|
3481
|
+
});
|
|
3482
|
+
const nameLabel = elements.find(
|
|
3483
|
+
(element) => element.type === "schematic_text" && element.schematic_text_id === `schematic_pin_name_altium_${index}`
|
|
3484
|
+
);
|
|
3485
|
+
if (nameLabel?.type === "schematic_text") {
|
|
3486
|
+
const parsedLabel = parseAltiumPinLabel(nameLabel.text);
|
|
3487
|
+
nameLabel.text = parsedLabel.displayText;
|
|
3488
|
+
if (parsedLabel.textParts) nameLabel.text_parts = parsedLabel.textParts;
|
|
3489
|
+
nameLabel.font_size = port.schematicPort.display_pin_label_font_size ?? nameLabel.font_size;
|
|
3490
|
+
}
|
|
3491
|
+
const line = elements.find((element) => element.type === "schematic_line");
|
|
3492
|
+
if (line) {
|
|
3493
|
+
line.stroke_width = scaleLength(1, scale5);
|
|
3494
|
+
const direction = VECTOR_BY_DIRECTION[port.schematicPort.facing_direction ?? "right"];
|
|
3495
|
+
const designator = elements.find(
|
|
3496
|
+
(element) => element.type === "schematic_text" && element.schematic_text_id === `schematic_pin_designator_altium_${index}`
|
|
3497
|
+
);
|
|
3498
|
+
if (designator?.type === "schematic_text") {
|
|
3499
|
+
const margin = scaleLength(9, scale5);
|
|
3500
|
+
designator.position = {
|
|
3501
|
+
x: line.x1 + direction.x * margin,
|
|
3502
|
+
y: line.y1 + direction.y * margin
|
|
3503
|
+
};
|
|
3504
|
+
designator.anchor = direction.x > 0 || direction.y > 0 ? "bottom_left" : "bottom_right";
|
|
3505
|
+
designator.font_size = scaleLength(
|
|
3506
|
+
getFontSize(pin, renderingContext),
|
|
3507
|
+
scale5
|
|
3508
|
+
);
|
|
3509
|
+
}
|
|
3510
|
+
if (pin.getNumber("SYMBOL_OUTEREDGE") === 1) {
|
|
3511
|
+
const radius = scaleLength(2.5, scale5);
|
|
3512
|
+
elements.push({
|
|
3513
|
+
type: "schematic_circle",
|
|
3514
|
+
schematic_circle_id: `schematic_pin_inversion_altium_${index}`,
|
|
3515
|
+
schematic_sheet_id: context.options.schematicSheetId,
|
|
3516
|
+
center: {
|
|
3517
|
+
x: line.x1 + direction.x * radius,
|
|
3518
|
+
y: line.y1 + direction.y * radius
|
|
3519
|
+
},
|
|
3520
|
+
radius,
|
|
3521
|
+
color,
|
|
3522
|
+
stroke_width: scaleLength(1, scale5),
|
|
3523
|
+
is_filled: true,
|
|
3524
|
+
fill_color: "#ffffff",
|
|
3525
|
+
is_dashed: false
|
|
3526
|
+
});
|
|
3527
|
+
line.x1 += direction.x * radius * 2;
|
|
3528
|
+
line.y1 += direction.y * radius * 2;
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
const clock = createPinClockSymbol({
|
|
3532
|
+
pin,
|
|
3533
|
+
recordIndex: index,
|
|
3534
|
+
scale: scale5,
|
|
3535
|
+
schematicPort: port.schematicPort
|
|
3536
|
+
});
|
|
3537
|
+
if (clock) elements.push(clock);
|
|
3538
|
+
delete port.schematicPort.display_pin_label;
|
|
3539
|
+
delete port.schematicPort.display_pin_label_text_parts;
|
|
3540
|
+
return elements.map(
|
|
3541
|
+
(element) => element.type === "schematic_line" || element.type === "schematic_circle" || element.type === "schematic_path" ? {
|
|
3542
|
+
...element,
|
|
3543
|
+
schematic_component_id: port.schematicPort.schematic_component_id
|
|
3544
|
+
} : element
|
|
3545
|
+
);
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
// lib/schematic/components/hasTriangularLineBody.ts
|
|
3549
|
+
function hasTriangularLineBody(records) {
|
|
3550
|
+
const lines = records.flatMap((record) => {
|
|
3551
|
+
if (record.recordKind !== "13") return [];
|
|
3552
|
+
const start = getLocation(record);
|
|
3553
|
+
const end = getCorner(record);
|
|
3554
|
+
return start && end && !pointsEqual(start, end) ? [{ start, end }] : [];
|
|
3555
|
+
});
|
|
3556
|
+
return lines.some(
|
|
3557
|
+
(first) => lines.some((second) => {
|
|
3558
|
+
const apex = pointsEqual(first.end, second.start) ? second.end : pointsEqual(first.end, second.end) ? second.start : void 0;
|
|
3559
|
+
if (!apex) return false;
|
|
3560
|
+
const twiceArea = (first.end.x - first.start.x) * (apex.y - first.start.y) - (first.end.y - first.start.y) * (apex.x - first.start.x);
|
|
3561
|
+
if (Math.abs(twiceArea) < 1e-6) return false;
|
|
3562
|
+
return lines.some(
|
|
3563
|
+
(third) => pointsEqual(third.start, apex) && pointsEqual(third.end, first.start) || pointsEqual(third.end, apex) && pointsEqual(third.start, first.start)
|
|
3564
|
+
);
|
|
3565
|
+
})
|
|
3566
|
+
);
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
// lib/schematic/components/convertOwnedSingleInputGateBody.ts
|
|
3570
|
+
function convertOwnedSingleInputGateBody({
|
|
3571
|
+
identity,
|
|
3572
|
+
records,
|
|
3573
|
+
componentPorts
|
|
3574
|
+
}, context) {
|
|
3575
|
+
const pinNames = componentPorts.map(
|
|
3576
|
+
(port) => normalizeLogicGatePinName(port.sourcePort.name)
|
|
3577
|
+
);
|
|
3578
|
+
if (!pinNames.includes("A") || !pinNames.includes("Y") || pinNames.includes("B")) {
|
|
3579
|
+
return void 0;
|
|
3580
|
+
}
|
|
3581
|
+
if (!hasTriangularLineBody(records)) return void 0;
|
|
3582
|
+
const body = convertOwnedComponentRecords(
|
|
3583
|
+
{
|
|
3584
|
+
ownedRecords: records.filter(
|
|
3585
|
+
(record) => !(record instanceof AltiumSchPinRecord3)
|
|
3586
|
+
),
|
|
3587
|
+
schematicComponentId: identity.schematicComponentId
|
|
3588
|
+
},
|
|
3589
|
+
context
|
|
3590
|
+
);
|
|
3591
|
+
return [
|
|
3592
|
+
...body,
|
|
3593
|
+
...componentPorts.flatMap((port) => convertPrimitiveGatePin(port, context))
|
|
3594
|
+
];
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3389
3597
|
// lib/schematic/components/getComponentBodyBounds.ts
|
|
3390
3598
|
import {
|
|
3391
3599
|
AltiumSchEllipseRecord as AltiumSchEllipseRecord2,
|
|
3392
|
-
AltiumSchPinRecord as
|
|
3600
|
+
AltiumSchPinRecord as AltiumSchPinRecord4,
|
|
3393
3601
|
AltiumSchRectangleRecord,
|
|
3394
3602
|
getSchematicRecordPoints as getSchematicRecordPoints6
|
|
3395
3603
|
} from "altiumts";
|
|
@@ -3403,7 +3611,7 @@ function getComponentBodyBounds(records, portPoints) {
|
|
|
3403
3611
|
if (rectangles.length > 0) return mergeBounds(rectangles);
|
|
3404
3612
|
const points = [];
|
|
3405
3613
|
for (const record of records) {
|
|
3406
|
-
if (record instanceof
|
|
3614
|
+
if (record instanceof AltiumSchPinRecord4) continue;
|
|
3407
3615
|
const location = getLocation(record);
|
|
3408
3616
|
const corner = getCorner(record);
|
|
3409
3617
|
if (location && corner) points.push(location, corner);
|
|
@@ -3476,7 +3684,7 @@ function convertPinlessComponent({
|
|
|
3476
3684
|
}
|
|
3477
3685
|
|
|
3478
3686
|
// lib/schematic/components/createAlphanumericPinDesignatorText.ts
|
|
3479
|
-
var
|
|
3687
|
+
var EDGE_VECTOR_BY_SIDE2 = {
|
|
3480
3688
|
bottom: { x: 0, y: 1 },
|
|
3481
3689
|
left: { x: 1, y: 0 },
|
|
3482
3690
|
right: { x: -1, y: 0 },
|
|
@@ -3494,7 +3702,7 @@ function createAlphanumericPinDesignatorText({
|
|
|
3494
3702
|
const isDesignatorVisible = pinConglomerate === void 0 || (pinConglomerate & 16) !== 0;
|
|
3495
3703
|
const side = schematicPort.side_of_component;
|
|
3496
3704
|
if (!isDesignatorVisible || !side) return void 0;
|
|
3497
|
-
const edgeVector =
|
|
3705
|
+
const edgeVector = EDGE_VECTOR_BY_SIDE2[side];
|
|
3498
3706
|
const halfPinLength = (schematicPort.distance_from_component_edge ?? 0.4) / 2;
|
|
3499
3707
|
const position = {
|
|
3500
3708
|
x: schematicPort.center.x + edgeVector.x * halfPinLength,
|
|
@@ -3515,7 +3723,7 @@ function createAlphanumericPinDesignatorText({
|
|
|
3515
3723
|
}
|
|
3516
3724
|
|
|
3517
3725
|
// lib/schematic/components/createNumericPinDesignatorText.ts
|
|
3518
|
-
var
|
|
3726
|
+
var EDGE_VECTOR_BY_SIDE3 = {
|
|
3519
3727
|
bottom: { x: 0, y: 1 },
|
|
3520
3728
|
left: { x: 1, y: 0 },
|
|
3521
3729
|
right: { x: -1, y: 0 },
|
|
@@ -3533,7 +3741,7 @@ function createNumericPinDesignatorText({
|
|
|
3533
3741
|
const isDesignatorVisible = pinConglomerate === void 0 || (pinConglomerate & 16) !== 0;
|
|
3534
3742
|
const side = schematicPort.side_of_component;
|
|
3535
3743
|
if (!isDesignatorVisible || !side) return void 0;
|
|
3536
|
-
const edgeVector =
|
|
3744
|
+
const edgeVector = EDGE_VECTOR_BY_SIDE3[side];
|
|
3537
3745
|
const halfPinLength = (schematicPort.distance_from_component_edge ?? 0.4) / 2;
|
|
3538
3746
|
const position = {
|
|
3539
3747
|
x: schematicPort.center.x + edgeVector.x * halfPinLength,
|
|
@@ -3553,56 +3761,6 @@ function createNumericPinDesignatorText({
|
|
|
3553
3761
|
};
|
|
3554
3762
|
}
|
|
3555
3763
|
|
|
3556
|
-
// lib/schematic/components/createPinClockSymbol.ts
|
|
3557
|
-
var EDGE_VECTOR_BY_SIDE3 = {
|
|
3558
|
-
bottom: { x: 0, y: 1 },
|
|
3559
|
-
left: { x: 1, y: 0 },
|
|
3560
|
-
right: { x: -1, y: 0 },
|
|
3561
|
-
top: { x: 0, y: -1 }
|
|
3562
|
-
};
|
|
3563
|
-
function createPinClockSymbol({
|
|
3564
|
-
pin,
|
|
3565
|
-
recordIndex,
|
|
3566
|
-
scale: scale5,
|
|
3567
|
-
schematicPort
|
|
3568
|
-
}) {
|
|
3569
|
-
const side = schematicPort.side_of_component;
|
|
3570
|
-
if (pin.getNumber("SYMBOL_INNEREDGE") !== 3 || !side) return void 0;
|
|
3571
|
-
const edgeVector = EDGE_VECTOR_BY_SIDE3[side];
|
|
3572
|
-
const pinLength = schematicPort.distance_from_component_edge ?? 0.4;
|
|
3573
|
-
const bodyPosition = {
|
|
3574
|
-
x: schematicPort.center.x + edgeVector.x * pinLength,
|
|
3575
|
-
y: schematicPort.center.y + edgeVector.y * pinLength
|
|
3576
|
-
};
|
|
3577
|
-
const clockDepth = scaleLength(4, scale5);
|
|
3578
|
-
const clockHalfWidth = scaleLength(2, scale5);
|
|
3579
|
-
const perpendicularVector = { x: -edgeVector.y, y: edgeVector.x };
|
|
3580
|
-
const clockTip = {
|
|
3581
|
-
x: bodyPosition.x + edgeVector.x * clockDepth,
|
|
3582
|
-
y: bodyPosition.y + edgeVector.y * clockDepth
|
|
3583
|
-
};
|
|
3584
|
-
const clockBaseStart = {
|
|
3585
|
-
x: bodyPosition.x + perpendicularVector.x * clockHalfWidth,
|
|
3586
|
-
y: bodyPosition.y + perpendicularVector.y * clockHalfWidth
|
|
3587
|
-
};
|
|
3588
|
-
const clockBaseEnd = {
|
|
3589
|
-
x: bodyPosition.x - perpendicularVector.x * clockHalfWidth,
|
|
3590
|
-
y: bodyPosition.y - perpendicularVector.y * clockHalfWidth
|
|
3591
|
-
};
|
|
3592
|
-
return {
|
|
3593
|
-
type: "schematic_path",
|
|
3594
|
-
fill_color: "transparent",
|
|
3595
|
-
is_dashed: false,
|
|
3596
|
-
is_filled: false,
|
|
3597
|
-
points: [clockTip, clockBaseStart, clockBaseEnd, clockTip],
|
|
3598
|
-
schematic_component_id: schematicPort.schematic_component_id,
|
|
3599
|
-
schematic_path_id: `schematic_pin_clock_altium_${recordIndex}`,
|
|
3600
|
-
schematic_sheet_id: schematicPort.schematic_sheet_id,
|
|
3601
|
-
stroke_color: "#a90000",
|
|
3602
|
-
stroke_width: 0.02
|
|
3603
|
-
};
|
|
3604
|
-
}
|
|
3605
|
-
|
|
3606
3764
|
// lib/schematic/components/createComponentPinEdgeElements.ts
|
|
3607
3765
|
function createComponentPinEdgeElements({
|
|
3608
3766
|
componentPorts,
|
|
@@ -3843,7 +4001,7 @@ function convertComponent({
|
|
|
3843
4001
|
(record) => isOwnedRecordVisible(record, currentPartId)
|
|
3844
4002
|
);
|
|
3845
4003
|
const pins = visibleOwnedRecords.filter(
|
|
3846
|
-
(record) => record instanceof
|
|
4004
|
+
(record) => record instanceof AltiumSchPinRecord5 && (!isPinHidden(record) || options.includeHidden === true)
|
|
3847
4005
|
);
|
|
3848
4006
|
const identity = getComponentIdentity(
|
|
3849
4007
|
{ componentIndex, componentRecord, ownedRecords },
|
|
@@ -3852,12 +4010,8 @@ function convertComponent({
|
|
|
3852
4010
|
if (identity.shouldCreateSourceComponent) {
|
|
3853
4011
|
elements.push(
|
|
3854
4012
|
createSourceComponent({
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
libraryReference: identity.libraryReference,
|
|
3858
|
-
manufacturerPartNumber: identity.manufacturerPartNumber,
|
|
3859
|
-
pinCount: pins.length,
|
|
3860
|
-
sourceComponentId: identity.sourceComponentId
|
|
4013
|
+
...identity,
|
|
4014
|
+
pinCount: pins.length
|
|
3861
4015
|
})
|
|
3862
4016
|
);
|
|
3863
4017
|
}
|
|
@@ -3890,11 +4044,14 @@ function convertComponent({
|
|
|
3890
4044
|
libraryReference: identity.libraryReference,
|
|
3891
4045
|
ports: componentPorts
|
|
3892
4046
|
});
|
|
3893
|
-
const
|
|
3894
|
-
{ identity,
|
|
4047
|
+
const singleInputGateBody = symbolSelection ? void 0 : convertOwnedSingleInputGateBody(
|
|
4048
|
+
{ identity, records: visibleOwnedRecords, componentPorts },
|
|
3895
4049
|
context
|
|
3896
4050
|
);
|
|
3897
|
-
const
|
|
4051
|
+
const ownedComponentBody = singleInputGateBody ?? (symbolSelection ? void 0 : convertOwnedComponentBody(
|
|
4052
|
+
{ identity, pins, records: visibleOwnedRecords, visibleSymbolLabels },
|
|
4053
|
+
context
|
|
4054
|
+
));
|
|
3898
4055
|
const center = scalePoint(getBoundsCenter(bodyBounds), options.scale);
|
|
3899
4056
|
const size = symbolSelection ? { ...symbolSelection.symbol.size } : {
|
|
3900
4057
|
height: Math.max(
|
|
@@ -3909,11 +4066,11 @@ function convertComponent({
|
|
|
3909
4066
|
if (symbolSelection) {
|
|
3910
4067
|
applyNativeSymbolPortGeometry({ center, selection: symbolSelection });
|
|
3911
4068
|
}
|
|
3912
|
-
const pinEdgeElements = createComponentPinEdgeElements(
|
|
4069
|
+
const pinEdgeElements = singleInputGateBody ? [] : createComponentPinEdgeElements(
|
|
3913
4070
|
{
|
|
3914
4071
|
componentPorts,
|
|
3915
|
-
|
|
3916
|
-
|
|
4072
|
+
pins,
|
|
4073
|
+
includeNumericDesignators: Boolean(ownedComponentBody) && options.includeText !== false
|
|
3917
4074
|
},
|
|
3918
4075
|
context
|
|
3919
4076
|
);
|
|
@@ -3931,7 +4088,7 @@ function convertComponent({
|
|
|
3931
4088
|
const schematicComponent = {
|
|
3932
4089
|
type: "schematic_component",
|
|
3933
4090
|
center,
|
|
3934
|
-
is_box_with_pins: !
|
|
4091
|
+
is_box_with_pins: !ownedComponentBody,
|
|
3935
4092
|
schematic_component_id: identity.schematicComponentId,
|
|
3936
4093
|
schematic_sheet_id: options.schematicSheetId,
|
|
3937
4094
|
size,
|
|
@@ -3940,15 +4097,15 @@ function convertComponent({
|
|
|
3940
4097
|
...symbolSelection ? { symbol_name: symbolSelection.name } : {}
|
|
3941
4098
|
};
|
|
3942
4099
|
elements.push(schematicComponent);
|
|
3943
|
-
if (
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
}
|
|
4100
|
+
if (symbolSelection || ownedComponentBody || options.includeText === false)
|
|
4101
|
+
return;
|
|
4102
|
+
addComponentFallbackText({
|
|
4103
|
+
componentIndex,
|
|
4104
|
+
designator: identity.designator,
|
|
4105
|
+
displayText: identity.displayText,
|
|
4106
|
+
elements,
|
|
4107
|
+
schematicComponent
|
|
4108
|
+
});
|
|
3952
4109
|
}
|
|
3953
4110
|
|
|
3954
4111
|
// lib/schematic/components/convertComponents.ts
|