From 766a9bec1eadb4ce63f4345cbbfe9564d8e1275c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 16 Dec 2017 20:43:47 +0100 Subject: [PATCH] Allows negative solder-mask margin in dialog pad properties. However, this is not allowed for custom shapes pads, because it can create very strange solder mask shapes. --- pcbnew/dialogs/dialog_pad_properties.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 867de3c352..9b8f4850d0 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -1027,9 +1027,26 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) ); } + // Some pads need a negative solder mask clearance (mainly for BGA with small pads) + // However the negative solder mask clearance must not create negative mask size + // Therefore test for minimal acceptable negative value + // Hovewer, a negative value can give strange result with custom shapes, so it is not + // allowed for custom pad shape if( m_dummyPad->GetLocalSolderMaskMargin() < 0 ) { - error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) ); + if( m_dummyPad->GetShape() == PAD_SHAPE_CUSTOM ) + error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) ); + else + { + int min_smClearance = -std::min( m_dummyPad->GetSize().x, m_dummyPad->GetSize().y )/2; + + if( m_dummyPad->GetLocalSolderMaskMargin() <= min_smClearance ) + { + error_msgs.Add( wxString::Format( + _( "Pad local solder mask clearance must be greater than %s" ), + StringFromValue( g_UserUnit, min_smClearance, true ) ) ); + } + } } if( m_dummyPad->GetLocalSolderPasteMargin() > 0 )