83 _(
"Bidirectional Pin" ),
87 _(
"Unspecified Pin" ),
88 _(
"Power Input Pin" ),
89 _(
"Power Output Pin" ),
90 _(
"Open Collector" ),
100 _(
"Bidirectional Pin" ),
101 _(
"Tri-State Pin" ),
104 _(
"Unspecified Pin" ),
105 _(
"Power Input Pin" ),
106 _(
"Power Output Pin" ),
107 _(
"Open Collector" ),
149 std::vector<SCH_SHEET*> list;
152 list.push_back(
static_cast<SCH_SHEET*
>( item ) );
154 for(
size_t i = 0; i < list.size(); i++ )
158 for(
size_t j = i + 1; j < list.size(); j++ )
170 ercItem->SetItems( sheet, test_item );
173 screen->Append( marker );
193 typedef void ( *PAD_NUMBERS_FN_PTR )(
const wxString&,
PROJECT*, std::set<wxString>& );
195 PAD_NUMBERS_FN_PTR padFetcher =
198 std::map<wxString, std::set<wxString>> padCache;
200 auto getPads = [&](
const wxString& aFootprintId ) ->
const std::set<wxString>&
202 auto it = padCache.find( aFootprintId );
204 if( it != padCache.end() )
207 std::set<wxString>& pads = padCache[aFootprintId];
209 if( padFetcher && !aFootprintId.IsEmpty() )
210 padFetcher( aFootprintId, aProject, pads );
232 std::set<wxString> pinNumbers;
235 pinNumbers.insert(
pin->GetNumber() );
237 const std::vector<std::set<wxString>>& jumperGroups = lib->
JumperPinGroups();
239 auto sharesJumperGroup = [&](
const wxString& aPinA,
const wxString& aPinB )
241 for(
const std::set<wxString>&
group : jumperGroups )
243 if(
group.count( aPinA ) &&
group.count( aPinB ) )
256 if( pinNumbers.count( entry.m_PinNumber ) )
260 ercItem->SetItems( symbol );
261 ercItem->SetErrorMessage(
262 wxString::Format(
_(
"Pin map '%s' references unknown symbol pin '%s'" ), map.GetName(),
263 entry.m_PinNumber ) );
272 std::map<wxString, wxString> padToPin;
278 auto it = padToPin.find(
pad );
280 if( it == padToPin.end() )
282 padToPin[
pad] = entry.m_PinNumber;
284 else if( it->second != entry.m_PinNumber
285 && !sharesJumperGroup( it->second, entry.m_PinNumber ) )
288 ercItem->SetItems( symbol );
289 ercItem->SetErrorMessage(
290 wxString::Format(
_(
"Symbol pins '%s' and '%s' both map to pad '%s'" ),
291 it->second, entry.m_PinNumber,
pad ) );
300 if( checkBadPad && padFetcher )
309 const std::set<wxString>& pads = getPads( assoc.m_FootprintLibId.GetUniStringLibId() );
318 if( pads.count(
pad ) )
322 ercItem->SetItems( symbol );
323 ercItem->SetErrorMessage( wxString::Format(
324 _(
"Pin map '%s' references pad '%s' not present on footprint '%s'" ),
325 boundMap->
GetName(),
pad, assoc.m_FootprintLibId.GetUniStringLibId() ) );
352 if( fpText.IsEmpty() || fpId.
Parse( fpText,
true ) >= 0 )
362 if(
pin->IsDangling() )
366 pin->GetEffectivePadNumber( sheet, variant, fpId, &pads, &state );
368 if( state != SCH_PIN::PAD_RESOLUTION::UNMAPPED )
372 ercItem->SetItems(
pin );
373 ercItem->SetErrorMessage(
374 wxString::Format(
_(
"Pin '%s' is connected but maps to no pad on footprint '%s'" ),
375 pin->GetNumber(), fpText ) );
376 sheet.LastScreen()->Append(
new SCH_MARKER( std::move( ercItem ),
pin->GetPosition() ) );
392 [
this]( wxString str )
395 return str.Matches( wxS(
"*${*}*" ) );
402 static wxRegEx warningExpr( wxS(
"^\\$\\{ERC_WARNING\\s*([^}]*)\\}(.*)$" ) );
403 static wxRegEx errorExpr( wxS(
"^\\$\\{ERC_ERROR\\s*([^}]*)\\}(.*)$" ) );
405 if( warningExpr.Matches(
text ) )
408 wxString ercText = warningExpr.GetMatch(
text, 1 );
411 ercItem->SetItems( item );
413 ercText +=
_(
" (in drawing sheet)" );
415 ercItem->SetSheetSpecificPath( sheet );
416 ercItem->SetErrorMessage( ercText );
419 screen->Append( marker );
424 if( errorExpr.Matches(
text ) )
427 wxString ercText = errorExpr.GetMatch(
text, 1 );
430 ercItem->SetItems( item );
432 ercText +=
_(
" (in drawing sheet)" );
434 ercItem->SetSheetSpecificPath( sheet );
435 ercItem->SetErrorMessage( ercText );
438 screen->Append( marker );
469 if( unresolved( field.GetShownText( &sheet,
true ) ) )
472 ercItem->SetItems( symbol );
473 ercItem->SetSheetSpecificPath( sheet );
479 testAssertion( &field, sheet, screen, field.GetText(), field.
GetPosition() );
495 if( unresolved( textItem->
GetShownText( &sheet,
true ) ) )
498 ercItem->SetItems( symbol );
499 ercItem->SetSheetSpecificPath( sheet );
509 testAssertion( symbol, sheet, screen, textItem->
GetText(),
516 if( unresolved( textboxItem->
GetShownText(
nullptr, &sheet,
true ) ) )
519 ercItem->SetItems( symbol );
520 ercItem->SetSheetSpecificPath( sheet );
530 testAssertion( symbol, sheet, screen, textboxItem->
GetText(),
539 for(
SCH_FIELD& field : label->GetFields() )
541 if( unresolved( field.GetShownText( &sheet,
true ) ) )
544 ercItem->SetItems( label );
545 ercItem->SetSheetSpecificPath( sheet );
551 testAssertion( &field, sheet, screen, field.GetText(), field.
GetPosition() );
560 if( unresolved( field.GetShownText( &sheet,
true ) ) )
563 ercItem->SetItems( subSheet );
564 ercItem->SetSheetSpecificPath( sheet );
570 testAssertion( &field, sheet, screen, field.GetText(), field.
GetPosition() );
578 if(
pin->GetShownText( &subSheetPath,
true ).Matches( wxS(
"*${*}*" ) ) )
581 ercItem->SetItems(
pin );
582 ercItem->SetSheetSpecificPath( sheet );
591 if(
text->GetShownText( &sheet,
true ).Matches( wxS(
"*${*}*" ) ) )
594 ercItem->SetItems(
text );
595 ercItem->SetSheetSpecificPath( sheet );
601 testAssertion(
text, sheet, screen,
text->GetText(),
text->GetPosition() );
605 if( textBox->GetShownText(
nullptr, &sheet,
true ).Matches( wxS(
"*${*}*" ) ) )
608 ercItem->SetItems( textBox );
609 ercItem->SetSheetSpecificPath( sheet );
615 testAssertion( textBox, sheet, screen, textBox->GetText(), textBox->
GetPosition() );
623 if( testAssertion(
nullptr, sheet, screen,
text->GetText(),
text->GetPosition() ) )
627 else if(
text->GetShownText(
true ).Matches( wxS(
"*${*}*" ) ) )
630 ercItem->SetErrorMessage(
_(
"Unresolved text variable in drawing sheet" ) );
631 ercItem->SetSheetSpecificPath( sheet );
656 wxString trimmedFieldName = field.GetName();
657 trimmedFieldName.Trim();
658 trimmedFieldName.Trim(
false );
660 if( field.GetName() != trimmedFieldName )
663 ercItem->SetItems( symbol, &field );
664 ercItem->SetItemsSheetPaths( sheet, sheet );
665 ercItem->SetSheetSpecificPath( sheet );
666 ercItem->SetErrorMessage(
668 _(
"Field name has leading or trailing whitespace: '%s'" ),
684 wxString trimmedFieldName = field.GetName();
685 trimmedFieldName.Trim();
686 trimmedFieldName.Trim(
false );
688 if( field.GetName() != trimmedFieldName )
691 ercItem->SetItems( subSheet, &field );
692 ercItem->SetItemsSheetPaths( sheet, sheet );
693 ercItem->SetSheetSpecificPath( sheet );
694 ercItem->SetErrorMessage(
696 _(
"Field name has leading or trailing whitespace: '%s'" ),
715 for( std::pair<const wxString, SCH_REFERENCE_LIST>& symbol :
m_refMap )
730 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
735 if( !unitFP.IsEmpty() )
738 unitName = unit->
GetRef( &sheetPath,
true );
743 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
751 if( unit && !secondFp.IsEmpty() && unitFP != secondFp )
753 msg.Printf(
_(
"Different footprints assigned to %s and %s" ),
754 unitName, secondName );
757 ercItem->SetErrorMessage( msg );
758 ercItem->SetItems( unit, secondUnit );
776 for( std::pair<const wxString, SCH_REFERENCE_LIST>& symbol :
m_refMap )
780 wxCHECK2( refList.
GetCount(),
continue );
790 std::set<int> lib_units;
791 std::set<int> instance_units;
792 std::set<int> missing_units;
795 [&]( std::set<int>& aMissingUnits,
const wxString& aErrorMsg,
int aErrorCode )
798 wxString missing_pin_units = wxS(
"[ " );
801 for(
int missing_unit : aMissingUnits )
805 missing_pin_units += wxS(
"..." );
812 missing_pin_units.Truncate( missing_pin_units.length() - 2 );
813 missing_pin_units += wxS(
" ]" );
815 msg.Printf( aErrorMsg, symbol.first, missing_pin_units );
818 ercItem->SetErrorMessage( msg );
819 ercItem->SetItems( unit );
820 ercItem->SetSheetSpecificPath( base_ref.
GetSheetPath() );
829 for(
int ii = 1; ii <= libSymbol->
GetUnitCount(); ++ii )
830 lib_units.insert( lib_units.end(), ii );
832 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
833 instance_units.insert( instance_units.end(), refList.
GetItem( ii ).
GetUnit() );
835 std::set_difference( lib_units.begin(), lib_units.end(),
836 instance_units.begin(), instance_units.end(),
837 std::inserter( missing_units, missing_units.begin() ) );
844 std::set<int> missing_power;
845 std::set<int> missing_input;
846 std::set<int> missing_bidi;
848 for(
int missing_unit : missing_units )
852 for(
size_t ii = 0; ii < refList.
GetCount(); ++ii )
863 switch(
pin->GetType() )
866 missing_power.insert( missing_unit );
870 missing_bidi.insert( missing_unit );
874 missing_input.insert( missing_unit );
885 report( missing_power,
_(
"Symbol %s has input power pins in units %s that are not placed" ),
891 report( missing_input,
_(
"Symbol %s has input pins in units %s that are not placed" ),
897 report( missing_bidi,
_(
"Symbol %s has bidirectional pins in units %s that are not placed" ),
909 std::shared_ptr<NET_SETTINGS>& settings =
m_schematic->Project().GetProjectFile().NetSettings();
910 wxString defaultNetclass = settings->GetDefaultNetclass()->GetName();
919 ercItem->SetItems( item );
920 ercItem->SetErrorMessage( wxString::Format(
_(
"Netclass %s is not defined" ), netclass ) );
939 wxString netclass = field->
GetShownText( &sheet,
false );
941 if( !netclass.empty() && !netclass.IsSameAs( defaultNetclass )
942 && !settings->HasNetclass( netclass ) )
944 logError( sheet, item, netclass );
965 std::map<VECTOR2I, std::vector<SCH_ITEM*>> connMap;
972 connMap[pt].emplace_back( label );
975 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : connMap )
977 std::vector<SCH_ITEM*> lines;
979 for(
SCH_ITEM* item : sheet.LastScreen()->Items().Overlapping(
SCH_LINE_T, pair.first ) )
988 lines.emplace_back( line );
991 if( lines.size() > 1 )
997 wxString msg = wxString::Format(
_(
"Label connects more than one wire at %d, %d" ),
998 pair.first.x, pair.first.y );
1000 ercItem->SetItems( pair.second.front(), lines[0], lines[1], lines[2] );
1001 ercItem->SetErrorMessage( msg );
1002 ercItem->SetSheetSpecificPath( sheet );
1005 sheet.LastScreen()->Append( marker );
1018 auto pinStackAlreadyRepresented =
1019 [](
SCH_PIN*
pin, std::vector<SCH_ITEM*>& collection ) ->
bool
1021 for(
SCH_ITEM*& item : collection )
1023 if( item->Type() ==
SCH_PIN_T && item->GetParentSymbol() ==
pin->GetParentSymbol() )
1037 std::map<VECTOR2I, std::vector<SCH_ITEM*>> connMap;
1046 std::vector<SCH_ITEM*>& entry = connMap[
pin->GetPosition()];
1049 if( pinStackAlreadyRepresented(
pin, entry ) )
1052 entry.emplace_back(
pin );
1064 connMap[pt].emplace_back( line );
1067 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : connMap )
1069 if( pair.second.size() >= 4 )
1075 ercItem->SetItems( pair.second[0], pair.second[1], pair.second[2], pair.second[3] );
1077 wxString msg = wxString::Format(
_(
"Four items connected at %d, %d" ),
1078 pair.first.x, pair.first.y );
1079 ercItem->SetErrorMessage( msg );
1081 ercItem->SetSheetSpecificPath( sheet );
1084 sheet.LastScreen()->Append( marker );
1099 std::map<VECTOR2I, std::vector<SCH_ITEM*>> pinMap;
1104 if( pinMap.count( pt ) )
1105 pinMap[pt].emplace_back( aOther );
1115 pinMap[
pin->GetPosition()].emplace_back(
pin );
1119 for(
SCH_ITEM* item : sheet.LastScreen()->Items() )
1128 addOther(
pin->GetPosition(),
pin );
1133 for(
const VECTOR2I& pt : item->GetConnectionPoints() )
1134 addOther( pt, item );
1138 for(
const std::pair<
const VECTOR2I, std::vector<SCH_ITEM*>>& pair : pinMap )
1140 if( pair.second.size() > 1 )
1144 for(
SCH_ITEM* item : pair.second )
1168 ercItem->SetItems( pair.second[0], pair.second[1],
1169 pair.second.size() > 2 ? pair.second[2] :
nullptr,
1170 pair.second.size() > 3 ? pair.second[3] :
nullptr );
1171 ercItem->SetErrorMessage(
_(
"Pin with 'no connection' type is connected" ) );
1172 ercItem->SetSheetSpecificPath( sheet );
1175 sheet.LastScreen()->Append( marker );
1190 std::unordered_map<wxString, std::vector<ERC_SCH_PIN_CONTEXT>> netToPins;
1194 using iterator_t = std::vector<ERC_SCH_PIN_CONTEXT>::iterator;
1195 std::vector<ERC_SCH_PIN_CONTEXT> pins;
1196 std::unordered_map<EDA_ITEM*, SCH_SCREEN*> pinToScreenMap;
1197 bool has_noconnect =
false;
1202 has_noconnect =
true;
1208 pins.emplace_back(
static_cast<SCH_PIN*
>( item ), subgraph->
GetSheet() );
1209 netToPins[ net.first.Name ].emplace_back(
static_cast<SCH_PIN*
>( item ), subgraph->
GetSheet() );
1215 std::sort( pins.begin(), pins.end(),
1218 int ret = StrNumCmp( lhs.Pin()->GetParentSymbol()->GetRef( &lhs.Sheet() ),
1219 rhs.Pin()->GetParentSymbol()->GetRef( &rhs.Sheet() ) );
1222 ret = StrNumCmp( lhs.Pin()->GetNumber(), rhs.Pin()->GetNumber() );
1232 bool hasDriver =
false;
1233 std::vector<ERC_SCH_PIN_CONTEXT*> pinsNeedingDrivers;
1234 std::vector<ERC_SCH_PIN_CONTEXT*> nonPowerPinsNeedingDrivers;
1235 std::vector<ERC_SCH_PIN_CONTEXT*> powerInPinsNeedingDrivers;
1240 bool ispowerNet =
false;
1251 std::vector<std::tuple<iterator_t, iterator_t, PIN_ERROR>> pin_mismatches;
1252 std::map<iterator_t, int> pin_mismatch_counts;
1254 for(
auto refIt = pins.begin(); refIt != pins.end(); ++refIt )
1264 pinsNeedingDrivers.push_back( &refPin );
1267 nonPowerPinsNeedingDrivers.push_back( &refPin );
1270 powerInPinsNeedingDrivers.push_back( &refPin );
1272 if( !needsDriver.
Pin()
1277 needsDriver = refPin;
1278 needsDriverType = needsDriver.
Pin()->
GetType();
1287 for(
auto testIt = refIt + 1; testIt != pins.end(); ++testIt )
1311 pin_mismatches.emplace_back( std::tuple<iterator_t, iterator_t, PIN_ERROR>{ refIt, testIt,
erc } );
1315 pin_mismatch_counts[refIt] =
m_settings.GetPinTypeWeight( ( *refIt ).Pin()->GetType() );
1316 pin_mismatch_counts[testIt] =
m_settings.GetPinTypeWeight( ( *testIt ).Pin()->GetType() );
1320 if( !pin_mismatch_counts.contains( testIt ) )
1321 pin_mismatch_counts.emplace( testIt, 1 );
1323 pin_mismatch_counts[testIt]++;
1325 if( !pin_mismatch_counts.contains( refIt ) )
1326 pin_mismatch_counts.emplace( refIt, 1 );
1328 pin_mismatch_counts[refIt]++;
1334 std::multimap<size_t, iterator_t, std::greater<size_t>> pins_dsc;
1336 std::transform( pin_mismatch_counts.begin(), pin_mismatch_counts.end(),
1337 std::inserter( pins_dsc, pins_dsc.begin() ),
1340 return std::pair<size_t, iterator_t>( p.second, p.first );
1343 for(
const auto& [amount, pinItBind] : pins_dsc )
1345 auto& pinIt = pinItBind;
1347 if( pin_mismatches.empty() )
1353 iterator_t nearest_pin = pins.end();
1354 double smallest_distance = std::numeric_limits<double>::infinity();
1359 [&](
const auto& tuple )
1363 if( pinIt == std::get<0>( tuple ) )
1364 other = std::get<1>( tuple );
1365 else if( pinIt == std::get<1>( tuple ) )
1366 other = std::get<0>( tuple );
1370 if( ( *pinIt ).Sheet().Cmp( ( *other ).Sheet() ) != 0 )
1372 if( std::isinf( smallest_distance ) )
1374 nearest_pin = other;
1375 erc = std::get<2>( tuple );
1382 if( std::isinf( smallest_distance ) ||
distance < smallest_distance )
1385 nearest_pin = other;
1386 erc = std::get<2>( tuple );
1393 if( nearest_pin != pins.end() )
1395 SCH_PIN* other_pin = ( *nearest_pin ).Pin();
1399 ercItem->SetItems(
pin, other_pin );
1400 ercItem->SetSheetSpecificPath( ( *pinIt ).Sheet() );
1401 ercItem->SetItemsSheetPaths( ( *pinIt ).Sheet(), ( *nearest_pin ).Sheet() );
1403 ercItem->SetErrorMessage( wxString::Format(
_(
"Pins of type %s and %s are connected" ),
1408 pinToScreenMap[
pin]->Append( marker );
1413 if( needsDriver.
Pin() && !hasDriver && !has_noconnect )
1421 bool suppressForNetChainDriver =
false;
1425 const wxString& thisNetName = net.first.Name;
1426 const auto& netChains =
m_schematic->ConnectionGraph()->GetCommittedNetChains();
1428 auto netHasPowerDriver = [&](
const wxString& aNetName ) ->
bool
1431 for(
const auto& n :
m_nets )
1433 if( n.first.Name != aNetName )
1455 for(
const auto& sig : netChains )
1460 const auto& sigNets = sig->GetNets();
1461 bool containsThisNet = std::find( sigNets.begin(), sigNets.end(), thisNetName ) != sigNets.end();
1463 if( !containsThisNet )
1467 for(
const wxString& otherNet : sigNets )
1469 if( otherNet == thisNetName )
1472 if( netHasPowerDriver( otherNet ) )
1474 suppressForNetChainDriver =
true;
1483 if( !suppressForNetChainDriver &&
m_settings.IsTestEnabled( err_code ) )
1485 std::vector<ERC_SCH_PIN_CONTEXT*> pinsToMark;
1494 if( ispowerNet && !powerInPinsNeedingDrivers.empty() )
1495 pinsToMark = powerInPinsNeedingDrivers;
1496 else if( !nonPowerPinsNeedingDrivers.empty() )
1497 pinsToMark = nonPowerPinsNeedingDrivers;
1499 pinsToMark = pinsNeedingDrivers;
1503 if( ispowerNet && !powerInPinsNeedingDrivers.empty() )
1504 pinsToMark.push_back( powerInPinsNeedingDrivers.front() );
1506 pinsToMark.push_back( &needsDriver );
1513 ercItem->SetItems( pinCtx->Pin() );
1514 ercItem->SetSheetSpecificPath( pinCtx->Sheet() );
1515 ercItem->SetItemsSheetPaths( pinCtx->Sheet() );
1518 pinToScreenMap[pinCtx->Pin()]->Append( marker );
1533 auto& netChains =
m_schematic->ConnectionGraph()->GetCommittedNetChains();
1534 wxLogTrace(
traceSchNetChain,
"ERC TestPinToPin: cross-chain phase start chains=%zu",
1537 for(
const auto& sig : netChains )
1542 const wxString chainName = sig->GetName();
1543 const auto& sigNets = sig->GetNets();
1546 std::vector<ERC_SCH_PIN_CONTEXT> netChainPins;
1547 netChainPins.reserve( sigNets.size() * 4 );
1549 for(
const wxString& n : sigNets )
1551 auto it = netToPins.find( n );
1552 if( it != netToPins.end() )
1554 const auto& vec = it->second;
1555 netChainPins.insert( netChainPins.end(), vec.begin(), vec.end() );
1559 if( netChainPins.size() < 2 )
1563 "ERC TestPinToPin: chain '%s' nets=%zu collectedPins=%zu",
1564 TO_UTF8( chainName ), sigNets.size(), netChainPins.size() );
1567 std::sort( netChainPins.begin(), netChainPins.end(),
1570 int ret = StrNumCmp( lhs.Pin()->GetParentSymbol()->GetRef( &lhs.Sheet() ),
1571 rhs.Pin()->GetParentSymbol()->GetRef( &rhs.Sheet() ) );
1573 ret = StrNumCmp( lhs.Pin()->GetNumber(), rhs.Pin()->GetNumber() );
1580 std::unordered_map<SCH_PIN*, wxString> pinNet;
1581 for(
const auto& netEntry : netToPins )
1582 for(
const auto& ctx : netEntry.second )
1583 pinNet[ ctx.Pin() ] = netEntry.first;
1585 for(
size_t i = 0; i < netChainPins.size(); ++i )
1587 SCH_PIN* aPin = netChainPins[i].Pin();
1589 const wxString& aNet = pinNet[aPin];
1591 for(
size_t j = i + 1; j < netChainPins.size(); ++j )
1593 SCH_PIN* bPin = netChainPins[j].Pin();
1594 const wxString& bNet = pinNet[bPin];
1609 ercItem->SetItems( aPin, bPin );
1610 ercItem->SetSheetSpecificPath( netChainPins[i].Sheet() );
1611 ercItem->SetItemsSheetPaths( netChainPins[i].Sheet(), netChainPins[j].Sheet() );
1612 ercItem->SetErrorMessage( wxString::Format(
1613 _(
"Pins of type %s and %s are connected via net chain %s" ),
1618 netChainPins[i].Sheet().LastScreen()->Append( marker );
1634 std::unordered_map<wxString, std::pair<wxString, SCH_PIN*>> pinToNetMap;
1638 const wxString& netName = net.first.Name;
1649 if( !
pin->GetParentSymbol()->IsMultiUnit() )
1652 wxString
name =
pin->GetParentSymbol()->GetRef( &sheet ) +
":" +
pin->GetShownNumber();
1654 if( !pinToNetMap.count(
name ) )
1656 pinToNetMap[
name] = std::make_pair( netName,
pin );
1658 else if( pinToNetMap[
name].first != netName )
1662 ercItem->SetErrorMessage( wxString::Format(
_(
"Pin %s is connected to both %s and %s" ),
1663 pin->GetShownNumber(),
1665 pinToNetMap[
name].first ) );
1667 ercItem->SetItems(
pin, pinToNetMap[
name].second );
1668 ercItem->SetSheetSpecificPath( sheet );
1669 ercItem->SetItemsSheetPaths( sheet, sheet );
1703 std::vector<SCH_PIN*> pins = symbol->
GetPins( &sheet );
1705 std::map<wxString, std::vector<std::pair<SCH_PIN*, wxString>>> pinsByNumber;
1710 wxString netName = conn ? conn->
GetNetName() : wxString();
1712 pinsByNumber[
pin->GetNumber()].emplace_back(
pin, netName );
1715 for(
const auto& [pinNumber, pinNetPairs] : pinsByNumber )
1717 if( pinNetPairs.size() < 2 )
1720 wxString firstNet = pinNetPairs[0].second;
1721 bool hasDifferentNets =
false;
1722 SCH_PIN* conflictPin =
nullptr;
1724 for(
size_t i = 1; i < pinNetPairs.size(); i++ )
1726 if( pinNetPairs[i].second != firstNet )
1728 hasDifferentNets =
true;
1729 conflictPin = pinNetPairs[i].first;
1734 if( hasDifferentNets )
1739 msg.Printf(
_(
"Pin %s on symbol '%s' is connected to different nets: %s and %s" ),
1741 symbol->
GetRef( &sheet ),
1742 firstNet.IsEmpty() ?
_(
"<no net>" ) : firstNet,
1743 pinNetPairs[1].second.IsEmpty() ?
_(
"<no net>" ) : pinNetPairs[1].second );
1745 ercItem->SetErrorMessage( msg );
1746 ercItem->SetItems( pinNetPairs[0].first, conflictPin );
1747 ercItem->SetSheetSpecificPath( sheet );
1748 ercItem->SetItemsSheetPaths( sheet, sheet );
1751 pinNetPairs[0].first->GetPosition() );
1752 screen->
Append( marker );
1768 [](
const wxString& txt )
1770 wxString upper = txt.Upper();
1772 return upper.Contains( wxT(
"GND" ) )
1773 || upper == wxT(
"EARTH" ) || upper.StartsWith( wxT(
"EARTH_" ) )
1774 || upper == wxT(
"VSS" ) || upper == wxT(
"VSSA" );
1784 bool hasGroundNet =
false;
1785 std::vector<SCH_PIN*> mismatched;
1790 wxString net = conn ? conn->
GetNetName() : wxString();
1791 bool netIsGround = isGround( net );
1801 hasGroundNet =
true;
1803 if( isGround(
pin->GetShownName() ) && !netIsGround )
1804 mismatched.push_back(
pin );
1813 ercItem->SetErrorMessage( wxString::Format(
_(
"Pin %s not connected to ground net" ),
1814 pin->GetShownName() ) );
1815 ercItem->SetItems(
pin );
1816 ercItem->SetSheetSpecificPath( sheet );
1817 ercItem->SetItemsSheetPaths( sheet );
1820 screen->
Append( marker );
1846 pin->GetStackedPinNumbers( &valid );
1851 ercItem->SetItems(
pin );
1852 ercItem->SetSheetSpecificPath( sheet );
1853 ercItem->SetItemsSheetPaths( sheet );
1856 screen->
Append( marker );
1871 std::unordered_map<wxString, std::pair<SCH_ITEM*, SCH_SHEET_PATH>> globalLabels;
1872 std::unordered_map<wxString, std::pair<SCH_ITEM*, SCH_SHEET_PATH>> localLabels;
1887 auto& map = item->Type() ==
SCH_LABEL_T ? localLabels : globalLabels;
1889 if( !map.count(
text ) )
1891 map[
text] = std::make_pair( label, sheet );
1898 if( !
pin->IsPower() )
1907 ?
pin->GetShownName()
1908 : symbol->
GetValue(
true, &sheet,
false );
1910 auto& map =
pin->IsGlobalPower() ? globalLabels : localLabels;
1912 if( !map.count(
text ) )
1914 map[
text] = std::make_pair(
pin, sheet );
1921 for(
auto& [globalText, globalItem] : globalLabels )
1923 for(
auto& [localText, localItem] : localLabels )
1925 if( globalText == localText )
1935 ercItem->SetItems( globalItem.first, localItem.first );
1936 ercItem->SetSheetSpecificPath( globalItem.second );
1937 ercItem->SetItemsSheetPaths( globalItem.second, localItem.second );
1940 globalItem.second.LastScreen()->Append( marker );
1954 std::unordered_map<wxString, std::vector<std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>>> generalMap;
1958 const std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>& other )
1960 auto& [otherText, otherItem, otherSheet] = other;
1980 ercItem->SetItems( item, otherItem );
1981 ercItem->SetSheetSpecificPath( sheet );
1982 ercItem->SetItemsSheetPaths( sheet, otherSheet );
1985 sheet.LastScreen()->Append( marker );
1996 switch( item->Type() )
2003 wxString unnormalized = label->
GetShownText( &sheet,
false );
2004 wxString normalized = unnormalized.Lower();
2006 generalMap[normalized].emplace_back( std::make_tuple( unnormalized, label, sheet ) );
2008 for(
const auto& otherTuple : generalMap.at( normalized ) )
2010 const auto& [otherText, otherItem, otherSheet] = otherTuple;
2012 if( unnormalized != otherText )
2016 && sheet != otherSheet )
2021 logError( normalized, label, sheet, otherTuple );
2032 if( !
pin->IsPower() )
2036 wxString unnormalized = symbol->
GetValue(
true, &sheet,
false );
2037 wxString normalized = unnormalized.Lower();
2039 generalMap[normalized].emplace_back( std::make_tuple( unnormalized,
pin, sheet ) );
2041 for(
const auto& otherTuple : generalMap.at( normalized ) )
2043 const auto& [otherText, otherItem, otherSheet] = otherTuple;
2045 if( unnormalized != otherText )
2047 logError( normalized,
pin, sheet, otherTuple );
2077 std::vector<SCH_MARKER*> markers;
2084 if( !libSymbolInSchematic )
2089 std::optional<const LIBRARY_TABLE_ROW*> optRow =
2092 if( !optRow || ( *optRow )->Disabled() )
2097 ercItem->SetItems( symbol );
2098 msg.Printf(
_(
"The current configuration does not include the symbol library '%s'" ),
2100 ercItem->SetErrorMessage( msg );
2112 std::optional<wxString> uri =
2114 wxCHECK2( uri.has_value(), uri = wxEmptyString );
2115 ercItem->SetItems( symbol );
2116 msg.Printf(
_(
"The symbol library '%s' was not found at '%s'" ),
2118 ercItem->SetErrorMessage( msg );
2129 if( libSymbol ==
nullptr )
2134 ercItem->SetItems( symbol );
2135 msg.Printf(
_(
"Symbol '%s' not found in symbol library '%s'" ),
2138 ercItem->SetErrorMessage( msg );
2146 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
2155 std::vector<wxString> messages;
2163 if( messages.empty() && flattenedSymbol->Compare( *libSymbolInSchematic, flags ) != 0 )
2166 ercItem->SetItems( symbol );
2167 msg.Printf(
_(
"Symbol '%s' doesn't match copy in library '%s'" ),
2170 ercItem->SetErrorMessage( msg );
2179 screen->Append( marker );
2192 if( std::optional<LIBRARY_MANAGER_ADAPTER*> adapter =
2195 ( *adapter )->BlockUntilLoaded();
2201 typedef int (*TESTER_FN_PTR)(
const wxString&,
PROJECT* );
2207 std::vector<SCH_MARKER*> markers;
2214 if( footprint.IsEmpty() )
2219 if( fpID.
Parse( footprint,
true ) >= 0 )
2222 msg.Printf(
_(
"'%s' is not a valid footprint identifier" ), footprint );
2223 ercItem->SetErrorMessage( msg );
2224 ercItem->SetItems( symbol );
2231 int ret = (linkTester)( footprint, aProject );
2236 msg.Printf(
_(
"The current configuration does not include the footprint library '%s'" ),
2238 ercItem->SetErrorMessage( msg );
2239 ercItem->SetItems( symbol );
2245 msg.Printf(
_(
"The footprint library '%s' is not enabled in the current configuration" ),
2247 ercItem->SetErrorMessage( msg );
2248 ercItem->SetItems( symbol );
2254 msg.Printf(
_(
"Footprint '%s' not found in library '%s'" ),
2257 ercItem->SetErrorMessage( msg );
2258 ercItem->SetItems( symbol );
2265 sheet.LastScreen()->Append( marker );
2283 std::vector<SCH_MARKER*> markers;
2288 std::unique_ptr<LIB_SYMBOL>& lib_symbol = sch_symbol->
GetLibSymbolRef();
2293 wxArrayString filters = lib_symbol->GetFPFilters();
2295 if( filters.empty() )
2301 if( footprint.
Parse( lowerId ) > 0 )
2307 for( wxString
filter : filters )
2312 if(
filter.Contains( wxS(
":" ) ) )
2313 found |= lowerId.Matches(
filter );
2315 found |= lowerItemName.Matches(
filter );
2324 msg.Printf(
_(
"Assigned footprint (%s) doesn't match footprint filters (%s)" ),
2326 wxJoin( filters,
' ' ) );
2327 ercItem->SetErrorMessage( msg );
2328 ercItem->SetItems( sch_symbol );
2335 sheet.LastScreen()->Append( marker );
2346 const int gridSize =
m_schematic->Settings().m_ConnectionGridSize;
2351 std::vector<SCH_MARKER*> markers;
2353 for(
SCH_ITEM* item : screen->Items() )
2355 if( item->Type() ==
SCH_LINE_T && item->IsConnectable() )
2363 ercItem->SetItems( line );
2371 ercItem->SetItems( line );
2382 if( ( point.x % gridSize ) != 0
2383 || ( point.y % gridSize ) != 0 )
2386 ercItem->SetItems( entry );
2388 markers.emplace_back(
new SCH_MARKER( std::move( ercItem ), point ) );
2403 if( ( pinPos.
x % gridSize ) != 0 || ( pinPos.
y % gridSize ) != 0 )
2406 ercItem->SetItems(
pin );
2408 markers.emplace_back(
new SCH_MARKER( std::move( ercItem ), pinPos ) );
2417 screen->Append( marker );
2431 wxString variant =
m_schematic->GetCurrentVariant();
2435 if( sheet.GetExcludedFromSim( variant ) )
2438 std::vector<SCH_MARKER*> markers;
2456 wxString msg =
reporter.GetMessages();
2462 ercItem->SetErrorMessage( msg );
2463 ercItem->SetItems( symbol );
2471 sheet.LastScreen()->Append( marker );
2489 if( aProgressReporter )
2490 aProgressReporter->
AdvancePhase(
_(
"Checking sheet names..." ) );
2499 if( aProgressReporter )
2500 aProgressReporter->
AdvancePhase(
_(
"Checking pin maps..." ) );
2506 if( aProgressReporter )
2507 aProgressReporter->
AdvancePhase(
_(
"Checking conflicts..." ) );
2520 if( aProgressReporter )
2521 aProgressReporter->
AdvancePhase(
_(
"Checking units..." ) );
2526 if( aProgressReporter )
2527 aProgressReporter->
AdvancePhase(
_(
"Checking footprints..." ) );
2540 if( aProgressReporter )
2570 if( aProgressReporter )
2571 aProgressReporter->
AdvancePhase(
_(
"Checking similar labels..." ) );
2579 if( aProgressReporter )
2580 aProgressReporter->
AdvancePhase(
_(
"Checking local and global labels..." ) );
2587 if( aProgressReporter )
2588 aProgressReporter->
AdvancePhase(
_(
"Checking for unresolved variables..." ) );
2595 if( aProgressReporter )
2596 aProgressReporter->
AdvancePhase(
_(
"Checking field names..." ) );
2603 if( aProgressReporter )
2604 aProgressReporter->
AdvancePhase(
_(
"Checking SPICE models..." ) );
2611 if( aProgressReporter )
2612 aProgressReporter->
AdvancePhase(
_(
"Checking no connect pins for connections..." ) );
2620 if( aProgressReporter )
2621 aProgressReporter->
AdvancePhase(
_(
"Checking for library symbol issues..." ) );
2628 if( aProgressReporter )
2629 aProgressReporter->
AdvancePhase(
_(
"Checking for footprint link issues..." ) );
2636 if( aProgressReporter )
2637 aProgressReporter->
AdvancePhase(
_(
"Checking footprint assignments against footprint filters..." ) );
2644 if( aProgressReporter )
2645 aProgressReporter->
AdvancePhase(
_(
"Checking for off grid pins and wires..." ) );
2652 if( aProgressReporter )
2653 aProgressReporter->
AdvancePhase(
_(
"Checking for four way junctions..." ) );
2660 if( aProgressReporter )
2661 aProgressReporter->
AdvancePhase(
_(
"Checking for labels on more than one wire..." ) );
2668 if( aProgressReporter )
2669 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.
constexpr Vec Centre() const
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...
DS_DRAW_ITEM_BASE * GetFirst()
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.
DS_DRAW_ITEM_BASE * GetNext()
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.
virtual const wxString & GetText() const
Return the string associated with the text 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.
int TestLibSymbolIssues()
Test symbols for changed library symbols and broken symbol library links.
int TestStackedPinNotation()
Checks for pin numbers that resemble stacked pin notation but are invalid.
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 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.
int TestPinMap(KIFACE *aCvPcb, PROJECT *aProject)
Check pin-to-pad maps (issue #2282): stale pin references, duplicate pad targets, bad pads and unmapp...
int TestFieldNameWhitespace()
Check for field names with leading or trailing whitespace.
int TestDuplicatePinNets()
Checks if duplicate pin numbers within a symbol are connected to different nets.
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
int TestGroundPins()
Checks for ground-labeled pins not on a ground net while another pin is.
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.
bool IsLibraryLoaded(const wxString &aNickname)
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false)
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
std::optional< LIBRARY_TABLE_ROW * > GetRow(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH)
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.
wxString GetUniStringLibId() const
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< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
const std::vector< ASSOCIATED_FOOTPRINT > & GetEffectiveAssociatedFootprints() const
std::vector< SCH_PIN * > GetPins() const override
const PIN_MAP_SET & GetEffectivePinMaps() const
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
bool GetDuplicatePinNumbersAreJumpers() const
std::vector< std::set< wxString > > & JumperPinGroups()
Each jumper pin group is a set of pin numbers that should be treated as internally connected.
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
virtual LIBRARY_MANAGER & GetLibraryManager() const
A symbol-owned ordered set of named pin maps.
const std::vector< PIN_MAP > & GetAll() const
const PIN_MAP * FindByName(const wxString &aName) const
const std::vector< PIN_MAP_ENTRY > & GetEntries() const
const wxString & GetName() const
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.
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
Container for project specific data.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Class for a wire to bus entry.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString GetNetName() const
Schematic editor (Eeschema) main window.
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr)
Generate the connection data for the entire schematic hierarchy.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
Base class for any item which can be embedded within the SCHEMATIC container class,...
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
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 override
Test if aPt is an end point of this schematic object.
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
PAD_RESOLUTION
Outcome of pin-to-pad resolution (issue #2282).
VECTOR2I GetPosition() const override
bool IsStacked(const SCH_PIN *aPin) const
bool IsPower() const
Check if the pin is either a global or local power pin.
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()
Get the full RTree, usually for iterating.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
VECTOR2I GetPosition() const override
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()
Return a reference to the vector holding the sheet's fields.
VECTOR2I GetPosition() const override
std::vector< SCH_SHEET_PIN * > & GetPins()
wxString GetShownName(bool aAllowExtraText) const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
bool IsGlobalPower() const override
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, const wxString &aVariantName=wxEmptyString) const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, const wxString &aVariantName=wxEmptyString) const
VECTOR2I GetPosition() const override
const LIB_ID & GetLibId() const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
virtual wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
VECTOR2I GetPosition() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
const TRANSFORM & GetTransform() const
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
A wrapper for reporting to a wxString object.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
#define FOR_ERC_DRC
Expand '${var-name}' templates in text.
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_GROUND_PIN_NOT_GROUND
A ground-labeled pin is not on a ground net while another pin is.
@ ERCE_SIMILAR_LABELS
2 labels are equal for case insensitive comparisons.
@ ERCE_STACKED_PIN_SYNTAX
Pin name resembles stacked pin notation.
@ 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_SAME_LOCAL_GLOBAL_POWER
Local power port and global power port have the same name.
@ ERCE_PIN_MAP_BAD_PAD
Pin map references a pad absent from the footprint.
@ ERCE_FOOTPRINT_LINK_ISSUES
The footprint link is invalid, or points to a missing (or inactive) footprint or library.
@ ERCE_PIN_MAP_DUPLICATE_PAD
Two symbol pins map to one pad (not stacked/jumper).
@ 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_FIELD_NAME_WHITESPACE
Field name has leading or trailing whitespace.
@ ERCE_DUPLICATE_SHEET_NAME
Duplicate sheet names within a given sheet.
@ ERCE_PIN_MAP_STALE_PIN
Pin map references a pin number not on the symbol.
@ 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_PIN_MAP_UNMAPPED_PIN
A connected pin resolves to no footprint pad.
@ 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.
const wxChar *const traceSchNetChain
Flag to enable tracing of schematic net chain rebuild and ERC cross-chain checks.
@ KIFACE_TEST_FOOTPRINT_LINK_LIBRARY_NOT_ENABLED
@ KIFACE_TEST_FOOTPRINT_LINK
@ KIFACE_TEST_FOOTPRINT_LINK_NO_LIBRARY
@ KIFACE_TEST_FOOTPRINT_LINK_NO_FOOTPRINT
@ KIFACE_FOOTPRINT_PAD_NUMBERS
Function pointer type: void (*)( const wxString& aFootprint, PROJECT* aProject, std::set<wxString>& a...
PGM_BASE & Pgm()
The global program "get" accessor.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_TRISTATE
tri 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_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE)
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
wxString UnescapeString(const wxString &aSource)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Implement a participant in the KIWAY alchemy.
virtual void * IfaceOrAddress(int aDataId)=0
Return pointer to the requested object.
One symbol-pin to footprint-pad mapping inside a PIN_MAP.
IbisParser parser & reporter
wxLogTrace helper definitions.
VECTOR2< int32_t > VECTOR2I