mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
3D viewer: fix a minor issue, clean code and and a few comments.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21629
This commit is contained in:
parent
9f06d1f66b
commit
622ddd3a37
@ -368,11 +368,12 @@ private:
|
||||
void createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayer, int aMargin = 0 );
|
||||
|
||||
// Generate the pad shape on board layers. The pad hole is not generated by createPadWithMargin
|
||||
void createPadWithMargin( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayer, const VECTOR2I& aMargin ) const;
|
||||
|
||||
void createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aInflateValue );
|
||||
// Generate the hole shape of aPad, stored in aDstContainer
|
||||
void createPadHoleShape( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aInflateValue );
|
||||
|
||||
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
@ -474,12 +474,12 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aInflateValue )
|
||||
void BOARD_ADAPTER::createPadHoleShape( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aInflateValue )
|
||||
{
|
||||
if( !aPad->HasHole() )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadWithHole - found an invalid pad" ) );
|
||||
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadHole pad has no hole" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -507,27 +507,32 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
{
|
||||
const VECTOR2I padHole = pad->GetDrillSize();
|
||||
|
||||
if( !padHole.x ) // Not drilled pad like SMD pad
|
||||
// Note: holes of NPTH are already built by GetBoardPolygonOutlines
|
||||
if( !pad->HasHole() )
|
||||
continue;
|
||||
|
||||
// The hole in the body is inflated by copper thickness, if not plated, no copper
|
||||
int inflate = 0;
|
||||
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
inflate = KiROUND( GetHolePlatingThickness() / 2.0 );
|
||||
|
||||
m_holeCount++;
|
||||
double holeDiameter = ( pad->GetDrillSize().x + pad->GetDrillSize().y ) / 2.0;
|
||||
m_averageHoleDiameter += static_cast<float>( holeDiameter * m_biuTo3Dunits );
|
||||
|
||||
createPadWithHole( pad, &m_TH_ODs, inflate );
|
||||
if( pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
||||
{
|
||||
// Ensure the silk drawings are clipped to the NPTH hole, like other pad/via holes
|
||||
// even if the clip to board body is not activated (remember NPTH holes are part of
|
||||
// the board body)
|
||||
createPadHoleShape( pad, &m_TH_ODs, 0 );
|
||||
continue;
|
||||
}
|
||||
|
||||
// The hole in the body is inflated by copper thickness
|
||||
int inflate = KiROUND( GetHolePlatingThickness() / 2.0 );
|
||||
|
||||
createPadHoleShape( pad, &m_TH_ODs, inflate );
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
createPadWithHole( pad, &m_viaAnnuli, inflate );
|
||||
createPadHoleShape( pad, &m_viaAnnuli, inflate );
|
||||
|
||||
createPadWithHole( pad, &m_TH_IDs, 0 );
|
||||
createPadHoleShape( pad, &m_TH_IDs, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,9 +544,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
{
|
||||
const VECTOR2I padHole = pad->GetDrillSize();
|
||||
|
||||
if( !padHole.x ) // Not drilled pad like SMD pad
|
||||
if( !pad->HasHole() )
|
||||
continue;
|
||||
|
||||
// The hole in the body is inflated by copper thickness.
|
||||
|
@ -819,10 +819,7 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
{
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
{
|
||||
const VECTOR2I drillsize = pad->GetDrillSize();
|
||||
const bool hasHole = drillsize.x && drillsize.y;
|
||||
|
||||
if( !hasHole )
|
||||
if( !pad->HasHole() )
|
||||
continue;
|
||||
|
||||
pad->TransformHoleToPolygon( tht_outer_holes_poly, platingThickness,
|
||||
|
Loading…
x
Reference in New Issue
Block a user