altium-to-circuit-json 0.0.77 → 0.0.78
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.d.ts +6 -1
- package/dist/index.js +39 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayerRef, SourceSimpleChip, SourcePort, AnyCircuitElement, SourceNet, SourceTrace } from 'circuit-json';
|
|
2
|
-
import { AltiumPcbDocument, AltiumRecord, AltiumPadRecord, AltiumSchDoc } from 'altiumts';
|
|
2
|
+
import { AltiumPcbDocument, AltiumRecord, AltiumPadRecord, AltiumSchDoc, AltiumPrjPcb } from 'altiumts';
|
|
3
3
|
|
|
4
4
|
declare class PcbCopperLayerMap {
|
|
5
5
|
readonly layers: LayerRef[];
|
|
@@ -110,9 +110,14 @@ declare function convertAltiumPcbDocToCircuitJson(document: AltiumPcbDocument, o
|
|
|
110
110
|
|
|
111
111
|
interface ConvertAltiumSchDocOptions {
|
|
112
112
|
centerOnSchematicSheet?: boolean;
|
|
113
|
+
currentDate?: string;
|
|
114
|
+
currentTime?: string;
|
|
115
|
+
documentName?: string;
|
|
113
116
|
includeHidden?: boolean;
|
|
114
117
|
includeSheetBorder?: boolean;
|
|
115
118
|
includeText?: boolean;
|
|
119
|
+
project?: AltiumPrjPcb;
|
|
120
|
+
projectName?: string;
|
|
116
121
|
schematicUnitScale?: number;
|
|
117
122
|
sheetName?: string;
|
|
118
123
|
}
|
package/dist/index.js
CHANGED
|
@@ -837,6 +837,28 @@ function getFontFamily(record, context) {
|
|
|
837
837
|
return context.sheetRecord?.getDecoded(`FONTNAME${fontId}`) ?? "Arial";
|
|
838
838
|
}
|
|
839
839
|
|
|
840
|
+
// lib/schematic/text/resolveSchematicText.ts
|
|
841
|
+
import {
|
|
842
|
+
resolveSchematicParameterReferenceWithContext
|
|
843
|
+
} from "altiumts";
|
|
844
|
+
function resolveSchematicText({
|
|
845
|
+
document,
|
|
846
|
+
options,
|
|
847
|
+
record,
|
|
848
|
+
reference
|
|
849
|
+
}) {
|
|
850
|
+
return resolveSchematicParameterReferenceWithContext({
|
|
851
|
+
currentDate: options.currentDate,
|
|
852
|
+
currentTime: options.currentTime,
|
|
853
|
+
document,
|
|
854
|
+
documentName: options.documentName,
|
|
855
|
+
project: options.project,
|
|
856
|
+
projectName: options.projectName,
|
|
857
|
+
record,
|
|
858
|
+
reference
|
|
859
|
+
}) ?? reference;
|
|
860
|
+
}
|
|
861
|
+
|
|
840
862
|
// lib/schematic/text/wrapSchematicText.ts
|
|
841
863
|
function wrapSchematicText({
|
|
842
864
|
text,
|
|
@@ -882,9 +904,15 @@ function renderTextRecord({
|
|
|
882
904
|
if (kind === "4" || kind === "25" || kind === "32" || kind === "33" || kind === "34" || kind === "41") {
|
|
883
905
|
if (options.includeText === false) return [];
|
|
884
906
|
if (record.getBoolean("ISHIDDEN") && !options.includeHidden) return [];
|
|
885
|
-
const
|
|
907
|
+
const reference = record.getDecoded("TEXT") ?? record.getDecoded("NAME") ?? record.getDecoded("DESIGNATOR");
|
|
886
908
|
const location = getLocation(record);
|
|
887
|
-
if (!
|
|
909
|
+
if (!reference || !location) return [];
|
|
910
|
+
const text = resolveSchematicText({
|
|
911
|
+
document: context.document,
|
|
912
|
+
options,
|
|
913
|
+
record,
|
|
914
|
+
reference
|
|
915
|
+
});
|
|
888
916
|
return [createText({ record, index, text, location, color, context })];
|
|
889
917
|
}
|
|
890
918
|
if (kind === "28") {
|
|
@@ -3222,7 +3250,7 @@ function convertOwnedComponentRecords({
|
|
|
3222
3250
|
{
|
|
3223
3251
|
index,
|
|
3224
3252
|
options: {
|
|
3225
|
-
|
|
3253
|
+
...context.options,
|
|
3226
3254
|
includeText: record instanceof AltiumSchPinRecord ? false : context.options.includeText
|
|
3227
3255
|
},
|
|
3228
3256
|
record
|
|
@@ -3743,7 +3771,13 @@ function getComponentIdentity({
|
|
|
3743
3771
|
ownedRecords
|
|
3744
3772
|
}, context) {
|
|
3745
3773
|
const designator = findOwnedDesignator(ownedRecords) ?? componentRecord.designator ?? `U${componentIndex}`;
|
|
3746
|
-
const
|
|
3774
|
+
const displayTextReference = findOwnedParameterText(ownedRecords, "Value")?.trim() || findOwnedParameterText(ownedRecords, "Comment")?.trim() || componentRecord.comment?.trim() || componentRecord.designItemId?.trim() || componentRecord.libraryReference?.trim() || "";
|
|
3775
|
+
const displayText = resolveSchematicText({
|
|
3776
|
+
document: context.document,
|
|
3777
|
+
options: context.options,
|
|
3778
|
+
record: componentRecord,
|
|
3779
|
+
reference: displayTextReference
|
|
3780
|
+
}).trim();
|
|
3747
3781
|
const libraryReference = componentRecord.libraryReference ?? componentRecord.designItemId ?? designator;
|
|
3748
3782
|
const manufacturerPartNumber = findOwnedParameterText(
|
|
3749
3783
|
ownedRecords,
|
|
@@ -4193,8 +4227,7 @@ function convertSemanticSchematic(document, options) {
|
|
|
4193
4227
|
// lib/schematic/document/convertSchematicSemantics.ts
|
|
4194
4228
|
function convertSchematicSemantics(context) {
|
|
4195
4229
|
const conversion = convertSemanticSchematic(context.document, {
|
|
4196
|
-
|
|
4197
|
-
includeText: context.options.includeText,
|
|
4230
|
+
...context.options,
|
|
4198
4231
|
scale: context.scale,
|
|
4199
4232
|
schematicSheetId: SCHEMATIC_SHEET_ID
|
|
4200
4233
|
});
|