From 23667fc4c48e1baf28d4e000d380a4c65db4c018 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 26 Mar 2021 18:02:30 +0100 Subject: [PATCH] 3D viewer: make solder paste layer thickness bigger than the mask layer. Some specific footprints need shapes on paste layer covering the mask layer, so ensure these shapes are visible. Fixes #8041 https://gitlab.com/kicad/code/kicad/issues/8041 --- 3d-viewer/3d_canvas/board_adapter.cpp | 29 +++++++++++++++++++-------- 3d-viewer/3d_canvas/board_adapter.h | 5 ++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index c002de5729..f1ca6a39a3 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -34,7 +34,7 @@ #include <3d_math.h> #include "3d_fastmath.h" #include -#include // for KiROUND +#include #include #include @@ -82,6 +82,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() : m_epoxyThickness3DU = 0.0f; m_copperThickness3DU = 0.0f; m_nonCopperLayerThickness3DU = 0.0f; + m_solderPasteLayerThickness3DU = 0.0f; m_biuTo3Dunits = 1.0; m_trackCount = 0; @@ -238,10 +239,13 @@ bool BOARD_ADAPTER::IsFootprintShown( FOOTPRINT_ATTR_T aFPAttributes ) const } -// !TODO: define the actual copper thickness by user -#define COPPER_THICKNESS KiROUND( 0.035 * IU_PER_MM ) // for 35 um -#define TECH_LAYER_THICKNESS KiROUND( 0.04 * IU_PER_MM ) - +// !TODO: define the actual copper thickness by user from board stackup +#define COPPER_THICKNESS Millimeter2iu( 0.035 ) // for 35 um +// The solder mask layer (and silkscreen) thickness +#define TECH_LAYER_THICKNESS Millimeter2iu( 0.04 ) +// The solder paste thickness is chosen bigger than the solder mask layer +// to be sure is covers the mask when overlapping. +#define SOLDERPASTE_LAYER_THICKNESS Millimeter2iu( 0.08 ) int BOARD_ADAPTER::GetHolePlatingThickness() const noexcept { @@ -320,6 +324,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR // !TODO: use value defined by user (currently use default values by ctor m_copperThickness3DU = COPPER_THICKNESS * m_biuTo3Dunits; m_nonCopperLayerThickness3DU = TECH_LAYER_THICKNESS * m_biuTo3Dunits; + m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits; // Init Z position of each layer // calculate z position for each copper layer @@ -381,15 +386,23 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR break; case B_Mask: - case B_Paste: zposBottom = zpos_copperTop_back; zposTop = zpos_copperTop_back - m_nonCopperLayerThickness3DU; break; + case B_Paste: + zposBottom = zpos_copperTop_back; + zposTop = zpos_copperTop_back - m_solderPasteLayerThickness3DU; + break; + case F_Mask: - case F_Paste: - zposTop = zpos_copperTop_front + m_nonCopperLayerThickness3DU; zposBottom = zpos_copperTop_front; + zposTop = zpos_copperTop_front + m_nonCopperLayerThickness3DU; + break; + + case F_Paste: + zposBottom = zpos_copperTop_front; + zposTop = zpos_copperTop_front + m_solderPasteLayerThickness3DU; break; case B_SilkS: diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index b772ae1758..659e12bdb5 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -726,6 +726,9 @@ private: ///< Non copper layers thickness in 3D units. float m_nonCopperLayerThickness3DU; + ///< solder paste layers thickness in 3D units. + float m_solderPasteLayerThickness3DU; + ///< Number of tracks in the board. unsigned int m_trackCount;