mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Refactor pad thickness calculations to use actual copper thickness instead of a fixed value. This change improves accuracy in FEM simulations and margin adjustments for pads.
This commit is contained in:
parent
63fadcbcce
commit
b1866776af
@ -795,7 +795,6 @@ STEP_PCB_MODEL::~STEP_PCB_MODEL()
|
||||
bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool aVia,
|
||||
SHAPE_POLY_SET* aClipPolygon )
|
||||
{
|
||||
const double c_padExtraThickness = 0.005;
|
||||
bool success = true;
|
||||
std::vector<TopoDS_Shape> padShapes;
|
||||
bool castellated = aClipPolygon && aPad->GetProperty() == PAD_PROP::CASTELLATED;
|
||||
@ -814,13 +813,15 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
|
||||
double Zpos, thickness;
|
||||
getLayerZPlacement( pcb_layer, Zpos, thickness );
|
||||
|
||||
double copperExtraThickness = std::abs( thickness ); // Use actual copper thickness
|
||||
|
||||
if( !aVia )
|
||||
{
|
||||
// Pad surface as a separate face for FEM simulations.
|
||||
if( pcb_layer == F_Cu )
|
||||
thickness += c_padExtraThickness;
|
||||
thickness += copperExtraThickness;
|
||||
else if( pcb_layer == B_Cu )
|
||||
thickness -= c_padExtraThickness;
|
||||
thickness -= copperExtraThickness;
|
||||
}
|
||||
|
||||
TopoDS_Shape testShape;
|
||||
@ -882,8 +883,10 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
|
||||
if( !aVia )
|
||||
{
|
||||
// Pad surface is slightly thicker
|
||||
f_thickness += c_padExtraThickness;
|
||||
b_thickness -= c_padExtraThickness;
|
||||
double f_copperExtraThickness = std::abs( f_thickness );
|
||||
double b_copperExtraThickness = std::abs( b_thickness );
|
||||
f_thickness += f_copperExtraThickness;
|
||||
b_thickness -= b_copperExtraThickness;
|
||||
}
|
||||
|
||||
double top = std::max( f_pos, f_pos + f_thickness );
|
||||
@ -974,9 +977,17 @@ bool STEP_PCB_MODEL::AddHole( const SHAPE_SEGMENT& aShape, int aPlatingThickness
|
||||
// is bigger than the board with copper
|
||||
// must be > OCC_MAX_DISTANCE_TO_MERGE_POINTS
|
||||
|
||||
// Pads are taller by 0.01 mm
|
||||
// Pads are taller by the actual copper thickness on both top and bottom
|
||||
if( !aVia )
|
||||
margin += 0.01;
|
||||
{
|
||||
double f_pos, f_thickness;
|
||||
double b_pos, b_thickness;
|
||||
getLayerZPlacement( F_Cu, f_pos, f_thickness );
|
||||
getLayerZPlacement( B_Cu, b_pos, b_thickness );
|
||||
double f_copperExtraThickness = std::abs( f_thickness );
|
||||
double b_copperExtraThickness = std::abs( b_thickness );
|
||||
margin += f_copperExtraThickness + b_copperExtraThickness;
|
||||
}
|
||||
|
||||
double f_pos, f_thickness;
|
||||
double b_pos, b_thickness;
|
||||
|
Loading…
x
Reference in New Issue
Block a user