KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DIPTRACE::PCB_PARSER Class Reference

Parses a DipTrace .dip binary board file and populates a KiCad BOARD. More...

#include <diptrace_pcb_parser.h>

Public Member Functions

 PCB_PARSER (const wxString &aFileName, BOARD *aBoard)
 Construct a parser for the given file.
 
 ~PCB_PARSER ()
 
void Parse ()
 Parse the file and populate the board. Throws IO_ERROR on failure.
 
int ScanLocatorUseCount () const
 Number of objects or sections that were located by byte-pattern scanning rather than a deterministic field-derived offset during the last Parse().
 
int ComponentLocatorScans () const
 
int PadLocatorScans () const
 
int ShapeLocatorScans () const
 
int MountHoleLocatorScans () const
 
int SectionLocatorScans () const
 
wxString GenerateDesignRules () const
 Build a KiCad custom design-rule (.kicad_dru) document for the per-zone DipTrace properties that have no native KiCad zone equivalent.
 

Private Member Functions

void ParseMagic ()
 
void ParseBoardProperties ()
 
void ParseOutline ()
 
void ParsePostOutline ()
 
void ParseLayers ()
 
void ParseFontStyle ()
 
void ParsePatternNameGroups (int aGroupCount)
 
void ParsePatternStyleGroups (int aGroupCount)
 
void ParseImplicitPatternStyleGroup ()
 
void ParseDesignRules ()
 
void FindAndParseComponents ()
 
void ApplyPlacementAngles ()
 Refine component placement angles with the exact values from the placement section.
 
void ParsePostComponentSections ()
 
std::vector< std::pair< size_t, size_t > > FieldWalkComponentBoundaries (size_t aUpperBound)
 Deterministically walk the component boundaries from the design-rules end, anchoring on each component's 37-byte tail (followed by a boundary core) instead of scanning the whole region for boundary patterns.
 
bool ParseSingleComponent (size_t aBoundaryOffset, size_t aUpperBound, DT_COMPONENT &aComp)
 
void FindPadsInRegion (DT_COMPONENT &aComp, size_t aRegionStart, size_t aRegionEnd)
 Search a component's data region for pad records using pad name anchors.
 
void FindMountHolesInRegion (DT_COMPONENT &aComp, size_t aRegionStart, size_t aRegionEnd)
 Parse component-local mechanical holes (NPTH) from the post-pad region.
 
void FindShapesInRegion (DT_COMPONENT &aComp, size_t aRegionStart, size_t aRegionEnd)
 Parse footprint outline shapes from the region after pad data.
 
void FindShapesInFontBlocks (DT_COMPONENT &aComp, size_t aRegionStart, size_t aRegionEnd)
 Parse shapes from per-layer font blocks (v46+ format).
 
void FindShapesInChainedBlocks (DT_COMPONENT &aComp, size_t aRegionStart, size_t aRegionEnd)
 Parse shapes from chained fixed-size records used by some v46+ footprints.
 
void ParseComponentTail (DT_COMPONENT &aComp, size_t aRegionEnd)
 Parse the 37-byte tail at the end of a component region to extract text positioning.
 
void FindAndParseNets (size_t aSearchStart, size_t aSearchEnd)
 
void ParseNetRouting (DT_NET &aNet)
 
void InferPadNetsFromRoutingRefs ()
 
void FindAndParseZones (size_t aSearchStart, size_t aSearchEnd)
 
void ApplyBoardSettings ()
 
void CreateBoardOutline ()
 
void CreateFootprint (const DT_COMPONENT &aComp)
 
void CreateStandaloneVias ()
 
void CreateTextObject (const DT_TEXT_OBJECT &aText)
 
void CreateNets ()
 
void CreateTracksAndVias ()
 
void CreateZones ()
 
void CreatePlaneZones ()
 Synthesize board-outline-bounded plane fills for negative/solid-plane copper layers.
 
NETINFO_ITEMResolveNetByIndex (int aDipTraceNetIndex) const
 Resolve a DipTrace net index to the corresponding KiCad net object.
 
const DT_NETResolveDipTraceNetByIndex (int aDipTraceNetIndex) const
 
void FindAndParseTextObjects (size_t aSearchStart, size_t aSearchEnd)
 
void ParseTextRecords (int aCount)
 
PCB_LAYER_ID MapLayer (int aDipTraceLayer) const
 Map a DipTrace layer index to a KiCad PCB_LAYER_ID.
 
PCB_LAYER_ID MapCopperLayer (int aDipTraceLayer) const
 
void SkipInterRulesetTransition ()
 Read an inter-ruleset transition block.
 

Static Private Member Functions

static bool ClassifyStandaloneVia (const DT_COMPONENT &aComp)
 Decide whether a parsed component is a standalone via rather than a placed footprint.
 
static int ToKiCadCoord (int aDipTraceCoord)
 Convert a DipTrace coordinate (DipTrace units) to KiCad internal units (nm).
 
static double ToKiCadAngleDeg (int aDipTraceAngle)
 Convert a DipTrace angle value to degrees (tenths of degree).
 
static bool TryReadStringAt (const uint8_t *aData, size_t aDataSize, size_t aPos, int aVersion, wxString &aOut, size_t &aNewPos)
 Try to read a string at a given raw data position.
 
static std::vector< size_t > FindAllBoundaries (const uint8_t *aData, size_t aDataSize, const uint8_t *aPattern, size_t aPatternLen, size_t aStart, size_t aEnd)
 Find all occurrences of a byte pattern within data[start:end].
 

Private Attributes

BINARY_READER m_reader
 
BOARDm_board
 
int m_version
 
bool m_hasInlineVersion
 
bool m_hasLegacyMagicLayout
 
std::vector< DT_VERTEXm_outline
 
std::vector< DT_LAYERm_layers
 
std::vector< DT_VIA_STYLEm_viaStyles
 
std::vector< DT_DESIGN_RULEm_designRules
 
std::vector< DT_COMPONENTm_components
 
std::vector< DT_TEXT_OBJECTm_textObjects
 
std::vector< DT_NETm_nets
 
std::vector< DT_TRACK_CHAINm_trackChains
 
std::vector< DT_ZONEm_zones
 
std::unordered_map< int, int > m_copperLayerOrdinalById
 
std::unordered_map< int, std::vector< VECTOR2I > > m_routingAnchorsByNet
 
bool m_routingAnchorCacheBuilt = false
 
std::unordered_map< int, NETINFO_ITEM * > m_kicadNetByDipTraceIndex
 
std::unordered_map< int, const DT_NET * > m_dipTraceNetByIndex
 
int m_bboxXMin = 0
 
int m_bboxYMin = 0
 
int m_bboxXMax = 0
 
int m_bboxYMax = 0
 
int m_ruleNameCount = 0
 
size_t m_postLayersOffset = 0
 
size_t m_postDesignRulesOffset = 0
 
size_t m_componentUpperBound = 0
 
int m_componentLocatorScans = 0
 
int m_padLocatorScans = 0
 
int m_shapeLocatorScans = 0
 
int m_mountHoleLocatorScans = 0
 
int m_sectionLocatorScans = 0
 

Detailed Description

Parses a DipTrace .dip binary board file and populates a KiCad BOARD.

Definition at line 295 of file diptrace_pcb_parser.h.

Constructor & Destructor Documentation

◆ PCB_PARSER()

PCB_PARSER::PCB_PARSER ( const wxString & aFileName,
BOARD * aBoard )

Construct a parser for the given file.

Parameters
aFileNamepath to the .dip file
aBoardtarget BOARD to populate (must not be null)

Definition at line 932 of file diptrace_pcb_parser.cpp.

References m_board, m_hasInlineVersion, m_hasLegacyMagicLayout, m_reader, and m_version.

◆ ~PCB_PARSER()

PCB_PARSER::~PCB_PARSER ( )

Definition at line 942 of file diptrace_pcb_parser.cpp.

Member Function Documentation

◆ ApplyBoardSettings()

◆ ApplyPlacementAngles()

void PCB_PARSER::ApplyPlacementAngles ( )
private

Refine component placement angles with the exact values from the placement section.

The per-component metadata block yields only a 90-degree-snapped quarter-turn count. A separate placement section stores the exact placement angle (radians, fixed-point) for every component, but the section has no per-entry key that maps cleanly back to a geometry record. When the section's angle list lines up with the parsed components – same count and every angle snapping to the component's own quarter-turn – the exact angles are adopted; otherwise the snapped quarter turns are kept.

Definition at line 1927 of file diptrace_pcb_parser.cpp.

References comp, m_components, M_PI, m_reader, ReadInt4At(), and traceDiptraceIo.

Referenced by Parse().

◆ ClassifyStandaloneVia()

bool PCB_PARSER::ClassifyStandaloneVia ( const DT_COMPONENT & aComp)
staticprivate

Decide whether a parsed component is a standalone via rather than a placed footprint.

Definition at line 2044 of file diptrace_pcb_parser.cpp.

References DIPTRACE::DT_COMPONENT::displayName, DIPTRACE::DT_COMPONENT::libraryPath, and DIPTRACE::DT_COMPONENT::patternName.

Referenced by FindAndParseComponents().

◆ ComponentLocatorScans()

int DIPTRACE::PCB_PARSER::ComponentLocatorScans ( ) const
inline

Definition at line 322 of file diptrace_pcb_parser.h.

References m_componentLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ CreateBoardOutline()

◆ CreateFootprint()

void PCB_PARSER::CreateFootprint ( const DT_COMPONENT & aComp)
private

Definition at line 5026 of file diptrace_pcb_parser.cpp.

References std::abs(), FOOTPRINT::Add(), PADSTACK::ALL_LAYERS, APPEND, ARC, DIPTRACE::DT_COMPONENT::bboxHeight, DIPTRACE::DT_COMPONENT::bboxWidth, center, chain, CIRCLE, CUSTOM, DEGREES_T, DIPTRACE::DT_MOUNT_HOLE::drillDiameter, DIPTRACE::DT_PAD::drillHeight, DIPTRACE::DT_PAD::drillWidth, DT_FP_LAYER_TOP_ASSY, DT_FP_LAYER_TOP_COURTYARD, DT_FP_LAYER_TOP_KEEPOUT, DT_FP_LAYER_TOP_MASK, DT_FP_LAYER_TOP_OUTLINE, DT_FP_LAYER_TOP_PASTE, DT_FP_LAYER_TOP_SILK, DIPTRACE::DT_SHAPE_ARC, DIPTRACE::DT_SHAPE_CIRCLE, DIPTRACE::DT_SHAPE_FILLOBROUND, DIPTRACE::DT_SHAPE_LINE, DIPTRACE::DT_SHAPE_RECT, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, FOOTPRINT::Flip(), FOOTPRINT, FP_SHAPE_DEFAULT_WIDTH, FP_SHAPE_NORM_RANGE, FOOTPRINT::GetPosition(), DIPTRACE::DT_COMPONENT::hasPlacementAngle, DIPTRACE::DT_COMPONENT::hasPlacementQuarterTurns, DIPTRACE::DT_COMPONENT::hasTailData, DIPTRACE::DT_PAD::height, DIPTRACE::DT_COMPONENT::holes, DIPTRACE::DT_COMPONENT::isStandaloneVia, DIPTRACE::DT_COMPONENT::layer, DIPTRACE::DT_FP_SHAPE::layer, m_board, m_routingAnchorCacheBuilt, m_routingAnchorsByNet, m_trackChains, DIPTRACE::DT_FP_SHAPE::midX, DIPTRACE::DT_FP_SHAPE::midY, DIPTRACE::DT_PAD::mountType, DIPTRACE::DT_PAD::netIndex, NPTH, DIPTRACE::DT_PAD::number, OBLONG, DIPTRACE::DT_PAD::orientClass, DIPTRACE::DT_MOUNT_HOLE::outerDiameter, OVAL, PAD, pad, DIPTRACE::DT_COMPONENT::pads, DIPTRACE::DT_COMPONENT::patternName, DIPTRACE::DT_COMPONENT::placementAngleDeg, DIPTRACE::DT_COMPONENT::placementQuarterTurns, DIPTRACE::DT_PAD::polygonVertices, DIPTRACE::DT_COMPONENT::positionX, DIPTRACE::DT_COMPONENT::positionY, PTH, PAD::PTHMask(), radius, RECTANGLE, DIPTRACE::DT_COMPONENT::refdes, DIPTRACE::DT_COMPONENT::refdesVisible, DIPTRACE::DT_COMPONENT::refdesYOffset, FOOTPRINT::Reference(), ResolveNetByIndex(), DIPTRACE::DT_COMPONENT::rotation, SEGMENT, EDA_SHAPE::SetArcGeometry(), PAD::SetAttribute(), EDA_SHAPE::SetCenter(), PAD::SetDrillShape(), PAD::SetDrillSize(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), FOOTPRINT::SetFPID(), PCB_SHAPE::SetLayer(), PAD::SetLayerSet(), LIB_ID::SetLibItemName(), PAD::SetNumber(), FOOTPRINT::SetOrientation(), FOOTPRINT::SetPosition(), PAD::SetPosition(), PCB_TEXT::SetPosition(), FOOTPRINT::SetReference(), EDA_SHAPE::SetShape(), PAD::SetShape(), PAD::SetSize(), EDA_SHAPE::SetStart(), FOOTPRINT::SetValue(), EDA_TEXT::SetVisible(), EDA_SHAPE::SetWidth(), DIPTRACE::DT_COMPONENT::shapes, ShouldDumpFootprintOrientation(), SMD, PAD::SMDMask(), DIPTRACE::DT_PAD::style, ToKiCadAngleDeg(), ToKiCadCoord(), TOP_BOTTOM, traceDiptraceIo, DIPTRACE::DT_FP_SHAPE::type, PAD::UnplatedHoleMask(), FOOTPRINT::Value(), DIPTRACE::DT_COMPONENT::value, DIPTRACE::DT_COMPONENT::valueVisible, DIPTRACE::DT_COMPONENT::valueYOffset, DIPTRACE::DT_FP_SHAPE::width, DIPTRACE::DT_PAD::width, DIPTRACE::DT_MOUNT_HOLE::x, DIPTRACE::DT_PAD::x, DIPTRACE::DT_TRACK_NODE::x, VECTOR2< T >::x, DIPTRACE::DT_FP_SHAPE::x1, DIPTRACE::DT_FP_SHAPE::x2, DIPTRACE::DT_MOUNT_HOLE::y, DIPTRACE::DT_PAD::y, DIPTRACE::DT_TRACK_NODE::y, VECTOR2< T >::y, DIPTRACE::DT_FP_SHAPE::y1, and DIPTRACE::DT_FP_SHAPE::y2.

Referenced by Parse().

◆ CreateNets()

void PCB_PARSER::CreateNets ( )
private

◆ CreatePlaneZones()

◆ CreateStandaloneVias()

void PCB_PARSER::CreateStandaloneVias ( )
private

◆ CreateTextObject()

◆ CreateTracksAndVias()

◆ CreateZones()

◆ FieldWalkComponentBoundaries()

std::vector< std::pair< size_t, size_t > > PCB_PARSER::FieldWalkComponentBoundaries ( size_t aUpperBound)
private

Deterministically walk the component boundaries from the design-rules end, anchoring on each component's 37-byte tail (followed by a boundary core) instead of scanning the whole region for boundary patterns.

Returns (boundaryOffset, stringStart) per component, or an empty vector when the walk cannot be trusted (the caller then falls back to the scan).

Definition at line 1564 of file diptrace_pcb_parser.cpp.

References BOUNDARY_ALT, BOUNDARY_CORE_LEN, BOUNDARY_STD, m_postDesignRulesOffset, m_postLayersOffset, m_reader, m_version, next(), ReadInt3At(), and TryReadStringAt().

Referenced by FindAndParseComponents().

◆ FindAllBoundaries()

std::vector< size_t > PCB_PARSER::FindAllBoundaries ( const uint8_t * aData,
size_t aDataSize,
const uint8_t * aPattern,
size_t aPatternLen,
size_t aStart,
size_t aEnd )
staticprivate

Find all occurrences of a byte pattern within data[start:end].

Definition at line 900 of file diptrace_pcb_parser.cpp.

Referenced by FindAndParseComponents(), FindAndParseNets(), FindPadsInRegion(), and FindShapesInFontBlocks().

◆ FindAndParseComponents()

◆ FindAndParseNets()

◆ FindAndParseTextObjects()

void PCB_PARSER::FindAndParseTextObjects ( size_t aSearchStart,
size_t aSearchEnd )
private

◆ FindAndParseZones()

void PCB_PARSER::FindAndParseZones ( size_t aSearchStart,
size_t aSearchEnd )
private

Definition at line 3976 of file diptrace_pcb_parser.cpp.

References _, DIPTRACE::DT_ZONE::boardClearance, DIPTRACE::DT_ZONE::cachedFillByteLen, DIPTRACE::DT_ZONE::cachedFillRecordCount, DIPTRACE::DT_ZONE::cachedFillRecords, clearance, DIPTRACE::DT_ZONE::clearance, DIPTRACE::DT_ZONE::connectionMode, DumpZoneGap(), DumpZoneHeader(), DumpZoneTail(), DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field0, DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field1, DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field2, DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field3, DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field4, DIPTRACE::DT_ZONE_CACHED_FILL_RECORD::field5, DIPTRACE::DT_ZONE::fillMode, DIPTRACE::INT4_BIAS, DIPTRACE::DT_ZONE::islandConnection, DIPTRACE::DT_ZONE::islandInternal, DIPTRACE::DT_ZONE::islandRegion, kv, DIPTRACE::DT_ZONE::layer, DIPTRACE::LEGACY_STRING_VERSION, DIPTRACE::DT_ZONE::lineSpacing, m_bboxXMax, m_bboxXMin, m_bboxYMax, m_bboxYMin, m_nets, m_outline, m_reader, m_sectionLocatorScans, m_version, m_zones, DIPTRACE::DT_ZONE::minimumArea, DIPTRACE::DT_ZONE::minWidth, DIPTRACE::DT_ZONE::netIndex, NOT_FOUND, DIPTRACE::DT_ZONE::outline, DIPTRACE::DT_ZONE::ratlineMode, DIPTRACE::DT_ZONE::rawFlag2, ReadInt3At(), ReadInt4At(), DIPTRACE::DT_ZONE::regionsCounted, DIPTRACE::DT_ZONE::regionsDone, DIPTRACE::DT_ZONE::separator, ShouldDumpZones(), DIPTRACE::DT_ZONE::smdSeparate, DIPTRACE::DT_ZONE::smdSpokeMode, DIPTRACE::DT_ZONE::smdSpokeWidth, DIPTRACE::DT_ZONE::spokeMode, DIPTRACE::DT_ZONE::spokeWidth, THROW_IO_ERROR, traceDiptraceIo, DIPTRACE::DT_ZONE::viaDirect, ZONE_FONT_PREAMBLE_TAIL, and DIPTRACE::DT_ZONE::zoneId.

Referenced by ParsePostComponentSections().

◆ FindMountHolesInRegion()

◆ FindPadsInRegion()

◆ FindShapesInChainedBlocks()

◆ FindShapesInFontBlocks()

◆ FindShapesInRegion()

◆ GenerateDesignRules()

wxString PCB_PARSER::GenerateDesignRules ( ) const

Build a KiCad custom design-rule (.kicad_dru) document for the per-zone DipTrace properties that have no native KiCad zone equivalent.

Covers zone-to-board-edge clearance (BoardClearance) and direct via connections (ViaDirect). Returns an empty string when no such rules apply. Must be called after Parse().

Definition at line 6212 of file diptrace_pcb_parser.cpp.

References FormatDouble2Str(), m_zones, pcbIUScale, ResolveNetByIndex(), and ToKiCadCoord().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_IO_DIPTRACE::LoadBoard().

◆ InferPadNetsFromRoutingRefs()

void PCB_PARSER::InferPadNetsFromRoutingRefs ( )
private

◆ MapCopperLayer()

PCB_LAYER_ID PCB_PARSER::MapCopperLayer ( int aDipTraceLayer) const
private

◆ MapLayer()

PCB_LAYER_ID PCB_PARSER::MapLayer ( int aDipTraceLayer) const
private

Map a DipTrace layer index to a KiCad PCB_LAYER_ID.

Definition at line 1071 of file diptrace_pcb_parser.cpp.

References B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Dwgs_User, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In1_Cu, and UNDEFINED_LAYER.

Referenced by ApplyBoardSettings(), CreateTextObject(), CreateTracksAndVias(), and CreateZones().

◆ MountHoleLocatorScans()

int DIPTRACE::PCB_PARSER::MountHoleLocatorScans ( ) const
inline

Definition at line 325 of file diptrace_pcb_parser.h.

References m_mountHoleLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ PadLocatorScans()

int DIPTRACE::PCB_PARSER::PadLocatorScans ( ) const
inline

Definition at line 323 of file diptrace_pcb_parser.h.

References m_padLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ Parse()

◆ ParseBoardProperties()

void PCB_PARSER::ParseBoardProperties ( )
private

◆ ParseComponentTail()

◆ ParseDesignRules()

◆ ParseFontStyle()

◆ ParseImplicitPatternStyleGroup()

void PCB_PARSER::ParseImplicitPatternStyleGroup ( )
private

Definition at line 1414 of file diptrace_pcb_parser.cpp.

References _, m_reader, m_ruleNameCount, and THROW_IO_ERROR.

Referenced by ParseFontStyle().

◆ ParseLayers()

◆ ParseMagic()

void PCB_PARSER::ParseMagic ( )
private

Definition at line 1144 of file diptrace_pcb_parser.cpp.

References _, m_hasInlineVersion, m_hasLegacyMagicLayout, m_reader, m_version, and THROW_IO_ERROR.

Referenced by Parse().

◆ ParseNetRouting()

◆ ParseOutline()

void PCB_PARSER::ParseOutline ( )
private

◆ ParsePatternNameGroups()

void PCB_PARSER::ParsePatternNameGroups ( int aGroupCount)
private

Definition at line 1349 of file diptrace_pcb_parser.cpp.

References _, m_reader, and THROW_IO_ERROR.

Referenced by ParseFontStyle().

◆ ParsePatternStyleGroups()

void PCB_PARSER::ParsePatternStyleGroups ( int aGroupCount)
private

Definition at line 1379 of file diptrace_pcb_parser.cpp.

References _, m_reader, m_ruleNameCount, and THROW_IO_ERROR.

Referenced by ParseFontStyle().

◆ ParsePostComponentSections()

void PCB_PARSER::ParsePostComponentSections ( )
private

◆ ParsePostOutline()

void PCB_PARSER::ParsePostOutline ( )
private

Definition at line 1237 of file diptrace_pcb_parser.cpp.

References m_reader.

Referenced by Parse().

◆ ParseSingleComponent()

◆ ParseTextRecords()

void PCB_PARSER::ParseTextRecords ( int aCount)
private

◆ ResolveDipTraceNetByIndex()

const DT_NET * PCB_PARSER::ResolveDipTraceNetByIndex ( int aDipTraceNetIndex) const
private

Definition at line 5498 of file diptrace_pcb_parser.cpp.

References m_dipTraceNetByIndex.

Referenced by CreateTracksAndVias().

◆ ResolveNetByIndex()

NETINFO_ITEM * PCB_PARSER::ResolveNetByIndex ( int aDipTraceNetIndex) const
private

Resolve a DipTrace net index to the corresponding KiCad net object.

Definition at line 5484 of file diptrace_pcb_parser.cpp.

References m_kicadNetByDipTraceIndex.

Referenced by CreateFootprint(), CreatePlaneZones(), CreateStandaloneVias(), CreateTracksAndVias(), CreateZones(), and GenerateDesignRules().

◆ ScanLocatorUseCount()

int DIPTRACE::PCB_PARSER::ScanLocatorUseCount ( ) const
inline

Number of objects or sections that were located by byte-pattern scanning rather than a deterministic field-derived offset during the last Parse().

Zero means the decode was fully deterministic; the remaining pattern scanners act only as recovery fallbacks. Mirrors the schematic importer's ComponentBoundaryScanCount() invariant.

Definition at line 316 of file diptrace_pcb_parser.h.

References m_componentLocatorScans, m_mountHoleLocatorScans, m_padLocatorScans, m_sectionLocatorScans, and m_shapeLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ SectionLocatorScans()

int DIPTRACE::PCB_PARSER::SectionLocatorScans ( ) const
inline

Definition at line 326 of file diptrace_pcb_parser.h.

References m_sectionLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ ShapeLocatorScans()

int DIPTRACE::PCB_PARSER::ShapeLocatorScans ( ) const
inline

Definition at line 324 of file diptrace_pcb_parser.h.

References m_shapeLocatorScans.

Referenced by BOOST_AUTO_TEST_CASE().

◆ SkipInterRulesetTransition()

void PCB_PARSER::SkipInterRulesetTransition ( )
private

Read an inter-ruleset transition block.

Definition at line 1527 of file diptrace_pcb_parser.cpp.

References _, actual, DIPTRACE::LEGACY_STRING_VERSION, m_reader, m_version, next(), and THROW_IO_ERROR.

Referenced by ParseDesignRules().

◆ ToKiCadAngleDeg()

double PCB_PARSER::ToKiCadAngleDeg ( int aDipTraceAngle)
staticprivate

Convert a DipTrace angle value to degrees (tenths of degree).

Definition at line 1134 of file diptrace_pcb_parser.cpp.

References DIPTRACE::DIPTRACE_ANGLE_TO_DEG.

Referenced by CreateFootprint().

◆ ToKiCadCoord()

int PCB_PARSER::ToKiCadCoord ( int aDipTraceCoord)
staticprivate

Convert a DipTrace coordinate (DipTrace units) to KiCad internal units (nm).

Definition at line 1128 of file diptrace_pcb_parser.cpp.

Referenced by ApplyBoardSettings(), CreateBoardOutline(), CreateFootprint(), CreatePlaneZones(), CreateStandaloneVias(), CreateTextObject(), CreateTracksAndVias(), CreateZones(), and GenerateDesignRules().

◆ TryReadStringAt()

bool PCB_PARSER::TryReadStringAt ( const uint8_t * aData,
size_t aDataSize,
size_t aPos,
int aVersion,
wxString & aOut,
size_t & aNewPos )
staticprivate

Try to read a string at a given raw data position.

Definition at line 818 of file diptrace_pcb_parser.cpp.

References DIPTRACE::INT3_BIAS, DIPTRACE::LEGACY_STRING_VERSION, and result.

Referenced by FieldWalkComponentBoundaries(), FindAndParseComponents(), and FindPadsInRegion().

Member Data Documentation

◆ m_bboxXMax

int DIPTRACE::PCB_PARSER::m_bboxXMax = 0
private

◆ m_bboxXMin

int DIPTRACE::PCB_PARSER::m_bboxXMin = 0
private

◆ m_bboxYMax

int DIPTRACE::PCB_PARSER::m_bboxYMax = 0
private

◆ m_bboxYMin

int DIPTRACE::PCB_PARSER::m_bboxYMin = 0
private

◆ m_board

◆ m_componentLocatorScans

int DIPTRACE::PCB_PARSER::m_componentLocatorScans = 0
private

◆ m_components

std::vector<DT_COMPONENT> DIPTRACE::PCB_PARSER::m_components
private

◆ m_componentUpperBound

size_t DIPTRACE::PCB_PARSER::m_componentUpperBound = 0
private

Definition at line 486 of file diptrace_pcb_parser.h.

Referenced by FindAndParseComponents(), and ParsePostComponentSections().

◆ m_copperLayerOrdinalById

std::unordered_map<int, int> DIPTRACE::PCB_PARSER::m_copperLayerOrdinalById
private

Definition at line 468 of file diptrace_pcb_parser.h.

Referenced by MapCopperLayer(), and ParseLayers().

◆ m_designRules

std::vector<DT_DESIGN_RULE> DIPTRACE::PCB_PARSER::m_designRules
private

Definition at line 462 of file diptrace_pcb_parser.h.

Referenced by ApplyBoardSettings(), and ParseDesignRules().

◆ m_dipTraceNetByIndex

std::unordered_map<int, const DT_NET*> DIPTRACE::PCB_PARSER::m_dipTraceNetByIndex
private

Definition at line 474 of file diptrace_pcb_parser.h.

Referenced by CreateNets(), and ResolveDipTraceNetByIndex().

◆ m_hasInlineVersion

bool DIPTRACE::PCB_PARSER::m_hasInlineVersion
private

Definition at line 455 of file diptrace_pcb_parser.h.

Referenced by ParseBoardProperties(), ParseMagic(), and PCB_PARSER().

◆ m_hasLegacyMagicLayout

bool DIPTRACE::PCB_PARSER::m_hasLegacyMagicLayout
private

Definition at line 456 of file diptrace_pcb_parser.h.

Referenced by ParseFontStyle(), ParseMagic(), and PCB_PARSER().

◆ m_kicadNetByDipTraceIndex

std::unordered_map<int, NETINFO_ITEM*> DIPTRACE::PCB_PARSER::m_kicadNetByDipTraceIndex
private

Definition at line 473 of file diptrace_pcb_parser.h.

Referenced by CreateNets(), CreateZones(), and ResolveNetByIndex().

◆ m_layers

std::vector<DT_LAYER> DIPTRACE::PCB_PARSER::m_layers
private

◆ m_mountHoleLocatorScans

int DIPTRACE::PCB_PARSER::m_mountHoleLocatorScans = 0
private

Definition at line 495 of file diptrace_pcb_parser.h.

Referenced by MountHoleLocatorScans(), Parse(), and ScanLocatorUseCount().

◆ m_nets

std::vector<DT_NET> DIPTRACE::PCB_PARSER::m_nets
private

◆ m_outline

std::vector<DT_VERTEX> DIPTRACE::PCB_PARSER::m_outline
private

◆ m_padLocatorScans

int DIPTRACE::PCB_PARSER::m_padLocatorScans = 0
private

◆ m_postDesignRulesOffset

size_t DIPTRACE::PCB_PARSER::m_postDesignRulesOffset = 0
private

◆ m_postLayersOffset

size_t DIPTRACE::PCB_PARSER::m_postLayersOffset = 0
private

◆ m_reader

◆ m_routingAnchorCacheBuilt

bool DIPTRACE::PCB_PARSER::m_routingAnchorCacheBuilt = false
private

Definition at line 470 of file diptrace_pcb_parser.h.

Referenced by CreateFootprint(), and FindAndParseNets().

◆ m_routingAnchorsByNet

std::unordered_map<int, std::vector<VECTOR2I> > DIPTRACE::PCB_PARSER::m_routingAnchorsByNet
private

Definition at line 469 of file diptrace_pcb_parser.h.

Referenced by CreateFootprint(), and FindAndParseNets().

◆ m_ruleNameCount

int DIPTRACE::PCB_PARSER::m_ruleNameCount = 0
private

◆ m_sectionLocatorScans

int DIPTRACE::PCB_PARSER::m_sectionLocatorScans = 0
private

◆ m_shapeLocatorScans

int DIPTRACE::PCB_PARSER::m_shapeLocatorScans = 0
private

◆ m_textObjects

std::vector<DT_TEXT_OBJECT> DIPTRACE::PCB_PARSER::m_textObjects
private

Definition at line 464 of file diptrace_pcb_parser.h.

Referenced by Parse(), and ParseTextRecords().

◆ m_trackChains

std::vector<DT_TRACK_CHAIN> DIPTRACE::PCB_PARSER::m_trackChains
private

◆ m_version

◆ m_viaStyles

std::vector<DT_VIA_STYLE> DIPTRACE::PCB_PARSER::m_viaStyles
private

◆ m_zones

std::vector<DT_ZONE> DIPTRACE::PCB_PARSER::m_zones
private

Definition at line 467 of file diptrace_pcb_parser.h.

Referenced by CreateZones(), FindAndParseZones(), GenerateDesignRules(), and Parse().


The documentation for this class was generated from the following files: