3D viewer: do not show via/pad shapes of pads not connected on copper layers.

Show the same vias/pad shapes as plot functions.
This commit is contained in:
jean-pierre charras 2020-08-11 11:26:00 +02:00
parent a06a0c1236
commit 29d6fe88f0
3 changed files with 29 additions and 18 deletions

View File

@ -460,6 +460,10 @@ void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule
if( !pad->IsOnLayer( aLayerId ) )
continue;
// Skip pad annulus when not connected on this layer (if removing is enabled)
if( !pad->IsPadOnLayer( aLayerId ) && IsCopperLayer( aLayerId ) )
continue;
// NPTH pads are not drawn on layers if the
// shape size and pos is the same as their hole:
if( aSkipNPTHPadsWihNoCopper && (pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED) )

View File

@ -220,7 +220,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD TRACKS
// Add track segments shapes and via annulus shapes
unsigned int nTracks = trackList.size();
for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
@ -231,6 +231,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( !track->IsOnLayer( curr_layer_id ) )
continue;
// Skip vias annulus when not connected on this layer (if removing is enabled)
const VIA *via = dyn_cast< const VIA*>( track );
if( via && !via->IsPadOnLayer( curr_layer_id ) && IsCopperLayer( curr_layer_id ) )
continue;
// Add object item to layer container
createNewTrack( track, layerContainer, 0.0f );
}
@ -353,9 +359,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( viatype != VIATYPE::THROUGH )
{
// Add VIA hole contourns
// /////////////////////////////////////////////////////////
// Add outer holes of VIAs
SHAPE_POLY_SET *layerOuterHolesPoly = NULL;
@ -413,6 +417,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
TransformCircleToPolygon( m_through_outer_holes_vias_poly,
via->GetStart(), hole_outer_radius, ARC_HIGH_DEF );
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
{
TransformCircleToPolygon( m_through_outer_ring_holes_vias_poly,
@ -433,7 +438,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
start_Time = GetRunningMicroSecs();
#endif
// Creates outline contours of the tracks and add it to the poly of the layer
// Creates vertical outline contours of the tracks and add it to the poly of the layer
// /////////////////////////////////////////////////////////////////////////
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
@ -454,7 +459,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( !track->IsOnLayer( curr_layer_id ) )
continue;
// Add the track contour
// Skip vias annulus when not connected on this layer (if removing is enabled)
const VIA *via = dyn_cast< const VIA*>( track );
if( via && !via->IsPadOnLayer( curr_layer_id ) && IsCopperLayer( curr_layer_id ) )
continue;
// Add the track/via contour
track->TransformShapeWithClearanceToPolygon( *layerPoly, 0 );
}
}
@ -486,10 +497,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
pad->GetDrillSize().y ) / 2.0f ) * m_biuTo3Dunits;
m_through_holes_outer.Add( createNewPadDrill( pad, inflate ) );
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
{
m_through_holes_outer_ring.Add( createNewPadDrill( pad, inflate ) );
}
m_through_holes_inner.Add( createNewPadDrill( pad, 0 ) );
}
}
@ -565,8 +578,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
start_Time = GetRunningMicroSecs();
#endif
// Add modules PADs poly contourns
// /////////////////////////////////////////////////////////////////////////
// Add modules PADs poly contourns (vertical outlines)
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
{
@ -576,12 +588,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
// ADD PADS
// Add pads to polygon list
for( auto module : m_board->Modules() )
{
// Construct polys
// /////////////////////////////////////////////////////////////
// Note: NPTH pads are not drawn on copper layers when the pad
// has same shape as its hole
module->TransformPadsShapesWithClearanceToPolygon( curr_layer_id,
@ -589,11 +598,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
0,
true );
// Micro-wave modules may have items on copper layers
module->TransformGraphicTextWithClearanceToPolygonSet( curr_layer_id,
*layerPoly,
0 );
transformGraphicModuleEdgeToPolygonSet( module, curr_layer_id, *layerPoly );
}
}

View File

@ -121,11 +121,14 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aMaxError,
bool aSkipNPTHPadsWihNoCopper ) const
{
for( auto pad : m_pads )
for( D_PAD* pad : m_pads )
{
if( aLayer != UNDEFINED_LAYER && !pad->IsOnLayer(aLayer) )
continue;
if( !pad->IsPadOnLayer( aLayer ) && IsCopperLayer( aLayer ) )
continue;
// NPTH pads are not drawn on layers if the shape size and pos is the same
// as their hole:
if( aSkipNPTHPadsWihNoCopper && pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )