diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index d4746b9669..fa733c9cd8 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -741,6 +741,32 @@ int PAD::GetLocalClearance( wxString* aSource ) const } +int PAD::GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource ) const +{ + DRC_CONSTRAINT c; + + if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine ) + { + BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings(); + + if( GetAttribute() == PAD_ATTRIB::NPTH ) + c = bds.m_DRCEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, this, nullptr, aLayer ); + else + c = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer ); + } + + if( c.Value().HasMin() ) + { + if( aSource ) + *aSource = c.GetName(); + + return c.Value().Min(); + } + + return 0; +} + + int PAD::GetSolderMaskMargin() const { // The pad inherits the margin only to calculate a default shape, diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 1669004436..1634edbe0c 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -390,6 +390,8 @@ public: int GetLocalClearance() const { return m_localClearance; } void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; } + int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const override; + int GetLocalSolderPasteMargin() const { return m_localSolderPasteMargin; } void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 8bce3e2b2f..2bbb2f40a9 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1317,6 +1317,9 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) if( flashActiveLayer || aPad->GetDrillSize().x ) { + if( aPad->GetAttribute() == PAD_ATTRIB::NPTH ) + color = m_pcbSettings.GetLayerColor( LAYER_NON_PLATEDHOLES ); + m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); m_gal->SetIsStroke( true ); m_gal->SetIsFill( false );