wxSize D_PAD::GetSolderPasteMargin() const { // The pad inherits the margin only to calculate a default shape, // therefore only if it is also a copper layer. // Pads defined only on mask layers (and perhaps on other tech layers) use the shape // defined by the pad settings only bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any(); if( !isOnCopperLayer ) return wxSize( 0, 0 ); int margin = m_LocalSolderPasteMargin; double mratio = m_LocalSolderPasteMarginRatio; MODULE* module = GetParent(); if( module ) { if( margin == 0 ) margin = module->GetLocalSolderPasteMargin(); auto brd = GetBoard(); if( margin == 0 && brd ) { margin = brd->GetDesignSettings().m_SolderPasteMargin; } if( mratio == 0.0 ) mratio = module->GetLocalSolderPasteMarginRatio(); if( mratio == 0.0 && brd ) { mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio; } } wxSize pad_margin; pad_margin.x = margin + KiROUND( m_Size.x * mratio ); pad_margin.y = margin + KiROUND( m_Size.y * mratio ); // ensure mask have a size always >= 0 if( pad_margin.x < -m_Size.x / 2 ) pad_margin.x = -m_Size.x / 2; if( pad_margin.y < -m_Size.y / 2 ) pad_margin.y = -m_Size.y / 2; return pad_margin; }
wxSize D_PAD::GetSolderPasteMargin() const { int margin = m_LocalSolderPasteMargin; double mratio = m_LocalSolderPasteMarginRatio; MODULE* module = GetParent(); if( module ) { if( margin == 0 ) margin = module->GetLocalSolderPasteMargin(); BOARD * brd = GetBoard(); if( margin == 0 ) margin = brd->GetDesignSettings().m_SolderPasteMargin; if( mratio == 0.0 ) mratio = module->GetLocalSolderPasteMarginRatio(); if( mratio == 0.0 ) { mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio; } } wxSize pad_margin; pad_margin.x = margin + KiROUND( m_Size.x * mratio ); pad_margin.y = margin + KiROUND( m_Size.y * mratio ); // ensure mask have a size always >= 0 if( pad_margin.x < -m_Size.x / 2 ) pad_margin.x = -m_Size.x / 2; if( pad_margin.y < -m_Size.y / 2 ) pad_margin.y = -m_Size.y / 2; return pad_margin; }