79 _(
"Bidirectional Pin" ),
83 _(
"Unspecified Pin" ),
84 _(
"Power Input Pin" ),
85 _(
"Power Output Pin" ),
86 _(
"Open Collector" ),
96 _(
"Bidirectional Pin" ),
100 _(
"Unspecified Pin" ),
101 _(
"Power Input Pin" ),
102 _(
"Power Output Pin" ),
103 _(
"Open Collector" ),
145 std::vector<SCH_SHEET*> list;
148 list.push_back(
static_cast<SCH_SHEET*
>( item ) );
150 for(
size_t i = 0; i < list.size(); i++ )
154 for(
size_t j = i + 1; j < list.size(); j++ )
166 ercItem->SetItems( sheet, test_item );
169 screen->Append( marker );
187 [
this]( wxString str )
190 return str.Matches( wxS(
"*${*}*" ) );
195 const wxString&
text )
197 static wxRegEx warningExpr( wxS(
"^\\$\\{ERC_WARNING\\s*([^}]*)\\}(.*)$" ) );
198 static wxRegEx errorExpr( wxS(
"^\\$\\{ERC_ERROR\\s*([^}]*)\\}(.*)$" ) );
200 if( warningExpr.Matches(
text ) )
204 ercItem->SetItems( item );
205 ercItem->SetSheetSpecificPath( sheet );
206 ercItem->SetErrorMessage( warningExpr.GetMatch(
text, 1 ) );
209 screen->Append( marker );
212 if( errorExpr.Matches(
text ) )
216 ercItem->SetItems( item );
217 ercItem->SetSheetSpecificPath( sheet );
218 ercItem->SetErrorMessage( errorExpr.GetMatch(
text, 1 ) );
221 screen->Append( marker );
248 if( unresolved( field.GetShownText( &sheet,
true ) ) )
251 ercItem->SetItems( symbol );
252 ercItem->SetSheetSpecificPath( sheet );
258 testAssertion( &field, sheet, screen, field.GetText() );
270 SCH_TEXT* textItem = static_cast<SCH_TEXT*>( child );
272 if( unresolved( textItem->GetShownText( &sheet, true ) ) )
274 auto ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
275 ercItem->SetItems( symbol );
276 ercItem->SetSheetSpecificPath( sheet );
278 BOX2I bbox = textItem->GetBoundingBox();
279 bbox = symbol->GetTransform().TransformCoordinate( bbox );
280 VECTOR2I pos = bbox.Centre() + symbol->GetPosition();
282 SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
283 screen->Append( marker );
286 testAssertion( symbol, sheet, screen, textItem->GetText() );
290 SCH_TEXTBOX* textboxItem = static_cast<SCH_TEXTBOX*>( child );
292 if( unresolved( textboxItem->GetShownText( &sheet, true ) ) )
294 auto ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
295 ercItem->SetItems( symbol );
296 ercItem->SetSheetSpecificPath( sheet );
298 BOX2I bbox = textboxItem->GetBoundingBox();
299 bbox = symbol->GetTransform().TransformCoordinate( bbox );
300 VECTOR2I pos = bbox.Centre() + symbol->GetPosition();
302 SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
303 screen->Append( marker );
306 testAssertion( symbol, sheet, screen, textboxItem->GetText() );
312 for(
SCH_FIELD& field : label->GetFields() )
314 if( unresolved( field.GetShownText( &sheet,
true ) ) )
317 ercItem->SetItems( label );
318 ercItem->SetSheetSpecificPath( sheet );
321 screen->Append( marker );
324 testAssertion( &field, sheet, screen, field.GetText() );
333 if( unresolved( field.GetShownText( &sheet,
true ) ) )
336 ercItem->SetItems( subSheet );
337 ercItem->SetSheetSpecificPath( sheet );
340 screen->Append( marker );
343 testAssertion( &field, sheet, screen, field.GetText() );
351 if(
pin->GetShownText( &subSheetPath,
true ).Matches( wxS(
"*${*}*" ) ) )
354 ercItem->SetItems(
pin );
355 ercItem->SetSheetSpecificPath( sheet );
358 screen->Append( marker );
364 if(
text->GetShownText( &sheet,
true ).Matches( wxS(
"*${*}*" ) ) )
367 ercItem->SetItems(
text );
368 ercItem->SetSheetSpecificPath( sheet );
371 screen->Append( marker );
374 testAssertion(
text, sheet, screen,
text->GetText() );
378 if( textBox->GetShownText( &sheet,
true ).Matches( wxS(
"*${*}*" ) ) )
381 ercItem->SetItems( textBox );
382 ercItem->SetSheetSpecificPath( sheet );
385 screen->Append( marker );
388 testAssertion( textBox, sheet, screen, textBox->GetText() );
392 for(
DS_DRAW_ITEM_BASE* item = wsItems.GetFirst(); item; item = wsItems.GetNext() )
396 if(
text->GetShownText(
true ).Matches( wxS(
"*${*}*" ) ) )
399 erc->SetErrorMessage(
_(
"Unresolved text variable in drawing sheet" ) );
400 erc->SetSheetSpecificPath( sheet );
403 screen->Append( marker );
415 std::vector<std::shared_ptr<BUS_ALIAS>> aliases;
419 const auto& screen_aliases = screen->GetBusAliases();
421 for(
const std::shared_ptr<BUS_ALIAS>& alias : screen_aliases )
423 std::vector<wxString> aliasMembers = alias->Members();
424 std::sort( aliasMembers.begin(), aliasMembers.end() );
426 for(
const std::shared_ptr<BUS_ALIAS>&
test : aliases )
428 std::vector<wxString> testMembers =
test->Members();
429 std::sort( testMembers.begin(), testMembers.end() );
431 if( alias->GetName() ==
test->GetName() && aliasMembers != testMembers )
433 msg.Printf(
_(
"Bus alias %s has conflicting definitions on %s and %s" ),
435 alias->GetParent()->GetFileName(),
436 test->GetParent()->GetFileName() );
439 ercItem->SetErrorMessage( msg );
442 test->GetParent()->Append( marker );
449 aliases.insert( aliases.end(), screen_aliases.begin(), screen_aliases.end() );
460 for( std::pair<const wxString, SCH_REFERENCE_LIST>& symbol :
m_refMap )
475 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
480 if( !unitFP.IsEmpty() )
483 unitName = unit->
GetRef( &sheetPath,
true );
488 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
496 if( unit && !secondFp.IsEmpty() && unitFP != secondFp )
498 msg.Printf(
_(
"Different footprints assigned to %s and %s" ),
499 unitName, secondName );
502 ercItem->SetErrorMessage( msg );
503 ercItem->SetItems( unit, secondUnit );
521 for( std::pair<const wxString, SCH_REFERENCE_LIST>& symbol :
m_refMap )
525 wxCHECK2( refList.
GetCount(),
continue );
535 std::set<int> lib_units;
536 std::set<int> instance_units;
537 std::set<int> missing_units;
540 [&]( std::set<int>& aMissingUnits,
const wxString& aErrorMsg,
int aErrorCode )
543 wxString missing_pin_units = wxS(
"[ " );
546 for(
int missing_unit : aMissingUnits )
550 missing_pin_units += wxS(
"....." );
557 missing_pin_units.Truncate( missing_pin_units.length() - 2 );
558 missing_pin_units += wxS(
" ]" );
560 msg.Printf( aErrorMsg, symbol.first, missing_pin_units );
563 ercItem->SetErrorMessage( msg );
564 ercItem->SetItems( unit );
565 ercItem->SetSheetSpecificPath( base_ref.
GetSheetPath() );
574 for(
int ii = 1; ii <= libSymbol->
GetUnitCount(); ++ii )
575 lib_units.insert( lib_units.end(), ii );
577 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
578 instance_units.insert( instance_units.end(), refList.
GetItem( ii ).
GetUnit() );
580 std::set_difference( lib_units.begin(), lib_units.end(),
581 instance_units.begin(), instance_units.end(),
582 std::inserter( missing_units, missing_units.begin() ) );
589 std::set<int> missing_power;
590 std::set<int> missing_input;
591 std::set<int> missing_bidi;
593 for(
int missing_unit : missing_units )
597 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
608 switch(
pin->GetType() )
610 case ELECTRICAL_PINTYPE::PT_POWER_IN:
611 missing_power.insert( missing_unit );
614 case ELECTRICAL_PINTYPE::PT_BIDI:
615 missing_bidi.insert( missing_unit );
618 case ELECTRICAL_PINTYPE::PT_INPUT:
619 missing_input.insert( missing_unit );
630 report( missing_power,
631 _(
"Symbol %s has input power pins in units %s that are not placed." ),
637 report( missing_input,
638 _(
"Symbol %s has input pins in units %s that are not placed." ),
644 report( missing_bidi,
645 _(
"Symbol %s has bidirectional pins in units %s that are not placed." ),
658 wxString defaultNetclass = settings->GetDefaultNetclass()->GetName();
667 ercItem->SetItems( item );
668 ercItem->SetErrorMessage( wxString::Format(
_(
"Netclass %s is not defined" ),
684 SCH_FIELD* field = static_cast<SCH_FIELD*>( aChild );
686 if( field->GetCanonicalName() == wxT(
"Netclass" ) )
688 wxString netclass = field->GetShownText( &sheet, false );
690 if( !netclass.IsSameAs( defaultNetclass )
691 && !settings->HasNetclass( netclass ) )
693 logError( sheet, item, netclass );
713 std::map<VECTOR2I, std::vector<SCH_ITEM*>> connMap;
720 connMap[pt].emplace_back( label );
723 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : connMap )
725 std::vector<SCH_ITEM*> lines;
727 for(
SCH_ITEM* item : sheet.LastScreen()->Items().Overlapping(
SCH_LINE_T, pair.first ) )
736 lines.emplace_back( line );
739 if( lines.size() > 1 )
745 wxString msg = wxString::Format(
_(
"Label connects more than one wire at %d, %d" ),
746 pair.first.x, pair.first.y );
748 ercItem->SetItems( pair.second.front(), lines[0], lines[1], lines[2] );
749 ercItem->SetErrorMessage( msg );
750 ercItem->SetSheetSpecificPath( sheet );
753 sheet.LastScreen()->Append( marker );
768 std::map<VECTOR2I, std::vector<SCH_ITEM*>> connMap;
776 connMap[
pin->GetPosition()].emplace_back(
pin );
787 connMap[pt].emplace_back( line );
790 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : connMap )
792 if( pair.second.size() >= 4 )
798 ercItem->SetItems( pair.second[0], pair.second[1], pair.second[2], pair.second[3] );
800 wxString msg = wxString::Format(
_(
"Four items connected at %d, %d" ),
801 pair.first.x, pair.first.y );
802 ercItem->SetErrorMessage( msg );
804 ercItem->SetSheetSpecificPath( sheet );
807 sheet.LastScreen()->Append( marker );
822 std::map<VECTOR2I, std::vector<SCH_ITEM*>> pinMap;
827 if( pinMap.count( pt ) )
828 pinMap[pt].emplace_back( aOther );
837 if(
pin->GetLibPin()->GetType() == ELECTRICAL_PINTYPE::PT_NC )
838 pinMap[
pin->GetPosition()].emplace_back(
pin );
842 for(
SCH_ITEM* item : sheet.LastScreen()->Items() )
850 if(
pin->GetLibPin()->GetType() != ELECTRICAL_PINTYPE::PT_NC )
851 addOther(
pin->GetPosition(),
pin );
854 else if( item->IsConnectable() )
856 for(
const VECTOR2I& pt : item->GetConnectionPoints() )
857 addOther( pt, item );
861 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : pinMap )
863 if( pair.second.size() > 1 )
869 ercItem->SetItems( pair.second[0], pair.second[1],
870 pair.second.size() > 2 ? pair.second[2] :
nullptr,
871 pair.second.size() > 3 ? pair.second[3] :
nullptr );
872 ercItem->SetErrorMessage(
_(
"Pin with 'no connection' type is connected" ) );
873 ercItem->SetSheetSpecificPath( sheet );
876 sheet.LastScreen()->Append( marker );
891 std::vector<ERC_SCH_PIN_CONTEXT> pins;
892 std::unordered_map<EDA_ITEM*, SCH_SCREEN*> pinToScreenMap;
893 bool has_noconnect =
false;
898 has_noconnect =
true;
904 pins.emplace_back(
static_cast<SCH_PIN*
>( item ), subgraph->
GetSheet() );
910 std::sort( pins.begin(), pins.end(),
913 int ret = StrNumCmp( lhs.Pin()->GetParentSymbol()->GetRef( &lhs.Sheet() ),
914 rhs.Pin()->GetParentSymbol()->GetRef( &rhs.Sheet() ) );
917 ret = StrNumCmp( lhs.Pin()->GetNumber(), rhs.Pin()->GetNumber() );
927 bool hasDriver =
false;
932 bool ispowerNet =
false;
936 if( refPin.Pin()->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN )
943 for(
auto refIt = pins.begin(); refIt != pins.end(); ++refIt )
953 if( !needsDriver.
Pin()
955 || ( ispowerNet != ( needsDriverType == ELECTRICAL_PINTYPE::PT_POWER_IN )
956 && ispowerNet == ( refType == ELECTRICAL_PINTYPE::PT_POWER_IN ) ) )
958 needsDriver = refPin;
959 needsDriverType = needsDriver.
Pin()->
GetType();
968 for(
auto testIt = refIt + 1; testIt != pins.end(); ++testIt )
989 std::shared_ptr<ERC_ITEM> ercItem =
992 ercItem->SetItems( refPin.
Pin(), testPin.
Pin() );
993 ercItem->SetSheetSpecificPath( refPin.
Sheet() );
994 ercItem->SetItemsSheetPaths( refPin.
Sheet(), testPin.
Sheet() );
996 ercItem->SetErrorMessage(
997 wxString::Format(
_(
"Pins of type %s and %s are connected" ),
1002 pinToScreenMap[refPin.
Pin()]->Append( marker );
1008 if( needsDriver.
Pin() && !hasDriver && !has_noconnect )
1016 ercItem->SetItems( needsDriver.
Pin() );
1017 ercItem->SetSheetSpecificPath( needsDriver.
Sheet() );
1018 ercItem->SetItemsSheetPaths( needsDriver.
Sheet() );
1021 pinToScreenMap[needsDriver.
Pin()]->Append( marker );
1035 std::unordered_map<wxString, std::pair<wxString, SCH_PIN*>> pinToNetMap;
1039 const wxString& netName = net.first.Name;
1050 if( !
pin->GetLibPin()->GetParentSymbol()->IsMulti() )
1053 wxString
name =
pin->GetParentSymbol()->GetRef( &sheet ) +
1054 +
":" +
pin->GetShownNumber();
1056 if( !pinToNetMap.count(
name ) )
1058 pinToNetMap[
name] = std::make_pair( netName,
pin );
1060 else if( pinToNetMap[
name].first != netName )
1062 std::shared_ptr<ERC_ITEM> ercItem =
1065 ercItem->SetErrorMessage( wxString::Format(
1066 _(
"Pin %s is connected to both %s and %s" ),
1067 pin->GetShownNumber(),
1069 pinToNetMap[
name].first ) );
1071 ercItem->SetItems(
pin, pinToNetMap[
name].second );
1072 ercItem->SetSheetSpecificPath( sheet );
1073 ercItem->SetItemsSheetPaths( sheet, sheet );
1092 std::unordered_map<wxString, std::pair<SCH_ITEM*, SCH_SHEET_PATH>> globalLabels;
1093 std::unordered_map<wxString, std::pair<SCH_ITEM*, SCH_SHEET_PATH>> localLabels;
1108 auto& map = item->Type() ==
SCH_LABEL_T ? localLabels : globalLabels;
1110 if( !map.count(
text ) )
1112 map[
text] = std::make_pair( label, sheet );
1119 for(
auto& [globalText, globalItem] : globalLabels )
1121 for(
auto& [localText, localItem] : localLabels )
1123 if( globalText == localText )
1125 std::shared_ptr<ERC_ITEM> ercItem =
1127 ercItem->SetItems( globalItem.first, localItem.first );
1128 ercItem->SetSheetSpecificPath( globalItem.second );
1129 ercItem->SetItemsSheetPaths( globalItem.second, localItem.second );
1132 globalItem.second.LastScreen()->Append( marker );
1146 std::unordered_map<wxString, std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>> generalMap;
1150 auto& [otherText, otherItem, otherSheet] = generalMap.at( normalized );
1170 ercItem->SetItems( item, otherItem );
1171 ercItem->SetSheetSpecificPath( sheet );
1172 ercItem->SetItemsSheetPaths( sheet, otherSheet );
1175 sheet.LastScreen()->Append( marker );
1186 switch( item->Type() )
1193 wxString unnormalized = label->
GetShownText( &sheet,
false );
1194 wxString normalized = unnormalized.Lower();
1196 if( !generalMap.count( normalized ) )
1198 generalMap[normalized] = std::make_tuple( unnormalized, label, sheet );
1201 auto& [otherText, otherItem, otherSheet] = generalMap.at( normalized );
1203 if( unnormalized != otherText )
1205 logError( normalized, label, sheet );
1215 if( !
pin->IsGlobalPower() )
1221 wxString unnormalized = symbol->
GetValue(
true, &sheet,
false );
1222 wxString normalized = unnormalized.Lower();
1224 if( !generalMap.count( normalized ) )
1226 generalMap[normalized] = std::make_tuple( unnormalized,
pin, sheet );
1229 auto& [otherText, otherItem, otherSheet] = generalMap.at( normalized );
1231 if( unnormalized != otherText )
1233 logError( normalized,
pin, sheet );
1260 std::vector<SCH_MARKER*> markers;
1267 wxCHECK2( libSymbolInSchematic,
continue );
1277 ercItem->SetItems( symbol );
1278 msg.Printf(
_(
"The current configuration does not include the symbol library '%s'" ),
1280 ercItem->SetErrorMessage( msg );
1287 else if( !libTable->
HasLibrary( libName,
true ) )
1292 ercItem->SetItems( symbol );
1293 msg.Printf(
_(
"The library '%s' is not enabled in the current configuration" ),
1295 ercItem->SetErrorMessage( msg );
1306 if( libSymbol ==
nullptr )
1311 ercItem->SetItems( symbol );
1312 msg.Printf(
_(
"Symbol '%s' not found in symbol library '%s'" ),
1315 ercItem->SetErrorMessage( msg );
1323 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
1329 std::vector<wxString> messages;
1333 if( !messages.empty() )
1336 ercItem->SetItems( symbol );
1337 msg.Printf(
_(
"Symbol '%s' has multiple pins with the same pin number" ),
1339 ercItem->SetErrorMessage( msg );
1343 else if( flattenedSymbol->Compare( *libSymbolInSchematic, flags ) != 0 )
1346 ercItem->SetItems( symbol );
1347 msg.Printf(
_(
"Symbol '%s' doesn't match copy in library '%s'" ),
1350 ercItem->SetErrorMessage( msg );
1359 screen->Append( marker );
1375 typedef int (*TESTER_FN_PTR)(
const wxString&,
PROJECT* );
1381 std::vector<SCH_MARKER*> markers;
1388 if( footprint.IsEmpty() )
1393 if( fpID.
Parse( footprint,
true ) >= 0 )
1396 msg.Printf(
_(
"'%s' is not a valid footprint identifier." ), footprint );
1397 ercItem->SetErrorMessage( msg );
1398 ercItem->SetItems( symbol );
1405 int ret = (linkTester)( footprint, aProject );
1410 msg.Printf(
_(
"The current configuration does not include the footprint library '%s'." ),
1412 ercItem->SetErrorMessage( msg );
1413 ercItem->SetItems( symbol );
1419 msg.Printf(
_(
"The footprint library '%s' is not enabled in the current configuration." ),
1421 ercItem->SetErrorMessage( msg );
1422 ercItem->SetItems( symbol );
1428 msg.Printf(
_(
"Footprint '%s' not found in library '%s'." ),
1431 ercItem->SetErrorMessage( msg );
1432 ercItem->SetItems( symbol );
1439 sheet.LastScreen()->Append( marker );
1457 std::vector<SCH_MARKER*> markers;
1462 std::unique_ptr<LIB_SYMBOL>& lib_symbol = sch_symbol->
GetLibSymbolRef();
1467 wxArrayString filters = lib_symbol->GetFPFilters();
1469 if( filters.empty() )
1480 for(
const wxString&
filter : filters )
1482 found |= footprintName.Matches(
filter );
1491 msg.Printf(
_(
"Assigned footprint (%s) doesn't match footprint filters (%s)." ),
1493 wxJoin( filters,
' ' ) );
1494 ercItem->SetErrorMessage( msg );
1495 ercItem->SetItems( sch_symbol );
1502 sheet.LastScreen()->Append( marker );
1518 std::vector<SCH_MARKER*> markers;
1520 for(
SCH_ITEM* item : screen->Items() )
1522 if( item->Type() ==
SCH_LINE_T && item->IsConnectable() )
1530 ercItem->SetItems( line );
1538 ercItem->SetItems( line );
1551 if( ( pinPos.
x % gridSize ) != 0 || ( pinPos.
y % gridSize ) != 0 )
1554 ercItem->SetItems(
pin );
1556 markers.emplace_back(
new SCH_MARKER( ercItem, pinPos ) );
1565 screen->Append( marker );
1582 if( sheet.GetExcludedFromSim() )
1585 std::vector<SCH_MARKER*> markers;
1609 ercItem->SetErrorMessage( msg );
1610 ercItem->SetItems( symbol );
1618 sheet.LastScreen()->Append( marker );
1636 if( aProgressReporter )
1637 aProgressReporter->
AdvancePhase(
_(
"Checking sheet names..." ) );
1644 if( aProgressReporter )
1645 aProgressReporter->
AdvancePhase(
_(
"Checking bus conflicts..." ) );
1651 if( aProgressReporter )
1652 aProgressReporter->
AdvancePhase(
_(
"Checking conflicts..." ) );
1665 if( aProgressReporter )
1666 aProgressReporter->
AdvancePhase(
_(
"Checking units..." ) );
1671 if( aProgressReporter )
1672 aProgressReporter->
AdvancePhase(
_(
"Checking footprints..." ) );
1685 if( aProgressReporter )
1706 if( aProgressReporter )
1707 aProgressReporter->
AdvancePhase(
_(
"Checking labels..." ) );
1715 if( aProgressReporter )
1716 aProgressReporter->
AdvancePhase(
_(
"Checking for unresolved variables..." ) );
1723 if( aProgressReporter )
1724 aProgressReporter->
AdvancePhase(
_(
"Checking SPICE models..." ) );
1731 if( aProgressReporter )
1732 aProgressReporter->
AdvancePhase(
_(
"Checking no connect pins for connections..." ) );
1740 if( aProgressReporter )
1741 aProgressReporter->
AdvancePhase(
_(
"Checking for library symbol issues..." ) );
1748 if( aProgressReporter )
1749 aProgressReporter->
AdvancePhase(
_(
"Checking for footprint link issues..." ) );
1756 if( aProgressReporter )
1757 aProgressReporter->
AdvancePhase(
_(
"Checking footprint assignments against footprint filters..." ) );
1764 if( aProgressReporter )
1765 aProgressReporter->
AdvancePhase(
_(
"Checking for off grid pins and wires..." ) );
1772 if( aProgressReporter )
1773 aProgressReporter->
AdvancePhase(
_(
"Checking for four way junctions..." ) );
1780 if( aProgressReporter )
1781 aProgressReporter->
AdvancePhase(
_(
"Checking for labels on more than one wire..." ) );
1788 if( aProgressReporter )
1789 aProgressReporter->
AdvancePhase(
_(
"Checking for undefined netclasses..." ) );
constexpr EDA_IU_SCALE schIUScale
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
int RunERC()
Run electrical rule checks on the connectivity graph.
A subgraph is a set of items that are electrically connected on a single sheet.
const std::set< SCH_ITEM * > & GetItems() const
Provide a read-only reference to the items in the subgraph.
const SCH_ITEM * GetNoConnect() const
const SCH_SHEET_PATH & GetSheet() const
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
void SetProject(const PROJECT *aProject)
const PAGE_INFO & GetPageInfo()
const TITLE_BLOCK & GetTitleBlock()
virtual VECTOR2I GetPosition() const
KICAD_T Type() const
Returns the type of object.
EE_TYPE OfType(KICAD_T aType) const
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
A class used to associate a SCH_PIN with its owning SCH_SHEET_PATH, in order to handle ERC checks acr...
const SCH_SHEET_PATH & Sheet() const
Get the SCH_SHEET_PATH context for the paired SCH_PIN.
SCH_PIN * Pin() const
Get the SCH_PIN for this context.
bool IsTestEnabled(int aErrorCode) const
PIN_ERROR GetPinMapValue(int aFirstType, int aSecondType) const
int TestLibSymbolIssues()
Test symbols for changed library symbols and broken symbol library links.
void TestTextVars(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Check for any unresolved text variable references.
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
SCH_MULTI_UNIT_REFERENCE_MAP m_refMap
int TestFootprintLinkIssues(KIFACE *aCvPcb, PROJECT *aProject)
Test footprint links against the current footprint libraries.
int TestOffGridEndpoints()
Test pins and wire ends for being off grid.
int TestDuplicateSheetNames(bool aCreateMarker)
Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
int TestSameLocalGlobalLabel()
Checks for global and local labels with the same name.
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
int TestConflictingBusAliases()
Check that there are no conflicting bus alias definitions in the schematic.
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
int TestFootprintFilters()
Test symbols to ensure that assigned footprint passes any given footprint filters.
ERC_SETTINGS & m_settings
int TestFourWayJunction()
Test to see if there are potentially confusing 4-way junctions in the schematic.
int TestMissingNetclasses()
Tests for netclasses that are referenced but not defined.
int TestSimModelIssues()
Test SPICE models for various issues.
SCH_SHEET_LIST m_sheetList
void RunTests(DS_PROXY_VIEW_ITEM *aDrawingSheet, SCH_EDIT_FRAME *aEditFrame, KIFACE *aCvPcb, PROJECT *aProject, PROGRESS_REPORTER *aProgressReporter)
int TestMissingUnits()
Test for uninstantiated units of multi unit symbols.
int TestLabelMultipleWires()
Test to see if there are labels that are connected to more than one wire.
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
A progress reporter interface for use in multi-threaded environments.
virtual void AdvancePhase()=0
Use the next available virtual zone of the dialog progress bar.
std::shared_ptr< NET_SETTINGS > & NetSettings()
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
Container for project specific data.
virtual PROJECT_FILE & GetProjectFile() const
void ResolveERCExclusionsPostUpdate()
Update markers to match recorded exclusions.
SCHEMATIC_SETTINGS & Settings() const
CONNECTION_GRAPH * ConnectionGraph() const override
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Schematic editor (Eeschema) main window.
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Segment description base class to describe items which have 2 end points (track, wire,...
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsEndPoint(const VECTOR2I &aPoint) const
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
VECTOR2I GetPosition() const override
bool IsStacked(const SCH_PIN *aPin) const
ELECTRICAL_PINTYPE GetType() const
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
SCH_REFERENCE & GetItem(size_t aIdx)
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
const wxString GetFootprint() const
SCH_SYMBOL * GetSymbol() const
LIB_SYMBOL * GetLibPart() const
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
VECTOR2I GetPosition() const override
std::vector< SCH_SHEET_PIN * > & GetPins()
wxString GetShownName(bool aAllowExtraText) const
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
VECTOR2I GetPosition() const override
const LIB_ID & GetLibId() const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
bool GetExcludedFromSim() const override
A wrapper for reporting to a wxString object.
bool HasMessage() const override
Returns true if the reporter client is non-empty.
const wxString & GetMessages() const
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
void CheckDuplicatePins(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, UNITS_PROVIDER *aUnitsProvider)
const wxString CommentERC_V[]
const wxString CommentERC_H[]
const std::set< ELECTRICAL_PINTYPE > DrivenPinTypes
const std::set< ELECTRICAL_PINTYPE > DrivingPinTypes
const std::set< ELECTRICAL_PINTYPE > DrivingPowerPinTypes
@ ERCE_POWERPIN_NOT_DRIVEN
Power input pin connected to some others pins but no power out pin to drive it.
@ ERCE_SIMILAR_POWER
2 power pins are equal for case insensitive comparisons.
@ ERCE_MISSING_POWER_INPUT_PIN
Symbol has power input pins that are not placed on the schematic.
@ ERCE_SIMILAR_LABELS
2 labels are equal for case insensitive comparisons.
@ ERCE_ENDPOINT_OFF_GRID
Pin or wire-end off grid.
@ ERCE_SAME_LOCAL_GLOBAL_LABEL
2 labels are equal for case insensitive comparisons.
@ ERCE_SIMILAR_LABEL_AND_POWER
label and pin are equal for case insensitive comparisons.
@ ERCE_FOOTPRINT_LINK_ISSUES
The footprint link is invalid, or points to a missing (or inactive) footprint or library.
@ ERCE_DUPLICATE_PIN_ERROR
@ ERCE_DIFFERENT_UNIT_NET
Shared pin in a multi-unit symbol is connected to more than one net.
@ ERCE_FOUR_WAY_JUNCTION
A four-way junction was found.
@ ERCE_UNDEFINED_NETCLASS
A netclass was referenced but not defined.
@ ERCE_UNRESOLVED_VARIABLE
A text variable could not be resolved.
@ ERCE_SIMULATION_MODEL
An error was found in the simulation model.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_DIFFERENT_UNIT_FP
Different units of the same symbol have different footprints assigned.
@ ERCE_NOCONNECT_CONNECTED
A no connect symbol is connected to more than 1 pin.
@ ERCE_PIN_TO_PIN_WARNING
@ ERCE_PIN_NOT_DRIVEN
Pin connected to some others pins but no pin to drive it.
@ ERCE_MISSING_INPUT_PIN
Symbol has input pins that are not placed.
@ ERCE_MISSING_UNIT
Symbol has units that are not placed on the schematic.
@ ERCE_DUPLICATE_SHEET_NAME
Duplicate sheet names within a given sheet.
@ ERCE_MISSING_BIDI_PIN
Symbol has bi-directional pins that are not placed.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
@ ERCE_FOOTPRINT_FILTERS
The assigned footprint doesn't match the footprint filters.
@ ERCE_BUS_ALIAS_CONFLICT
Conflicting bus alias definitions across sheets.
@ ERCE_LABEL_MULTIPLE_WIRES
A label is connected to more than one wire.
PIN_ERROR
The values a pin-to-pin entry in the pin matrix can take on.
@ KIFACE_TEST_FOOTPRINT_LINK_LIBRARY_NOT_ENABLED
@ KIFACE_TEST_FOOTPRINT_LINK
@ KIFACE_TEST_FOOTPRINT_LINK_NO_LIBRARY
@ KIFACE_TEST_FOOTPRINT_LINK_NO_FOOTPRINT
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE aType)
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
@ PT_TRISTATE
tris state bus pin
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin
LIB_SYMBOL * SchGetLibSymbol(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, SYMBOL_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
wxString UnescapeString(const wxString &aSource)
Implement a participant in the KIWAY alchemy.
virtual void * IfaceOrAddress(int aDataId)=0
Return pointer to the requested object.
VECTOR2< int32_t > VECTOR2I