Don't prompt for rule areas and no-net shapes

Highlighting and placing vias will pop up a potential net list. This
should not include things without nets

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21381
This commit is contained in:
Seth Hillbrand 2025-07-25 16:38:21 -07:00
parent 15166a9f14
commit dd41e2b00b
4 changed files with 44 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include <board_item.h> // class BOARD_ITEM #include <board_item.h> // class BOARD_ITEM
#include <footprint.h> #include <footprint.h>
#include <netinfo.h>
#include <pad.h> #include <pad.h>
#include <pcb_track.h> #include <pcb_track.h>
#include <pcb_marker.h> #include <pcb_marker.h>
@ -156,6 +157,7 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
PCB_FIELD* field = nullptr; PCB_FIELD* field = nullptr;
PCB_TEXT* text = nullptr; PCB_TEXT* text = nullptr;
PCB_DIMENSION_BASE* dimension = nullptr; PCB_DIMENSION_BASE* dimension = nullptr;
PCB_SHAPE* shape = nullptr;
switch( aTestItem->Type() ) switch( aTestItem->Type() )
{ {
@ -194,13 +196,28 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
case PCB_ZONE_T: case PCB_ZONE_T:
zone = static_cast<ZONE*>( aTestItem ); zone = static_cast<ZONE*>( aTestItem );
if( m_Guide->IgnoreNoNets() && zone->GetNetCode() == NETINFO_LIST::UNCONNECTED )
return INSPECT_RESULT::CONTINUE;
boardItem = zone; boardItem = zone;
break; break;
case PCB_TEXTBOX_T:
case PCB_SHAPE_T: case PCB_SHAPE_T:
shape = static_cast<PCB_SHAPE*>( aTestItem );
if( m_Guide->IgnoreNoNets() && shape->GetNetCode() == NETINFO_LIST::UNCONNECTED )
return INSPECT_RESULT::CONTINUE;
boardItem = shape;
break;
case PCB_TEXTBOX_T:
case PCB_TABLE_T: case PCB_TABLE_T:
case PCB_TABLECELL_T: case PCB_TABLECELL_T:
if( m_Guide->IgnoreNoNets() )
return INSPECT_RESULT::CONTINUE;
boardItem = static_cast<BOARD_ITEM*>( aTestItem ); boardItem = static_cast<BOARD_ITEM*>( aTestItem );
break; break;
@ -209,15 +226,24 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
if( m_Guide->IgnoreNoNets() )
return INSPECT_RESULT::CONTINUE;
dimension = static_cast<PCB_DIMENSION_BASE*>( aTestItem ); dimension = static_cast<PCB_DIMENSION_BASE*>( aTestItem );
boardItem = dimension; boardItem = dimension;
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
if( m_Guide->IgnoreNoNets() )
return INSPECT_RESULT::CONTINUE;
boardItem = static_cast<BOARD_ITEM*>( aTestItem ); boardItem = static_cast<BOARD_ITEM*>( aTestItem );
break; break;
case PCB_FIELD_T: case PCB_FIELD_T:
if( m_Guide->IgnoreNoNets() )
return INSPECT_RESULT::CONTINUE;
field = static_cast<PCB_FIELD*>( aTestItem ); field = static_cast<PCB_FIELD*>( aTestItem );
if( !field->IsVisible() ) if( !field->IsVisible() )
@ -232,6 +258,9 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
KI_FALLTHROUGH; KI_FALLTHROUGH;
case PCB_TEXT_T: case PCB_TEXT_T:
if( m_Guide->IgnoreNoNets() )
return INSPECT_RESULT::CONTINUE;
text = static_cast<PCB_TEXT*>( aTestItem ); text = static_cast<PCB_TEXT*>( aTestItem );
boardItem = text; boardItem = text;

View File

@ -155,6 +155,11 @@ public:
*/ */
virtual bool IgnoreZoneFills() const = 0; virtual bool IgnoreZoneFills() const = 0;
/**
* @return true if should ignore items with no net.
*/
virtual bool IgnoreNoNets() const = 0;
virtual int Accuracy() const = 0; virtual int Accuracy() const = 0;
virtual double OnePixelInIU() const = 0; virtual double OnePixelInIU() const = 0;
@ -359,6 +364,7 @@ public:
m_ignoreMicroVias = false; m_ignoreMicroVias = false;
m_ignoreTracks = false; m_ignoreTracks = false;
m_ignoreZoneFills = true; m_ignoreZoneFills = true;
m_ignoreNoNets = false;
m_onePixelInIU = abs( aView->ToWorld( one, false ).x ); m_onePixelInIU = abs( aView->ToWorld( one, false ).x );
m_accuracy = KiROUND( 5 * m_onePixelInIU ); m_accuracy = KiROUND( 5 * m_onePixelInIU );
@ -466,6 +472,9 @@ public:
bool IgnoreZoneFills() const override { return m_ignoreZoneFills; } bool IgnoreZoneFills() const override { return m_ignoreZoneFills; }
void SetIgnoreZoneFills( bool ignore ) { m_ignoreZoneFills = ignore; } void SetIgnoreZoneFills( bool ignore ) { m_ignoreZoneFills = ignore; }
bool IgnoreNoNets() const override { return m_ignoreNoNets; }
void SetIgnoreNoNets( bool ignore ) { m_ignoreNoNets = ignore; }
int Accuracy() const override { return m_accuracy; } int Accuracy() const override { return m_accuracy; }
void SetAccuracy( int aValue ) { m_accuracy = aValue; } void SetAccuracy( int aValue ) { m_accuracy = aValue; }
@ -496,6 +505,7 @@ private:
bool m_ignoreMicroVias; bool m_ignoreMicroVias;
bool m_ignoreTracks; bool m_ignoreTracks;
bool m_ignoreZoneFills; bool m_ignoreZoneFills;
bool m_ignoreNoNets;
double m_onePixelInIU; double m_onePixelInIU;
int m_accuracy; int m_accuracy;

View File

@ -1788,6 +1788,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
{ {
GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide(); GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
guide.SetIgnoreZoneFills( false ); guide.SetIgnoreZoneFills( false );
guide.SetIgnoreNoNets( true );
PCB_LAYER_ID activeLayer = static_cast<PCB_LAYER_ID>( view()->GetTopLayer() ); PCB_LAYER_ID activeLayer = static_cast<PCB_LAYER_ID>( view()->GetTopLayer() );
guide.SetPreferredLayer( activeLayer ); guide.SetPreferredLayer( activeLayer );

View File

@ -3815,6 +3815,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
for( ZONE* z : m_board->Zones() ) for( ZONE* z : m_board->Zones() )
{ {
if( z->GetIsRuleArea() )
continue; // ignore rule areas
for( PCB_LAYER_ID layer : lset ) for( PCB_LAYER_ID layer : lset )
{ {
if( z->IsOnLayer( layer ) ) if( z->IsOnLayer( layer ) )