54#include <wx/stattext.h>
98 std::shared_ptr<NET_CONTEXT_MENU> netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
99 netSubMenu->SetTool(
this );
102 auto showNetMenuFunc =
105 if( aSelection.Empty() )
108 for(
const EDA_ITEM* item : aSelection )
110 switch( item->Type() )
121 if( !
static_cast<const PCB_SHAPE*
>( item )->IsOnCopperLayer() )
139 menu.
AddMenu( netSubMenu.get(), showNetMenuFunc, 100 );
160 bool* aCourtyardError )
162 auto engine = std::make_unique<DRC_ENGINE>(
m_frame->GetBoard(),
163 &
m_frame->GetBoard()->GetDesignSettings() );
167 engine->InitEngine(
m_frame->GetDesignRulesPath() );
172 *aCompileError =
true;
176 zone->CacheBoundingBox();
181 zone->CacheBoundingBox();
186 *aCourtyardError =
true;
213 + wxString::Format(
_(
"[netclass %s]" ),
224 std::vector<BOARD_ITEM*> toAdd;
226 for(
int i = 0; i < aCollector.
GetCount(); ++i )
232 group->RunOnChildren(
241 toAdd.push_back( child );
247 if(
pad->HitTest( aPos ) )
248 toAdd.push_back(
pad );
257 aCollector.
Append( item );
259 bool hasPadOrTrack =
false;
261 for(
int i = 0; i < aCollector.
GetCount(); ++i )
263 KICAD_T type = aCollector[i]->Type();
268 hasPadOrTrack =
true;
273 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
290 const wxString& aPrompt,
291 const std::vector<KICAD_T>& aTypes,
301 statusPopup.SetText( aPrompt );
304 picker->SetSnapping(
false );
305 picker->ClearHandlers();
307 picker->SetClickHandler(
308 [&](
const VECTOR2D& aPoint ) ->
bool
317 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
331 pickedItem = collector[0];
337 picker->SetMotionHandler(
347 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
360 if( highlightedItem != item )
362 if( highlightedItem && highlightedItem != aLockedHighlight )
365 highlightedItem = item;
367 if( highlightedItem && highlightedItem != aLockedHighlight )
372 picker->SetCancelHandler(
375 if( highlightedItem && highlightedItem != aLockedHighlight )
378 highlightedItem =
nullptr;
383 picker->SetFinalizeHandler(
384 [&](
const int& aFinalState )
386 if( highlightedItem && highlightedItem != aLockedHighlight )
389 highlightedItem =
nullptr;
397 m_frame->GetCanvas()->SetStatusPopup( statusPopup.GetPanel() );
401 while( !done && !pickedItem )
409 picker->ClearHandlers();
410 m_frame->GetCanvas()->SetStatusPopup(
nullptr );
419 r->
Report(
_(
"Report incomplete: could not compile custom design rules." )
420 + wxS(
" " )
421 + wxS(
"<a href='$CUSTOM_RULES'>" ) +
_(
"Show design rules." ) + wxS(
"</a>" ) );
444 wxString layerStr =
_(
"Layer" ) + wxS(
" " ) +
m_frame->GetBoard()->GetLayerName( aLayer );
455class VECTOR_REPORTER :
public REPORTER
460 m_messages.push_back( aText );
464 bool HasMessage()
const override {
return !m_messages.empty(); }
467 std::vector<wxString> m_messages;
477 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
486 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
495 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
529 return wxEmptyString;
537 wxCHECK( drcTool &&
m_frame, );
558 bool compileError =
false;
559 bool courtyardError =
false;
560 std::unique_ptr<DRC_ENGINE> drcEngine =
makeDRCEngine( &compileError, &courtyardError );
565 wxString clearanceStr;
567 switch( aDRCItem->GetErrorCode() )
571 for(
KIID id : aDRCItem->GetIDs() )
580 reportHeader(
_(
"Diff pair uncoupled length resolution for:" ), ac, bc, r );
588 r->
Report( wxString::Format(
_(
"Resolved max uncoupled length: %s." ),
603 r->
Report( wxString::Format(
_(
"Resolved height constraints: min %s; max %s." ),
618 r->
Report( wxString::Format(
_(
"Resolved thickness constraints: min %s; max %s." ),
633 r->
Report( wxString::Format(
_(
"Resolved width constraints: min %s; max %s." ),
648 r->
Report( wxString::Format(
_(
"Resolved angle constraints: min %s; max %s." ),
655 reportHeader(
_(
"Track segment length resolution for:" ), a, r );
663 r->
Report( wxString::Format(
_(
"Resolved segment length constraints: min %s; max %s." ),
670 reportHeader(
_(
"Connection width resolution for:" ), a, b, r );
678 r->
Report( wxString::Format(
_(
"Resolved min connection width: %s." ),
692 r->
Report( wxString::Format(
_(
"Resolved diameter constraints: min %s; max %s." ),
699 reportHeader(
_(
"Via annular width resolution for:" ), a, r );
707 r->
Report( wxString::Format(
_(
"Resolved annular width constraints: min %s; max %s." ),
723 r->
Report( wxString::Format(
_(
"Resolved hole size constraints: min %s; max %s." ),
730 reportHeader(
_(
"Hole clearance resolution for:" ), a, b, r );
738 r->
Report(
_(
"Items belong to the same net. Clearance is 0." ) );
747 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
753 reportHeader(
_(
"Physical hole clearance resolution for:" ), a, b, layer, r );
762 r->
Report(
_(
"No 'physical_hole_clearance' constraints defined." ) );
767 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
774 reportHeader(
_(
"Hole-to-hole clearance resolution for:" ), a, b, r );
784 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
789 reportHeader(
_(
"Edge clearance resolution for:" ), a, b, r );
799 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
833 reportHeader(
_(
"Clearance resolution for:" ), a, b, layer, r );
841 r->
Report(
_(
"Items belong to the same net. Clearance is 0." ) );
850 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
856 reportHeader(
_(
"Physical clearance resolution for:" ), a, b, layer, r );
865 r->
Report(
_(
"No 'physical_clearance' constraints defined." ) );
870 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ), clearanceStr ) );
882 drcEngine->ProcessAssertions( a, [](
const DRC_CONSTRAINT* c ){}, r );
892 dialog->
Show(
true );
902 wxCHECK( selTool, 0 );
910 if( !
selection.GetItem( 0 )->IsBOARD_ITEM() || !
selection.GetItem( 1 )->IsBOARD_ITEM() )
925 static const std::vector<KICAD_T> clearanceTypes = {
941 _(
"Select first item for clearance resolution..." ),
942 clearanceTypes,
nullptr );
952 _(
"Select second item for clearance resolution..." ),
953 clearanceTypes, firstItem );
960 if( firstItem == secondItem )
962 m_frame->ShowInfoBarError(
_(
"Select two different items for clearance resolution." ) );
974 wxCHECK(
m_frame && aItemA && aItemB, );
985 m_frame->ShowInfoBarError(
_(
"Cannot generate clearance report on empty group." ) );
998 m_frame->ShowInfoBarError(
_(
"Cannot generate clearance report on empty group." ) );
1008 auto checkFootprint =
1011 PAD* foundPad =
nullptr;
1015 if( !foundPad ||
pad->SameLogicalPadAs( foundPad ) )
1028 a = checkFootprint(
static_cast<FOOTPRINT*
>( a ) );
1031 b = checkFootprint(
static_cast<FOOTPRINT*
>( b ) );
1053 ZONE* zone =
dynamic_cast<ZONE*
>( a );
1060 bool compileError =
false;
1061 bool courtyardError =
false;
1062 std::unique_ptr<DRC_ENGINE> drcEngine =
makeDRCEngine( &compileError, &courtyardError );
1064 if( copperIntersection.any() && zone &&
pad && zone->
GetNetCode() ==
pad->GetNetCode() )
1074 reportHeader(
_(
"Zone connection resolution for:" ), a, b, layer, r );
1076 constraint = drcEngine->EvalZoneConnection(
pad, zone, layer, r );
1082 reportHeader(
_(
"Thermal-relief gap resolution for:" ), a, b, layer, r );
1091 r->
Report( wxString::Format(
_(
"Resolved thermal relief gap: %s." ),
1092 m_frame->StringFromValue( gap,
true ) ) );
1096 reportHeader(
_(
"Thermal-relief spoke width resolution for:" ), a, b, layer, r );
1105 r->
Report( wxString::Format(
_(
"Resolved spoke width: %s." ),
1106 m_frame->StringFromValue( width,
true ) ) );
1110 reportHeader(
_(
"Thermal-relief min spoke count resolution for:" ), a, b, layer, r );
1119 r->
Report( wxString::Format(
_(
"Resolved min spoke count: %d." ),
1122 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
pad->GetBoard()->GetConnectivity();
1128 reportHeader(
_(
"Zone clearance resolution for:" ), a, b, layer, r );
1132 r->
Report( wxString::Format(
_(
"Zone clearance: %s." ),
1142 r->
Report( wxString::Format(
_(
"Overridden by larger physical clearance from %s;"
1148 if( !
pad->FlashLayer( layer ) )
1158 r->
Report( wxString::Format(
_(
"Overridden by larger physical hole clearance "
1159 "from %s; clearance: %s." ),
1169 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1176 reportHeader(
_(
"Zone clearance resolution for:" ), a, b, layer, r );
1182 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1183 m_frame->StringFromValue( 0,
true ) ) );
1188 else if( copperIntersection.any() && !aFP && !bFP )
1192 std::vector<PCB_LAYER_ID> layers;
1194 if( copperIntersection.test( active ) )
1195 layers.push_back( active );
1199 if( layer != active )
1200 layers.push_back( layer );
1205 reportHeader(
_(
"Clearance resolution for:" ), a, b, layer, rep );
1209 rep->Report(
_(
"Items belong to the same net. Min clearance is 0." ) );
1221 if( constraint.
IsNull() )
1223 rep->Report(
_(
"Min clearance is 0." ) );
1227 rep->Report( wxString::Format(
_(
"Resolved clearance: %s; clearance will "
1233 rep->Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1238 if( layers.size() == 1 )
1243 fillReport( layer, r );
1248 auto perLayerMessages = std::make_shared<std::vector<std::vector<wxString>>>();
1249 perLayerMessages->reserve( layers.size() );
1253 VECTOR_REPORTER tmp;
1254 fillReport( layer, &tmp );
1255 perLayerMessages->push_back( std::move( tmp.m_messages ) );
1259 wxBoxSizer* vbox =
new wxBoxSizer( wxVERTICAL );
1261 wxChoice* choice =
new wxChoice( panel, wxID_ANY );
1264 choice->Append(
m_frame->GetBoard()->GetLayerName( layer ) );
1266 choice->SetSelection( 0 );
1269 wxHW_SCROLLBAR_AUTO | wxBORDER_SIMPLE );
1272 wxStaticText* layerLabel =
new wxStaticText( panel, wxID_ANY,
_(
"Layer:" ) );
1274 vbox->Add( layerLabel, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
1275 vbox->Add( choice, 0, wxEXPAND | wxALL, 5 );
1276 vbox->Add( reportBox, 1, wxEXPAND | wxALL, 5 );
1277 panel->SetSizer( vbox );
1280 auto refresh = [reportBox, perLayerMessages](
int sel )
1284 if( sel >= 0 && sel < (
int) perLayerMessages->size() )
1286 for(
const wxString& line : ( *perLayerMessages )[sel] )
1287 reportBox->
Report( line );
1293 choice->Bind( wxEVT_CHOICE,
1294 [
refresh]( wxCommandEvent& evt )
1296 refresh( evt.GetSelection() );
1306 wxString coupledNet;
1315 if( !dpIntersection.test( dpLayer ) && dpIntersection.any() )
1316 dpLayer = dpIntersection.
Seq().front();
1319 reportHeader(
_(
"Diff-pair gap resolution for:" ), ac, bc, dpLayer, r );
1324 r->
Report( wxString::Format(
_(
"Resolved gap constraints: min %s; opt %s; max %s." ),
1332 reportHeader(
_(
"Diff-pair max uncoupled length resolution for:" ), ac, bc, dpLayer, r );
1337 r->
Report(
_(
"No 'diff_pair_uncoupled' constraints defined." ) );
1344 r->
Report( wxString::Format(
_(
"Resolved max uncoupled length: %s." ),
1352 auto isOnCorrespondingLayer=
1364 if( aItem->
IsOnLayer( correspondingMask ) )
1367 if( aItem->
IsTented( correspondingMask ) && aItem->
IsOnLayer( correspondingCopper ) )
1369 *aWarning = wxString::Format(
_(
"Note: %s is tented; clearance will only be "
1370 "applied to holes." ),
1382 if( ( a->
IsOnLayer( layer ) && isOnCorrespondingLayer( b, layer, &warning ) )
1383 || ( b->
IsOnLayer( layer ) && isOnCorrespondingLayer( a, layer, &warning ) ) )
1386 reportHeader(
_(
"Silkscreen clearance resolution for:" ), a, b, layer, r );
1396 if( !warning.IsEmpty() )
1399 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1411 if( aCourtyard && bCourtyard )
1414 reportHeader(
_(
"Courtyard clearance resolution for:" ), a, b, layer, r );
1423 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1433 bool pageAdded =
false;
1449 reportHeader(
_(
"Hole clearance resolution for:" ), a, b, layer, r );
1458 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1478 reportHeader(
_(
"Hole-to-hole clearance resolution for:" ), a, b, r );
1487 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1515 wxString layerName =
m_frame->GetBoard()->GetLayerName( edgeLayer );
1516 r = dialog->
AddHTMLPage( layerName + wxS(
" " ) +
_(
"Clearance" ) );
1517 reportHeader(
_(
"Edge clearance resolution for:" ), a, b, layer, r );
1526 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1542 r->
Report(
_(
"No 'physical_clearance' constraints defined." ) );
1546 LSET reportLayers = layerIntersection;
1547 bool reported =
false;
1553 reportLayers |= edgeInteractingLayers;
1560 reportLayers |= edgeInteractingLayers;
1566 reportHeader(
_(
"Physical clearance resolution for:" ), a, b, layer, r );
1571 if( constraint.
IsNull() )
1574 r->
Report( wxString::Format(
_(
"No 'physical_clearance' constraints in effect on %s." ),
1575 m_frame->GetBoard()->GetLayerName( layer ) ) );
1580 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1591 reportHeader(
_(
"Physical clearance resolution for:" ), a, b, r );
1593 r->
Report(
_(
"Items share no relevant layers. No 'physical_clearance' constraints will "
1611 reportHeader(
_(
"Physical hole clearance resolution for:" ), a, b, layer, r );
1623 r->
Report(
_(
"No 'physical_hole_clearance' constraints defined." ) );
1628 r->
Report( wxString::Format(
_(
"Resolved min clearance: %s." ),
1636 dialog->
Show(
true );
1642#define EVAL_RULES( constraint, a, b, layer, r ) drcEngine->EvalRules( constraint, a, b, layer, r )
1648 wxCHECK( selTool, 0 );
1659 static const std::vector<KICAD_T> constraintTypes = {
1676 constraintTypes,
nullptr );
1683 m_frame->ShowInfoBarError(
_(
"Select a single item for a constraints resolution report." ) );
1689 wxCHECK( dialog, 0 );
1694 bool compileError =
false;
1695 bool courtyardError =
false;
1696 std::unique_ptr<DRC_ENGINE> drcEngine =
makeDRCEngine( &compileError, &courtyardError );
1703 reportHeader(
_(
"Track width resolution for:" ), item, r );
1711 r->
Report( wxString::Format(
_(
"Resolved width constraints: min %s; opt %s; max %s." ),
1722 reportHeader(
_(
"Via diameter resolution for:" ), item, r );
1731 r->
Report( wxString::Format(
_(
"Resolved diameter constraints: min %s; opt %s; max %s." ),
1739 reportHeader(
_(
"Via annular width resolution for:" ), item, r );
1748 r->
Report( wxString::Format(
_(
"Resolved annular width constraints: min %s; opt %s; max %s." ),
1768 r->
Report( wxString::Format(
_(
"Resolved hole size constraints: min %s; opt %s; max %s." ),
1779 reportHeader(
_(
"Solder mask expansion resolution for:" ), item, r );
1787 r->
Report( wxString::Format(
_(
"Resolved solder mask expansion: %s." ),
1796 reportHeader(
_(
"Solder paste absolute clearance resolution for:" ), item, r );
1804 r->
Report( wxString::Format(
_(
"Resolved solder paste absolute clearance: %s." ),
1807 reportHeader(
_(
"Solder paste relative clearance resolution for:" ), item, r );
1817 r->
Report( wxString::Format(
_(
"Resolved solder paste relative clearance: %s." ),
1826 reportHeader(
_(
"Text height resolution for:" ), item, r );
1834 r->
Report( wxString::Format(
_(
"Resolved height constraints: min %s; opt %s; max %s." ),
1842 reportHeader(
_(
"Text thickness resolution for:" ), item, r );
1850 r->
Report( wxString::Format(
_(
"Resolved thickness constraints: min %s; opt %s; max %s." ),
1866 if( courtyardError )
1869 r->
Report(
_(
"Report may be incomplete: some footprint courtyards are malformed." )
1870 + wxS(
" " )
1871 + wxS(
"<a href='$DRC'>" ) +
_(
"Run DRC for a full analysis." )
1878 r->
Report(
_(
"Item <b>disallowed</b> at current location." ) );
1880 r->
Report(
_(
"Item allowed at current location." ) );
1890 if( courtyardError )
1893 r->
Report(
_(
"Report may be incomplete: some footprint courtyards are malformed." )
1894 + wxS(
" " )
1895 + wxS(
"<a href='$DRC'>" ) +
_(
"Run DRC for a full analysis." )
1899 drcEngine->ProcessAssertions( item, [](
const DRC_CONSTRAINT* c ){}, r );
1903 dialog->
Show(
true );
1914 wxCHECK( selTool, 0 );
1920 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1925 aCollector.
Remove( item );
1932 m_frame->ShowInfoBarError(
_(
"Select a footprint to diff with its library equivalent." ) );
1944 wxCHECK( selTool, 0 );
1950 m_frame->ShowInfoBarError(
_(
"Select a footprint for a footprint associations report." ) );
1978 r->
Report( wxS(
"<h7>" ) +
_(
"Board vs library diff for:" ) + wxS(
"</h7>" ) );
1980 + wxS(
"<li>" ) +
_(
"Library: " ) +
EscapeHTML( libName ) + wxS(
"</li>" )
1981 + wxS(
"<li>" ) +
_(
"Library item: " ) +
EscapeHTML( fpName ) + wxS(
"</li></ul>" ) );
1990 r->
Report(
_(
"The library is not included in the current configuration." )
1991 + wxS(
"  " )
1992 + wxS(
"<a href='$CONFIG'>" ) +
_(
"Manage Footprint Libraries" )
1996 else if( !adapter->
HasLibrary( libName,
true ) )
1998 r->
Report(
_(
"The library is not enabled in the current configuration." )
1999 + wxS(
"  " )
2000 + wxS(
"<a href='$CONFIG'>" ) +
_(
"Manage Footprint Libraries" )
2006 std::shared_ptr<FOOTPRINT> libFootprint;
2010 libFootprint.reset( adapter->
LoadFootprint( libName, fpName,
true ) );
2018 r->
Report( wxString::Format(
_(
"The library no longer contains the item %s." ),
2024 r->
Report(
_(
"No relevant differences detected." ) );
2040 dialog->
Show(
true );
2046 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
2050 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
2051 aParentPanel->SetSizer( sizer );
2052 aParentPanel->Layout();
2062 m_frame->m_ProbingSchToPcb =
true;
2069 m_frame->m_ProbingSchToPcb =
false;
2071 bool request3DviewRedraw =
frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh;
2074 request3DviewRedraw =
false;
2077 if( request3DviewRedraw )
2078 m_frame->Update3DView(
false,
true );
2091 bool enableHighlight =
false;
2096 std::set<int> netcodes;
2101 netcodes.insert( ci->GetNetCode() );
2104 enableHighlight = !netcodes.empty();
2106 if( enableHighlight && netcodes.size() > 1 )
2111 board->ResetNetHighLight();
2113 for(
int multiNet : netcodes )
2114 board->SetHighLightNet( multiNet,
true );
2116 board->HighLightON();
2117 m_toolMgr->GetView()->UpdateAllLayersColor();
2121 else if( enableHighlight )
2123 net = *netcodes.begin();
2148 bool saved =
filter.lockedItems;
2149 filter.lockedItems =
true;
2153 filter.lockedItems = saved;
2161 for(
int i = collector.
GetCount() - 1; i >= 0; i-- )
2163 LSET itemLayers = collector[i]->GetLayerSet();
2166 ( highContrast && !itemLayers.
Contains( contrastLayer ) ) )
2173 enableHighlight = ( collector.
GetCount() > 0 );
2176 if( enableHighlight )
2181 m_frame->SendCrossProbeItem( targetItem );
2189 if( !aUseSelection && net >= 0 && netcodes.size() == 1 && netcodes.contains( net ) && settings->
IsHighlightEnabled() )
2195 wxString sig = netinfo->GetNetChain();
2196 if( !sig.IsEmpty() )
2200 if( n->GetNetChain() == sig )
2205 std::set<int> sigCodes;
2209 if( n->GetNetChain() == sig )
2210 sigCodes.insert( n->GetNetCode() );
2213 m_toolMgr->GetView()->UpdateAllLayersColor();
2217 board2->ResetNetHighLight();
2218 for(
int c : sigCodes )
2219 board2->SetHighLightNet( c,
true );
2220 board2->HighLightON();
2223 pcbSettings->SetHighlightedNetChain( sig );
2233 else if( !aUseSelection && netcodes.size() == 1 && netcodes.contains( net ) )
2240 if( !netcodes.empty() )
2244 m_toolMgr->GetView()->UpdateAllLayersColor();
2248 if( enableHighlight && net >= 0 )
2251 board->SetHighLightNet( net );
2252 board->HighLightON();
2258 std::vector<MSG_PANEL_ITEM> items;
2260 m_frame->SetMsgPanel( items );
2267 board->ResetNetHighLight();
2269 m_frame->SendCrossProbeNetName(
"" );
2280 const std::set<int>& highlighted = settings->GetHighlightNetCodes();
2285 settings->SetHighlight(
true, netcode );
2286 m_toolMgr->GetView()->UpdateAllLayersColor();
2295 wxString sig = net->GetNetChain();
2296 if( !sig.IsEmpty() )
2300 if( n->GetNetChain() == sig )
2302 bool alreadyHighlighted = highlighted.count( netcode );
2303 if( count > 1 && alreadyHighlighted )
2322 std::set<int> temp = highlighted;
2324 m_toolMgr->GetView()->UpdateAllLayersColor();
2332 m_toolMgr->GetView()->UpdateAllLayersColor();
2357 item =
static_cast<BOARD_ITEM*
>( collector[0] );
2365 if(
auto pad =
dynamic_cast<PAD*
>( item ) )
2366 net =
pad->GetNet();
2382 m_toolMgr->GetView()->UpdateAllLayersColor();
2384 pcbSettings->SetHighlightedNetChain( wxString() );
2394 m_toolMgr->GetView()->UpdateAllLayersColor();
2396 pcbSettings->SetHighlightedNetChain( wxString() );
2408 sig = net->GetNetChain();
2414 pcbSettings->SetHighlightedNetChain( sig );
2416 std::set<int> codes;
2417 if( !sig.IsEmpty() )
2421 if( net->GetNetChain() == sig )
2422 codes.insert( net->GetNetCode() );
2427 m_toolMgr->GetView()->UpdateAllLayersColor();
2440 auto ids = aEvent.
Parameter<std::pair<wxString, wxString>>();
2441 KIID oldId( ids.first );
2442 KIID newId( ids.second );
2456 board->ResetNetHighLight();
2460 pcbSettings->SetHighlightedNetChain( wxString() );
2461 m_toolMgr->GetView()->UpdateAllLayersColor();
2463 m_frame->SendCrossProbeNetName(
"" );
2480 [
this](
const VECTOR2D& pt ) ->
bool
2486 EDIT_TOOL::PadFilter );
2493 EDIT_TOOL::FootprintFilter );
2502 for(
PAD*
pad : fp->Pads() )
2512 pad->SetLocalRatsnestVisible( !
pad->GetLocalRatsnestVisible() );
2516 if( !fp->Pads().empty() )
2518 bool enable = !fp->Pads()[0]->GetLocalRatsnestVisible();
2520 for(
PAD* childPad : fp->Pads() )
2521 childPad->SetLocalRatsnestVisible( enable );
2533 [
this](
int aCondition )
2539 for(
PAD*
pad : fp->Pads() )
2563 auto&
selection = selectionTool->GetSelection();
2568 connectivity->ClearLocalRatsnest();
2596 std::vector<BOARD_ITEM*> items;
2599 for( std::size_t i = 0; i < queued_items.size(); ++i )
2601 if( !queued_items[i]->IsBOARD_ITEM() )
2606 wxCHECK2( item,
continue );
2613 items.push_back(
pad );
2620 queued_items.push_back( aItem );
2626 if( boardItem->GetLocalRatsnestVisible() ||
displayOptions().m_ShowModuleRatsnest )
2627 items.push_back( boardItem );
2631 if( items.empty() || std::none_of( items.begin(), items.end(),
2634 return( aItem->Type() == PCB_TRACE_T
2635 || aItem->Type() == PCB_PAD_T
2636 || aItem->Type() == PCB_ARC_T
2637 || aItem->Type() == PCB_ZONE_T
2638 || aItem->Type() == PCB_FOOTPRINT_T
2639 || aItem->Type() == PCB_VIA_T
2640 || aItem->Type() == PCB_SHAPE_T );
2649 connectivity->BlockRatsnestItems( items );
2677 m_toolMgr->GetView()->GetPainter()->GetSettings() );
2682 if( aNetCode <= 0 && !
selection.Empty() )
2688 if( bci->GetNetCode() > 0 )
2701 if( !
m_frame->GetAppearancePanel()->IsTogglingNetclassRatsnestVisibility() )
2703 m_frame->GetCanvas()->RedrawRatsnest();
2704 m_frame->GetCanvas()->Refresh();
2706 m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide );
std::function< void(const VECTOR2I &, GENERAL_COLLECTOR &, PCB_SELECTION_TOOL *)> CLIENT_SELECTION_FILTER
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION pickerTool
static TOOL_ACTION selectionClear
Clear the current selection.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
wxString GetNetname() const
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsTented(PCB_LAYER_ID aLayer) const
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
virtual bool HasDrilledHole() const
virtual bool IsOnCopperLayer() const
virtual bool HasHole() const
Information pertinent to a Pcbnew printed circuit board.
PROJECT * GetProject() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
int GetCount() const
Return the number of objects in the list.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Dialog to show common board info.
wxPanel * AddBlankPage(const wxString &aTitle)
WX_HTML_REPORT_BOX * AddHTMLPage(const wxString &aTitle)
void SetUserItemID(const KIID &aID)
bool Show(bool show) override
ZONE_CONNECTION m_ZoneConnection
static int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet, wxString &aBaseDpName)
Check if the given net is a diff pair, returning its polarity and complement if so.
std::unordered_set< EDA_ITEM * > & GetItems()
A base class for most all the KiCad significant classes used in schematics and boards.
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
KICAD_T Type() const
Returns the type of object.
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
A general implementation of a COLLECTORS_GUIDE.
void SetIgnoreZoneFills(bool ignore)
void SetPreferredLayer(PCB_LAYER_ID aLayer)
void SetIgnoreNoNets(bool ignore)
Used when the right click button is pressed, or when the select tool is in effect.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
std::set< int > & GetHiddenNets()
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool IsHighlightEnabled() const
Return current highlight setting.
bool GetHighContrast() const
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual int GetTopLayer() const
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
A logical library item identifier and consists of various portions much like a URI.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
const wxString GetHumanReadableName() const
Gets the consolidated name of this netclass (which may be an aggregate).
Handle the data for a net.
const wxString & GetNetChain() const
const wxString & GetNetname() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Return the information about the NETINFO_ITEM in aList to display in the message panel.
const VECTOR2I & GetDrillSize() const
PAD_ATTRIB GetAttribute() const
static TOOL_ACTION highlightItem
static TOOL_ACTION toggleNetHighlight
static TOOL_ACTION setTerminalPad
static TOOL_ACTION highlightNet
static TOOL_ACTION hideNetInRatsnest
static TOOL_ACTION hideLocalRatsnest
static TOOL_ACTION showNetInRatsnest
static TOOL_ACTION highlightNetChain
static TOOL_ACTION toggleLastNetHighlight
static TOOL_ACTION inspectConstraints
static TOOL_ACTION clearHighlight
static TOOL_ACTION inspectClearance
static TOOL_ACTION updateLocalRatsnest
static TOOL_ACTION diffFootprint
static TOOL_ACTION showFootprintAssociations
static TOOL_ACTION highlightNetSelection
static TOOL_ACTION boardStatistics
static TOOL_ACTION localRatsnestTool
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
A set of BOARD_ITEMs (i.e., without duplicates).
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
Container for project specific data.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
A slimmed down version of WX_HTML_REPORT_PANEL.
void Clear() override
Delete the stored messages.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void SetUnits(EDA_UNITS aUnits)
void Flush()
Build the HTML messages page.
Handle a list of polygons defining a copper zone.
std::optional< int > GetLocalClearance() const override
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_TRACK_SEGMENT_LENGTH
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
@ DRCE_MICROVIA_DRILL_OUT_OF_RANGE
@ DRCE_LIB_FOOTPRINT_MISMATCH
@ ANNULAR_WIDTH_CONSTRAINT
@ COURTYARD_CLEARANCE_CONSTRAINT
@ VIA_DIAMETER_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
@ SILK_CLEARANCE_CONSTRAINT
@ EDGE_CLEARANCE_CONSTRAINT
@ MIN_RESOLVED_SPOKES_CONSTRAINT
@ TRACK_SEGMENT_LENGTH_CONSTRAINT
@ TEXT_THICKNESS_CONSTRAINT
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
@ THERMAL_SPOKE_WIDTH_CONSTRAINT
@ CONNECTION_WIDTH_CONSTRAINT
@ THERMAL_RELIEF_GAP_CONSTRAINT
@ MAX_UNCOUPLED_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ SOLDER_PASTE_ABS_MARGIN_CONSTRAINT
@ SOLDER_MASK_EXPANSION_CONSTRAINT
@ PHYSICAL_CLEARANCE_CONSTRAINT
@ SOLDER_PASTE_REL_MARGIN_CONSTRAINT
@ HOLE_TO_HOLE_CONSTRAINT
#define MALFORMED_COURTYARDS
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
@ TARGET_OVERLAY
Items that may change while the view stays the same (noncached)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
Class to handle a set of BOARD_ITEMs.
std::vector< FAB_LAYER_COLOR > dummy
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
A filename or source description, a problem input line, a line number, a byte offset,...
This file contains data structures that are saved in the project file or project local settings file ...
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.