altium-toolkit 1.1.31 → 1.1.32

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.
@@ -81,7 +81,7 @@ export class PcbScene3dPlacementSideResolver {
81
81
  * Scores how strongly one component record appears to belong to one body
82
82
  * record based on shared model/footprint tokens.
83
83
  * @param {{ name?: string, identifier?: string }} componentBody
84
- * @param {{ pattern?: string, source?: string, modelPath?: string }} component
84
+ * @param {{ pattern?: string, source?: string, modelPath?: string, description?: string, parameters?: object, provenance?: object }} component
85
85
  * @returns {number}
86
86
  */
87
87
  static scoreBodyComponentAffinity(componentBody, component) {
@@ -94,7 +94,11 @@ export class PcbScene3dPlacementSideResolver {
94
94
  PcbScene3dPlacementSideResolver.#collectMeaningfulTokens([
95
95
  component?.pattern,
96
96
  component?.source,
97
- component?.modelPath
97
+ component?.modelPath,
98
+ component?.description,
99
+ ...PcbScene3dPlacementSideResolver.#componentPackageMetadata(
100
+ component
101
+ )
98
102
  ])
99
103
  let score = 0
100
104
 
@@ -107,6 +111,34 @@ export class PcbScene3dPlacementSideResolver {
107
111
  return score
108
112
  }
109
113
 
114
+ /**
115
+ * Resolves package-related component metadata that can identify generic
116
+ * embedded 3D bodies when pattern/source only name the electrical part.
117
+ * @param {{ parameters?: object, provenance?: object } | null | undefined} component Component record.
118
+ * @returns {string[]}
119
+ */
120
+ static #componentPackageMetadata(component) {
121
+ const parameters =
122
+ component?.parameters && typeof component.parameters === 'object'
123
+ ? component.parameters
124
+ : {}
125
+ const provenance =
126
+ component?.provenance && typeof component.provenance === 'object'
127
+ ? component.provenance
128
+ : {}
129
+
130
+ return [
131
+ parameters['Package / Case'],
132
+ parameters['Supplier Device Package'],
133
+ parameters['Part Description'],
134
+ parameters.Package,
135
+ provenance.footprintDescription,
136
+ provenance.sourceLibReference,
137
+ provenance.sourceFootprintLibrary,
138
+ provenance.sourceFootprintLibraryName
139
+ ].map((value) => String(value || ''))
140
+ }
141
+
110
142
  /**
111
143
  * Resolves side from the normalized component layer.
112
144
  * @param {string | undefined} layer