Don't show ERCs for every sheet path when using shared schematics.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16434

(cherry picked from commit f07d797ab3)
This commit is contained in:
Wayne Stambaugh 2024-01-04 13:53:16 -05:00
parent f92cedab9a
commit 0aec789659
1 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 CERN
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Jon Evans <jon@craftyjon.com>
*
@ -2997,6 +2997,7 @@ bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSu
if( net_item && bus_item )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_TO_NET_CONFLICT );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( net_item, bus_item );
SCH_MARKER* marker = new SCH_MARKER( ercItem, net_item->GetPosition() );
@ -3064,6 +3065,7 @@ bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSu
if( !match )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_TO_BUS_CONFLICT );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( label, port );
SCH_MARKER* marker = new SCH_MARKER( ercItem, label->GetPosition() );
@ -3167,6 +3169,7 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
UnescapeString( netName ),
UnescapeString( bus_name ) );
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ENTRY_CONFLICT );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( bus_entry, bus_wire );
ercItem->SetErrorMessage( msg );
@ -3270,6 +3273,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
if( unique_pins.size() > 1 && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_CONNECTED );
ercItem->SetSheetSpecificPath( sheet );
VECTOR2I pos;
if( pin )
@ -3292,6 +3297,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
if( unique_pins.empty() && unique_labels.empty() && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_NOT_CONNECTED );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( aSubgraph->m_no_connect );
SCH_MARKER* marker = new SCH_MARKER( ercItem, aSubgraph->m_no_connect->GetPosition() );
@ -3381,6 +3387,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
&& settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_CONNECTED );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( pin );
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetTransformedPosition() );
@ -3404,6 +3411,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
&& settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_CONNECTED );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( testPin );
SCH_MARKER* marker = new SCH_MARKER( ercItem,
@ -3425,6 +3433,7 @@ bool CONNECTION_GRAPH::ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgra
if( aSubgraph->m_driver )
return true;
const SCH_SHEET_PATH& sheet = aSubgraph->m_sheet;
std::vector<SCH_ITEM*> wires;
// We've gotten this far, so we know we have no valid driver. All we need to do is check
@ -3443,6 +3452,7 @@ bool CONNECTION_GRAPH::ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgra
SCH_SCREEN* screen = aSubgraph->m_sheet.LastScreen();
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_WIRE_DANGLING );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( wires[0],
wires.size() > 1 ? wires[1] : nullptr,
wires.size() > 2 ? wires[2] : nullptr,
@ -3475,6 +3485,7 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
if( aSubgraph->m_driver_connection->IsBus() )
return true;
const SCH_SHEET_PATH& sheet = aSubgraph->m_sheet;
ERC_SETTINGS& settings = m_schematic->ErcSettings();
bool ok = true;
int pinCount = 0;
@ -3496,6 +3507,7 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
if( settings.IsTestEnabled( errCode ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( errCode );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItems( aText );
SCH_MARKER* marker = new SCH_MARKER( ercItem, aText->GetPosition() );