KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pads_binary_parser.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2026 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <string>
23#include <vector>
24#include <map>
25#include <set>
26#include <cstdint>
27#include <optional>
28
29#include <math/vector2d.h>
30#include <wx/string.h>
31
33
34#include "pads_parser.h"
35#include "pads_sdb.h"
36
37namespace PADS_IO
38{
39
46enum class SECTION : int
47{
48 BoardSetup = 1, // view-state / origin header
49 PadStacks = 4, // padstack definitions (64 B/rec)
50 PadShapes = 5, // per-padstack pad-shape layer table
51 FreeText = 8, // free-text / label table + string pool
52 StringPool = 9, // string-pool tail + DRW array head
53 DrwItems = 10, // LINES/DRW drawing-object array (112 B)
54 GraphicPieces = 11, // graphic-piece header + inline outline coords (20 B)
55 Vertices = 12, // graphic-piece vertex pool (12 B)
56 DecalLibrary = 13, // per-decal block table + trailing library padstack-index table
57 DecalHeader = 14, // PARTDECAL definition table (112 B)
58 TerminalPool = 15, // decal terminal position table (36 B)
59 ParttypeDefs = 17, // parttype/footprint defs (224 B)
60 PartPins = 19, // PARTTYPE pin-definition table (88 B)
61 Placements = 22, // part placements (112 B)
62 Nets = 23, // net records (424 B)
63 Connections = 24, // pin-pair topology records (68 B)
64 ClearanceRules = 49, // clearance/design-rule heap
65 PourTokensA = 52, // pour-relation token streams
68 PourTokensD = 55, // pour arc records (16 B)
69 Vias = 60, // route-junction / via records (64 B)
70 RouteObjects = 62, // routed-subpath descriptors (48 B)
71 RouteLayers = 63, // active copper-layer ordinals (2 B)
72 RouteCells = 64, // routed-subpath point cells (12 B)
73 Clusters = 68, // part-cluster (*CLUSTER*) controller (60 B/rec)
74 LayerTable = 69, // ODBLayer physical-stackup table (152 B/rec)
75};
76
85{
86 std::string name;
87 std::vector<std::string> nets;
88 std::vector<int> ruleLayers; // layers carrying a clearance rule (0 = all layers)
89
90 // Per-class rule values, positionally joined to the type-66 clearance edge by declaration
91 // order. All in BASIC units. hasRuleValues is false when the value and edge counts disagree.
92 int clearance = 0;
93 int trackWidth = 0;
96 int viaClearance = 0;
97 bool hasRuleValues = false;
98};
99
103{
104 int32_t x = 0;
105 int32_t y = 0;
106 int32_t attr = 0;
107};
108
112{
113 uint32_t owner = 0;
114 uint32_t ruleKind = 0;
115 uint32_t rulePtr = 0;
116 int layer = 0;
117 size_t off = 0;
118};
119
127{
128 std::string name;
129 int id = 0; // 1-based ordinal; equals the sec22 +108 CLSTID reference
130};
131
144{
145public:
148
149 // m_cursor holds a reference to m_data, so a copy would bind the clone's reads to the
150 // source buffer. Forbid copying rather than leave a dangling-reference trap.
151 BINARY_PARSER( const BINARY_PARSER& ) = delete;
153
154 void Parse( const wxString& aFileName );
155
160 static bool IsBinaryPadsFile( const wxString& aFileName );
161
162 const PARAMETERS& GetParameters() const { return m_parameters; }
163
164 const std::vector<PART>& GetParts() const { return m_parts; }
165 const std::vector<NET>& GetNets() const { return m_nets; }
166 const std::vector<BIN_NET_CLASS_DEF>& GetNetClasses() const { return m_netClasses; }
167 const std::vector<DIFF_PAIR_DEF>& GetDiffPairs() const { return m_diffPairs; }
168 const std::vector<ROUTE>& GetRoutes() const { return m_routes; }
169 const std::vector<TEXT>& GetTexts() const { return m_texts; }
170 const std::vector<POUR>& GetPours() const { return m_pours; }
171 const std::vector<KEEPOUT>& GetKeepouts() const { return m_keepouts; }
172 const std::vector<COPPER_SHAPE>& GetCopperShapes() const { return m_copper_shapes; }
173 const std::vector<GRAPHIC_LINE>& GetGraphicLines() const { return m_graphicLines; }
174 const std::vector<DIMENSION>& GetDimensions() const { return m_dimensions; }
175 const std::vector<POLYLINE>& GetBoardOutlines() const { return m_boardOutlines; }
176 const std::map<std::string, PART_DECAL>& GetPartDecals() const { return m_decals; }
177
178 // Part clusters and the per-part membership map. The membership key is an index into
179 // GetParts(); the value is the 1-based CLSTID, which equals the GetClusters() ordinal.
180 const std::vector<PART_CLUSTER>& GetClusters() const { return m_clusters; }
181 const std::map<size_t, int>& GetPartClusterIds() const { return m_partClusterId; }
182
183 int GetLayerCount() const { return m_parameters.layer_count; }
184 uint16_t GetVersion() const { return m_version; }
185
186 std::vector<LAYER_INFO> GetLayerInfos() const;
187
188 std::set<std::string> GetPadStackShapesForTest() const
189 {
190 std::set<std::string> shapes;
191
192 for( const std::vector<PAD_STACK_LAYER>& layers : m_padStackPool )
193 {
194 for( const PAD_STACK_LAYER& psl : layers )
195 shapes.insert( psl.shape );
196 }
197
198 return shapes;
199 }
200
201 bool GetOwnerLoopForTest( const std::string& aName, std::vector<VECTOR2I>& aOut ) const
202 {
203 return fetchOwnerLoop( aName, 200, aOut );
204 }
205
206private:
207 static constexpr int32_t ANGLE_SCALE = 1800000;
208
213 {
214 int32_t x = 0;
215 int32_t y = 0;
216 std::string netName;
217 int viaIndex = -1;
218 bool relationshipNet = false;
219 };
220
221 bool isOldFormat() const { return m_sdb.IsOldFormat(); }
222
224 size_t layerStackupBase() const;
225
226 // Both old dialects resolve a placement's decal via a direct index in the next physical
227 // record rather than through a parttype-definition table (v0x2022 does have such a table,
228 // but placements don't reference it); only the field's offset within that record differs.
229 bool usesDirectDecalChain() const { return m_version <= 0x2022; }
230
231 // The SECTION overload forwards to the int form so a constant section reads by role; the
232 // int form serves callers that iterate a computed directory index.
233 const SDB_SECTION* getSection( int aIndex ) const;
234 const SDB_SECTION* getSection( SECTION aSection ) const { return getSection( static_cast<int>( aSection ) ); }
235
236 void parseBoardSetup();
237 void parsePartPlacements();
238
239
240 // Build a PART from a placement record's refdes and its coordinate, rotation and side fields.
241 PART makePlacementPart( const SDB_RECORD& aRec, int aXOff, std::optional<int> aYOff, int aAngleOff, int aNameOff,
242 const std::string& aRefDes ) const;
243 void parsePadStacks();
244 void parsePartDecals();
245 void parseDecalNameTable();
247 void parsePartTypeTable();
249 void parseGraphicLines();
250
251 // Resolve the section-13 arc-parameter record that a corner's attr ordinal names, relative to
252 // its owner's arc cursor. aWhat names the calling decoder in the range error.
253 SDB_RECORD arcRecordFor( const SDB_SECTION& aArcParameters, int32_t aArcStart, int32_t aAttr,
254 const char* aWhat ) const;
255
256 void parseNetNames();
257 void parseNetNamesNew();
258 void parseNetNamesOld();
260 std::map<uint32_t, size_t> parseRouteJunctionNets() const;
261
262 // Offsets of the legacy serialized net table in dense-index order. Its logical ring starts
263 // 20 bytes after section 23's physical cursor; a record's position in this sequence IS the
264 // net ordinal that route and via
265 // records reference, so the sequence must stay unfiltered even where a record is unusable.
266 std::vector<size_t> oldNetRecordOffsets() const;
267
268 // Recover v0x2021 pin-to-net membership from the section-24 connection stream. The stream is
269 // not partitioned into per-net runs, so a net's members are the connected component of the
270 // pin graph reached from the net record's first-connection index (record +8); the record's
271 // connection count (+92) corroborates the join before any pin is attributed.
273
274 void resolveNetAnchors();
275
276 // Recover part clusters. Membership itself is captured during parsePartPlacements into
277 // m_partClusterId; a record's 1-based ordinal is the CLSTID that sec22 +108 references.
278 void parseClusters();
279
280 // Group nets by their +188 net-class pointer for membership, name each class from the
281 // 0x118 name table, and read per-class clearance-rule layers from the type-66 rule table.
282 void parseNetClasses();
283 std::vector<NET_CLASS_RULE_EDGE> collectNetClassRuleEdges( const std::set<uint32_t>& aOwnerSet );
284 void applyNetClassClearances( const std::vector<NET_CLASS_RULE_EDGE>& aEdges,
285 const std::map<uint32_t, size_t>& aOwnerOrdinal );
286
287 // Recover serialized differential pairs from the sec49 MFC heap. Member nets are the
288 // self-pointers at +12/+16, joined to a net name via m_netSelfPtrToName. Inherit-default
289 // pairs are not serialized, so coverage is limited to override pairs. v0x2027 only.
290 void parseDiffPairs();
291 void parseRouteVertices();
292
293 // Section-60 phase of parseRouteVertices: decode the via-junction ring, join each junction
294 // to its net through the section-49 relationship graph, and de-duplicate by coordinate.
295 std::vector<VIA_LOCATION> decodeViaLocations();
296
297 // Seed one ROUTE per net from the decoded vias, resolving each via's padstack and drill span
298 // through the decal it names.
299 std::map<std::string, ROUTE> seedRoutesFromVias( const std::vector<VIA_LOCATION>& aVias ) const;
300
301 // Decode the sections 62/63/64 routed-copper descriptors into tracks and append them to the
302 // seeded routes, attributing each object to a net through its route-node handle. Returns
303 // false when the route-object controller declares nothing, which the caller reads as "this
304 // board carries no routing" and drops the seeded via-only routes along with it.
305 void decodeRoutedCopper( std::map<std::string, ROUTE>& aRoutes );
306
310 {
311 std::vector<int> layers;
312 std::vector<uint32_t> handles;
313 std::map<uint32_t, std::set<size_t>> handleNets;
314 };
315
316 // Walk the section-25/26/27/29/61 route-node allocator to recover the layer, node handle and
317 // reachable nets of every routed-copper object. aObjectCount is the section-62 descriptor
318 // count, which the per-layer handle scan must reproduce exactly.
319 ROUTE_OBJECT_NODES resolveRouteObjectNodes( const SDB_SECTION& aRouteLayers, size_t aObjectCount,
320 const std::vector<int>& aSerializedLayerOrder );
321
322 void parseTextRecords();
323
324 // Attach the section-8 field-presentation chain of every placement that declares one to its
325 // PART as attributes. Consumes m_partFieldStart.
326 void parsePlacementFields( const SDB_SECTION& aText, size_t aRecordBase, size_t aRecordSize, size_t aRingRotation );
327
328 // Emit a TEXT for every free-text section-8 record whose lagged metadata declares a
329 // string-pool offset and a text layer.
330 void parseFreeText( const SDB_SECTION& aText, size_t aRecordBase, size_t aRecordSize, size_t aRingRotation,
331 size_t aPoolBase, size_t aPoolHi );
332
333 void parseTerminals();
334
335 // Give every decal that owns terminals the global padstack-zero default; a decal's own
336 // serialized (pin, ref) pairs override it later.
338
339 // Apply one decal's (pin, ref) pair slice: pin 0 sets the decal default, pin>0 overrides
340 // that terminal. Shared by the descriptor and library passes.
341 void applyPadstackPairs( PART_DECAL& aDecal, const std::vector<std::pair<int32_t, int32_t>>& aPairs, int32_t aStart,
342 int32_t aCount );
343 void parseKeepouts();
344 void parseCopperShapes();
345 void parseCopperPours();
346
347 // Reconstruct PADS dimensions, which the binary does not store as a dedicated section.
348 // Each dimension is a DRW graphic-piece owner named DIM* whose sec12 vertex run holds the
349 // leader sub-pieces. Must run after buildOwnerRuns and parseTextRecords, which it consumes.
350 void parseDimensions();
351
352 // Decode the versioned section-69 layer-definition and physical-stackup table from its
353 // directly framed physical controller.
354 void parseLayerStackup();
355
356 void linkPartsToDecals();
357
358 // Structural shape -> section-12 vertex link. Section 10 is a declared circular fixed array,
359 // rotated left 68 bytes within its own extent. Owner R[i]'s cursors and item kind live in
360 // R[(i+1) mod count]; no marker search or cross-controller walk participates.
362 {
363 int32_t pieceStart = 0; // R[i+1] @ +8
364 int32_t vertexStart = 0; // R[i+1] @ +12, cumulative sec12 corner cursor
365 int32_t arcStart = 0; // R[i+1] @ +16
366 int32_t pieceCount = 0; // R[i+1] @ +24
367 uint32_t itemKind = 0; // R[i+1] @ +28: low 16 bits are the item enum; high 16 are flags
368 uint32_t ownerIndex = 0; // R[i]'s index in the rotated section-10 record ring
369 };
370
371 // Owner DRW name -> lagged run, keyed by the +44 name. Built once by buildOwnerRuns().
372 std::map<std::string, OWNER_RUN> m_ownerRuns;
373
374 // Section 12 is a direct fixed array, so its usable row count is its declared record count.
375 int32_t m_sec12CleanRows = 0;
376
377 void buildOwnerRuns();
379
380 uint8_t ringU8( const SDB_SECTION& aSection, size_t aRotation, size_t aStride, uint32_t aIndex,
381 size_t aField ) const;
382 uint32_t ringU32( const SDB_SECTION& aSection, size_t aRotation, size_t aStride, uint32_t aIndex,
383 size_t aField ) const;
384 int32_t ringI32( const SDB_SECTION& aSection, size_t aRotation, size_t aStride, uint32_t aIndex,
385 size_t aField ) const;
386 std::string ringStr( const SDB_SECTION& aSection, size_t aRotation, size_t aStride, uint32_t aIndex, size_t aField,
387 size_t aLength ) const;
388
389 bool sec12Vertex( int32_t aRow, int32_t& aX, int32_t& aY, int32_t& aAttr ) const;
390
391 // Fetch the closed polygon declared by the owner's vertexStart and its first piece's exact
392 // corner count. Returns the design-coordinate vertices excluding the serialized closing
393 // point. The repeated first point validates the declared range; it does not delimit it.
394 bool fetchOwnerLoop( const std::string& aName, size_t aMaxVerts, std::vector<VECTOR2I>& aOut ) const;
395
396 // A circular piece (PADS' COPCIR convention) stores exactly two diametrically opposite
397 // endpoints, not a closed loop, so its declared corner count is two rather than a polygon's
398 // closing-point-inclusive count. Returns the two points directly; the caller is
399 // expected to cross-check the derived circle (center = midpoint, radius = half the span)
400 // against the owner's own declared bbox, since two arbitrary adjacent points are not enough
401 // signal on their own.
402 bool fetchOwnerCirclePoints( const std::string& aName, VECTOR2I& aP0, VECTOR2I& aP1 ) const;
403
404 bool isValidNetName( const std::string& aName ) const;
405
406 // Coordinate conversion from binary absolute to PADS_IO design-relative units
407 double toBasicCoordX( int32_t aRawValue ) const;
408 double toBasicCoordY( int32_t aRawValue ) const;
409 double toBasicAngle( int32_t aRawAngle ) const;
410
411 // Owns the file bytes and decodes the container; the section readers work through it.
413
414 // m_data aliases the SDB's bytes for the absolute-offset readers; m_cursor follows it.
415 // Both are declared after m_sdb so their references bind to its live buffer.
416 const std::vector<uint8_t>& m_data = m_sdb.Bytes();
418
419 uint16_t m_version = 0;
420
421 // Coordinate origin from the serialized board-setup block.
422 int32_t m_originX = 0;
423 int32_t m_originY = 0;
424
425 // Section-4 pad-stack pool, 0-based from its versioned logical ring start. Section-16
426 // (terminal, padstack) pairs index this pool directly.
427 std::vector<std::vector<PAD_STACK_LAYER>> m_padStackPool;
428 std::vector<std::pair<int, int>> m_padStackDrillSpans;
429
430 // Part index -> parttype index from the NEXT section 22 record (@+4 with +1 block lag).
431 // Indexes into m_partTypeDecalIndices.
432 std::map<size_t, uint32_t> m_partTypeIndex;
433
434 // Placement index -> first section-8 field-presentation record from section 22 +96.
435 std::map<size_t, int32_t> m_partFieldStart;
436
437 // Part index -> zero-based alternate decal selector from the NEXT placement record @+17.
438 std::map<size_t, uint8_t> m_partDecalAlternate;
439
440 // Part index -> direct decal index for v0x2021, which carries no parttype layer; the decal
441 // is selected from the NEXT 96 B placement record's @+56 field. Indexes m_decalNameTable.
442 std::map<size_t, uint32_t> m_partDecalIndex;
443
444 // All decal indices for each parttype, primary first, then alternates. The parttype table is
445 // the logical ring 44 bytes before section 17's physical cursor. New-format records store
446 // duplicate index pairs at +96/+100, +104/+108, ... until -1; v0x2022 carries a single index
447 // at +112. An empty entry means the parttype declares no decal.
448 std::vector<std::vector<int32_t>> m_partTypeDecalIndices;
449
450 // The parttype's own alias name at logical +44, parallel to
451 // m_partTypeDecalIndices. This is the *PARTTYPE name a part references directly -- often a
452 // manufacturer part number -- distinct from the physical decal it resolves to.
453 std::vector<std::string> m_partTypeNames;
454
455 // Complete section-14 logical decal table, whose record-zero NAME lands at the physical
456 // cursor. Includes vias, connectors and mounting holes that section 10 lacks. table[0] is
457 // always JMPVIA_AAAAA.
458 std::vector<std::string> m_decalNameTable;
459
460 // Decal name -> terminal count (+72 of the decal-name header record). Covers
461 // passives/connectors that lack a sec14 descriptor.
462 std::map<std::string, uint32_t> m_decalTerminalCount;
463
464 // Decal name -> start cursor (i32 @ +68) into the unified terminal stream POOL33 ++ SEC15.
465 // A decal's terminals are stream[start .. start+count). Stored rather than derived from
466 // counts because the pool de-duplicates geometrically identical decals onto shared windows.
467 std::map<std::string, int32_t> m_decalTerminalStart;
468
469 // Decal name -> pad-stack count (i32 @ +88), the length of its (pin, ref) pair slice.
470 std::map<std::string, int32_t> m_decalStackCount;
471
472 // Decal name -> start cursor (i32 @ +44) into the section-15 (pin, padstack-ref) pool.
473 std::map<std::string, int32_t> m_decalStackStart;
474
475 // Route-node object handle -> the nets its section-60 junction belongs to. Built by
476 // decodeViaLocations from the section-49 relationship graph; decodeRoutedCopper walks the
477 // route-node link graph out from each object to reach it.
478 std::map<uint32_t, std::set<size_t>> m_junctionHandleNets;
479
480 // Section 23 array index -> net name, used to attribute structural vias to nets.
481 std::map<uint32_t, std::string> m_sec23IndexToNet;
482 std::map<uint32_t, size_t> m_sec23RecordToNet;
483
485 {
486 size_t netIndex;
489 };
490
491 std::vector<NET_ANCHOR> m_netAnchors;
492 std::vector<NET_ANCHOR> m_netConnectionEndpoints;
493
494 // The serialized placement object ID is the nominal section-22 record ordinal plus 11.
495 // Keep the object identity separate from m_parts order because invalid directory records
496 // do not produce imported parts.
497 std::map<uint32_t, size_t> m_placementObjectToPart;
498
499 // Net name -> its net-class object pointer (record +188); zero/absent for unclassed nets.
500 // Nets sharing a value are one class.
501 std::map<std::string, uint32_t> m_netClassOwner;
502
503 std::vector<BIN_NET_CLASS_DEF> m_netClasses;
504
505 // Net self-pointer (record +184) -> net name. The join key that resolves a sec49 DIF_PAIR
506 // object's +12/+16 member-net pointers to names.
507 std::map<uint32_t, std::string> m_netSelfPtrToName;
508
509 std::vector<DIFF_PAIR_DEF> m_diffPairs;
510
511 // Output data, same structs as the ASCII parser.
513 std::vector<PART> m_parts;
514 std::vector<NET> m_nets;
515 std::vector<ROUTE> m_routes;
516 std::vector<TEXT> m_texts;
517 std::vector<POUR> m_pours;
518 std::vector<KEEPOUT> m_keepouts;
519 std::vector<COPPER_SHAPE> m_copper_shapes;
520 std::vector<GRAPHIC_LINE> m_graphicLines;
521 std::vector<DIMENSION> m_dimensions;
522 std::vector<POLYLINE> m_boardOutlines;
523 std::map<std::string, PART_DECAL> m_decals;
524
525 // Part clusters in table order; index+1 is the CLSTID.
526 std::vector<PART_CLUSTER> m_clusters;
527
528 // Part index -> 1-based CLSTID from the placement record's +108 field. Recorded for the new
529 // 112-byte layout only; -1/absent = unclustered.
530 std::map<size_t, int> m_partClusterId;
531
532 // Directly framed section-69 physical stackup.
533 std::vector<LAYER_INFO> m_layerInfos;
534};
535
536} // namespace PADS_IO
Bounds-checked little-endian read cursor over a PADS binary buffer.
void decodeRoutedCopper(std::map< std::string, ROUTE > &aRoutes)
std::map< uint32_t, std::string > m_netSelfPtrToName
BINARY_PARSER(const BINARY_PARSER &)=delete
uint8_t ringU8(const SDB_SECTION &aSection, size_t aRotation, size_t aStride, uint32_t aIndex, size_t aField) const
double toBasicCoordY(int32_t aRawValue) const
ROUTE_OBJECT_NODES resolveRouteObjectNodes(const SDB_SECTION &aRouteLayers, size_t aObjectCount, const std::vector< int > &aSerializedLayerOrder)
const std::map< std::string, PART_DECAL > & GetPartDecals() const
std::vector< NET > m_nets
const std::vector< POLYLINE > & GetBoardOutlines() const
std::string ringStr(const SDB_SECTION &aSection, size_t aRotation, size_t aStride, uint32_t aIndex, size_t aField, size_t aLength) const
bool isValidNetName(const std::string &aName) const
std::map< std::string, uint32_t > m_decalTerminalCount
std::map< size_t, int > m_partClusterId
std::map< size_t, uint32_t > m_partDecalIndex
const std::vector< PART_CLUSTER > & GetClusters() const
std::vector< NET_CLASS_RULE_EDGE > collectNetClassRuleEdges(const std::set< uint32_t > &aOwnerSet)
std::map< std::string, ROUTE > seedRoutesFromVias(const std::vector< VIA_LOCATION > &aVias) const
size_t layerStackupBase() const
Base of section 69's layer records after its fixed controller lead-in.
void parsePlacementFields(const SDB_SECTION &aText, size_t aRecordBase, size_t aRecordSize, size_t aRingRotation)
std::vector< VIA_LOCATION > decodeViaLocations()
std::map< uint32_t, size_t > parseRouteJunctionNets() const
std::vector< PART > m_parts
std::map< uint32_t, size_t > m_sec23RecordToNet
std::vector< NET_ANCHOR > m_netAnchors
std::map< size_t, uint8_t > m_partDecalAlternate
std::map< std::string, uint32_t > m_netClassOwner
std::vector< COPPER_SHAPE > m_copper_shapes
const std::vector< POUR > & GetPours() const
void applyPadstackPairs(PART_DECAL &aDecal, const std::vector< std::pair< int32_t, int32_t > > &aPairs, int32_t aStart, int32_t aCount)
static constexpr int32_t ANGLE_SCALE
std::vector< POUR > m_pours
static bool IsBinaryPadsFile(const wxString &aFileName)
Check if a file appears to be a PADS binary PCB file.
std::map< std::string, PART_DECAL > m_decals
std::vector< DIFF_PAIR_DEF > m_diffPairs
std::set< std::string > GetPadStackShapesForTest() const
std::map< std::string, int32_t > m_decalTerminalStart
std::vector< POLYLINE > m_boardOutlines
void parseFreeText(const SDB_SECTION &aText, size_t aRecordBase, size_t aRecordSize, size_t aRingRotation, size_t aPoolBase, size_t aPoolHi)
bool GetOwnerLoopForTest(const std::string &aName, std::vector< VECTOR2I > &aOut) const
bool fetchOwnerCirclePoints(const std::string &aName, VECTOR2I &aP0, VECTOR2I &aP1) const
std::vector< size_t > oldNetRecordOffsets() const
std::map< std::string, int32_t > m_decalStackStart
std::vector< KEEPOUT > m_keepouts
std::map< std::string, int32_t > m_decalStackCount
uint32_t ringU32(const SDB_SECTION &aSection, size_t aRotation, size_t aStride, uint32_t aIndex, size_t aField) const
std::map< size_t, uint32_t > m_partTypeIndex
std::map< uint32_t, size_t > m_placementObjectToPart
std::vector< std::pair< int, int > > m_padStackDrillSpans
const SDB_SECTION * getSection(int aIndex) const
const std::vector< TEXT > & GetTexts() const
const PARAMETERS & GetParameters() const
std::vector< DIMENSION > m_dimensions
std::vector< LAYER_INFO > m_layerInfos
void Parse(const wxString &aFileName)
int32_t ringI32(const SDB_SECTION &aSection, size_t aRotation, size_t aStride, uint32_t aIndex, size_t aField) const
const std::vector< PART > & GetParts() const
double toBasicCoordX(int32_t aRawValue) const
std::vector< std::vector< int32_t > > m_partTypeDecalIndices
void applyNetClassClearances(const std::vector< NET_CLASS_RULE_EDGE > &aEdges, const std::map< uint32_t, size_t > &aOwnerOrdinal)
bool fetchOwnerLoop(const std::string &aName, size_t aMaxVerts, std::vector< VECTOR2I > &aOut) const
const std::vector< BIN_NET_CLASS_DEF > & GetNetClasses() const
PART makePlacementPart(const SDB_RECORD &aRec, int aXOff, std::optional< int > aYOff, int aAngleOff, int aNameOff, const std::string &aRefDes) const
bool sec12Vertex(int32_t aRow, int32_t &aX, int32_t &aY, int32_t &aAttr) const
const std::vector< uint8_t > & m_data
std::vector< std::string > m_partTypeNames
std::map< uint32_t, std::string > m_sec23IndexToNet
std::vector< NET_ANCHOR > m_netConnectionEndpoints
const std::vector< GRAPHIC_LINE > & GetGraphicLines() const
const std::vector< NET > & GetNets() const
std::vector< std::vector< PAD_STACK_LAYER > > m_padStackPool
std::map< uint32_t, std::set< size_t > > m_junctionHandleNets
const std::map< size_t, int > & GetPartClusterIds() const
const std::vector< ROUTE > & GetRoutes() const
std::map< size_t, int32_t > m_partFieldStart
std::vector< ROUTE > m_routes
std::vector< TEXT > m_texts
const SDB_SECTION * getSection(SECTION aSection) const
std::vector< GRAPHIC_LINE > m_graphicLines
const std::vector< DIMENSION > & GetDimensions() const
std::vector< PART_CLUSTER > m_clusters
std::vector< BIN_NET_CLASS_DEF > m_netClasses
std::vector< std::string > m_decalNameTable
const std::vector< DIFF_PAIR_DEF > & GetDiffPairs() const
const std::vector< COPPER_SHAPE > & GetCopperShapes() const
double toBasicAngle(int32_t aRawAngle) const
std::vector< LAYER_INFO > GetLayerInfos() const
BINARY_PARSER & operator=(const BINARY_PARSER &)=delete
const std::vector< KEEPOUT > & GetKeepouts() const
std::map< std::string, OWNER_RUN > m_ownerRuns
SDB_RECORD arcRecordFor(const SDB_SECTION &aArcParameters, int32_t aArcStart, int32_t aAttr, const char *aWhat) const
The parsed container of a PADS .pcb file: header, the section directory, and the coordinate system.
Definition pads_sdb.h:111
A bounds-checked reader positioned at one record inside a buffer.
SECTION
Named section indices into the PADS binary section directory.
One board-outline vertex triplet: [i32 X, i32 Y, i32 attr] where attr -1 is a plain corner and attr >...
Every routed-copper object's PADS layer and route-node handle, indexed by object ordinal,...
std::map< uint32_t, std::set< size_t > > handleNets
One placed via recovered from the section-60 junction ring.
A PADS net class recovered from the binary design-rule graph.
std::vector< std::string > nets
One type-66 net-class rule edge: its owner pointer, rule-detail page, full rule pointer (declaration ...
A PADS part cluster (named group of parts).
The PADS PowerPCB .pcb file is a serialized snapshot of PADS' in-memory SDB (System DataBase) object ...
Definition pads_sdb.h:58
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683