From 345061097790c249e1b8d02877d5c44a355cbc5a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 9 Apr 2021 13:48:59 +0100 Subject: [PATCH] Add ability to allow thermal vias to be implemented as pads. This is mostly just for CADSTAR. Since we don't (yet) have general purpose footprint attributes, this reuses the "net tie" hack. Fixes https://gitlab.com/kicad/code/kicad/issues/8141 --- .../drc_test_provider_copper_clearance.cpp | 19 +++++++++++-------- pcbnew/footprint.h | 11 ++++++++++- .../cadstar/cadstar_pcb_archive_loader.cpp | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index f79737f050..630c9461b5 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -500,15 +500,18 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa bool testShorting = !m_drcEngine->IsErrorLimitExceeded( DRCE_SHORTING_ITEMS ); bool testHoles = !m_drcEngine->IsErrorLimitExceeded( DRCE_HOLE_CLEARANCE ); - FOOTPRINT* padParent = static_cast( pad->GetParent() ); - bool isNetTie = padParent->IsNetTie(); - - // Graphic items are allowed to act as net-ties within their own footprint - if( isNetTie - && ( other->Type() == PCB_FP_SHAPE_T || other->Type() == PCB_PAD_T ) - && other->GetParent() == padParent ) + // Disable some tests *within* a single footprint + if( other->GetParent() == pad->GetParent() ) { - testClearance = false; + FOOTPRINT* fp = static_cast( pad->GetParent() ); + + // Graphic items are allowed to act as net-ties within their own footprint + if( fp->IsNetTie() && ( other->Type() == PCB_FP_SHAPE_T || other->Type() == PCB_PAD_T ) ) + testClearance = false; + + // CADSTAR implements thermal vias using pads insteads of vias + if( fp->AllowThermalPads() && other->Type() == PCB_PAD_T ) + testHoles = false; } if( pad->GetAttribute() == PAD_ATTRIB_NPTH && !pad->FlashLayer( layer ) ) diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 09f2a0bf63..3414b008fe 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -236,7 +236,16 @@ public: int GetFlag() const { return m_arflag; } // A bit of a hack until net ties are supported as first class citizens - bool IsNetTie() const { return GetKeywords().StartsWith( wxT( "net tie" ) ); } + bool IsNetTie() const + { + return GetKeywords().StartsWith( wxT( "net tie" ) ); + } + + // Might as well keep all the hacks in the same place.... + bool AllowThermalPads() const + { + return GetKeywords().StartsWith( wxT( "allow thermal pads" ) ); + } void Move( const wxPoint& aMoveVector ) override; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 1282448a8b..1e8cd07d9d 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -655,6 +655,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary() wxT( "" ) ); FOOTPRINT* footprint = new FOOTPRINT( m_board ); footprint->SetPosition( getKiCadPoint( component.Origin ) ); + footprint->SetKeywords( wxT( "allow thermal pads" ) ); LIB_ID libID; libID.Parse( fpName, true );