From ceefbea34ae442d91a8a3ee9e08e4bae001ba231 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Sun, 29 Dec 2024 02:43:36 +0300 Subject: [PATCH] Eagle: Make pad drill optional to support some DipTrace-exported boards. --- common/io/eagle/eagle_parser.cpp | 6 +++--- common/io/eagle/eagle_parser.h | 2 +- pcbnew/pcb_io/eagle/pcb_io_eagle.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/io/eagle/eagle_parser.cpp b/common/io/eagle/eagle_parser.cpp index feecf38dca..5810bc474e 100644 --- a/common/io/eagle/eagle_parser.cpp +++ b/common/io/eagle/eagle_parser.cpp @@ -1063,11 +1063,11 @@ EPAD::EPAD( wxXmlNode* aPad, IO_BASE* aIo ) : > */ - // #REQUIRED says DTD, throw exception if not found - drill = parseRequiredAttribute( aPad, "drill" ); + // #REQUIRED says DTD, but DipTrace doesn't write it sometimes + drill = parseOptionalAttribute( aPad, "drill" ); // Optional attributes - diameter = parseOptionalAttribute( aPad, "diameter" ); + diameter = parseOptionalAttribute( aPad, "diameter" ); opt_wxString s = parseOptionalAttribute( aPad, "shape" ); diff --git a/common/io/eagle/eagle_parser.h b/common/io/eagle/eagle_parser.h index 970a968f76..606eadbef5 100644 --- a/common/io/eagle/eagle_parser.h +++ b/common/io/eagle/eagle_parser.h @@ -1011,7 +1011,7 @@ struct EPAD : public EPAD_COMMON * first %Bool; "no" * > */ - ECOORD drill; + opt_ecoord drill; opt_ecoord diameter; // for shape: (square | round | octagon | long | offset) diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index 7ebafa5c85..967565ab9d 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp @@ -1958,7 +1958,7 @@ void PCB_IO_EAGLE::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) // this is thru hole technology here, no SMDs EPAD e( aTree ); int shape = EPAD::UNDEF; - int eagleDrillz = e.drill.ToPcbUnits(); + int eagleDrillz = e.drill ? e.drill->ToPcbUnits() : 0; std::unique_ptr pad = std::make_unique( aFootprint ); transferPad( e, pad.get() ); @@ -2049,7 +2049,7 @@ void PCB_IO_EAGLE::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) // Eagle spokes are always '+' pad->SetThermalSpokeAngle( ANGLE_0 ); - if( pad->GetSizeX() > 0 && pad->GetSizeY() > 0 ) + if( pad->GetSizeX() > 0 && pad->GetSizeY() > 0 && pad->HasHole() ) { aFootprint->Add( pad.release() ); }