altium-toolkit 1.4.18 → 1.4.19

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.
@@ -640,3 +640,13 @@ Focused machine-readable schemas are available under
640
640
  `docs/schemas/altium_toolkit/` for the normalized root plus focused project,
641
641
  netlist, SVG, PCB review, layer-stack, Draftsman, library, parser QA,
642
642
  inspection, unsupported-feature, and CI/reporting contracts.
643
+
644
+ ## Loaded net-name queries
645
+
646
+ The `LoadedDesignNetlistService` extension lists and searches declared names in
647
+ `schematic.nets` and `pcb.nets`, including named nets without component pins.
648
+ Names are trimmed, deduplicated, and sorted. Retained native document envelopes
649
+ use the same lookup. Missing net names still produce a missing-data error.
650
+
651
+ Net listing does not create schematic connectivity: `hasConnectivity`, component
652
+ pin queries, and extended-net traversal continue to use the schematic pin graph.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "altium-toolkit",
3
- "version": "1.4.18",
3
+ "version": "1.4.19",
4
4
  "description": "Altium document parsing and non-interactive rendering utilities",
5
5
  "keywords": [
6
6
  "altium",
@@ -96,13 +96,20 @@ export class LoadedDesignNetlistService {
96
96
  * @returns {{ nets: string[] } | { error: string }}
97
97
  */
98
98
  listNets(args = {}) {
99
- const resolved = this.#resolveDesignWithConnectivity(args.design)
99
+ const resolved = this.#resolveDesign(args.design)
100
100
  if (resolved.error) return resolved
101
101
 
102
+ const netNames = LoadedDesignNetlistService.#netNames(
103
+ resolved.entry.documentModel
104
+ )
105
+ if (!netNames.length) {
106
+ return {
107
+ error: 'No schematic connectivity is available for this loaded design.'
108
+ }
109
+ }
110
+
102
111
  return {
103
- nets: Object.keys(resolved.netlist.nets).sort((left, right) =>
104
- left.localeCompare(right)
105
- )
112
+ nets: netNames.sort((left, right) => left.localeCompare(right))
106
113
  }
107
114
  }
108
115
 
@@ -112,13 +119,22 @@ export class LoadedDesignNetlistService {
112
119
  * @returns {{ results: Record<string, string[]>, notes?: string[] } | { error: string }}
113
120
  */
114
121
  searchNets(args = {}) {
115
- const resolved = this.#resolveDesignWithConnectivity(args.design)
122
+ const resolved = this.#resolveDesign(args.design)
116
123
  if (resolved.error) return resolved
117
124
 
125
+ const netNames = LoadedDesignNetlistService.#netNames(
126
+ resolved.entry.documentModel
127
+ )
128
+ if (!netNames.length) {
129
+ return {
130
+ error: 'No schematic connectivity is available for this loaded design.'
131
+ }
132
+ }
133
+
118
134
  const parsed = RegexPattern.parse(args.pattern)
119
135
  if (parsed.error) return parsed
120
136
 
121
- const allNets = Object.keys(resolved.netlist.nets)
137
+ const allNets = netNames
122
138
  if (RegexPattern.rejectsBroadMatch(args.pattern, allNets)) {
123
139
  return {
124
140
  error: 'Pattern matches every net. Use list_nets for full net lists.'
@@ -389,6 +405,24 @@ export class LoadedDesignNetlistService {
389
405
  return response
390
406
  }
391
407
 
408
+ /**
409
+ * Lists declared net names independently of schematic pin connectivity.
410
+ * @param {object} documentModel Resolved native document model.
411
+ * @returns {string[]} Unique nonempty net names.
412
+ */
413
+ static #netNames(documentModel) {
414
+ // Listing names does not require the pin graph used for traversal.
415
+ return [
416
+ ...new Set(
417
+ [documentModel?.schematic?.nets, documentModel?.pcb?.nets]
418
+ .filter(Array.isArray)
419
+ .flatMap((nets) => nets)
420
+ .map((net) => String(net?.name || '').trim())
421
+ .filter(Boolean)
422
+ )
423
+ ]
424
+ }
425
+
392
426
  /**
393
427
  * Resolves one design and requires schematic connectivity.
394
428
  * @param {string | undefined} design Design selector.