80 std::shared_ptr<NET_CONTEXT_MENU> netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
81 netSubMenu->SetTool(
this );
101 m_frame = getEditFrame<PCB_EDIT_FRAME>();
124 *aCompileError =
true;
128 zone->CacheBoundingBox();
133 zone->CacheBoundingBox();
138 *aCourtyardError =
true;
175 r->
Report(
_(
"Report incomplete: could not compile custom design rules. " )
176 + wxT(
"<a href='boardsetup'>" ) +
_(
"Show design rules." ) + wxT(
"</a>" ) );
213 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
222 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
231 return wxT(
"<i>" ) +
_(
"undefined" ) + wxT(
"</i>" );
254 bool compileError =
false;
258 wxString clearanceStr;
260 switch( aDRCItem->GetErrorCode() )
264 for(
KIID id : aDRCItem->GetIDs() )
273 reportHeader(
_(
"Diff pair uncoupled length resolution for:" ), ac, bc, r );
333 reportHeader(
_(
"Connection width resolution for:" ), a, b, r );
362 reportHeader(
_(
"Via annular width resolution for:" ), a, r );
393 reportHeader(
_(
"Hole clearance resolution for:" ), a, b, r );
401 r->
Report(
_(
"Items belong to the same net. Clearance is 0." ) );
416 reportHeader(
_(
"Physical hole clearance resolution for:" ), a, b, layer, r );
425 r->
Report(
_(
"No 'physical_hole_clearance' constraints defined." ) );
437 reportHeader(
_(
"Hole to hole clearance resolution for:" ), a, b, r );
452 reportHeader(
_(
"Edge clearance resolution for:" ), a, b, r );
494 reportHeader(
_(
"Clearance resolution for:" ), a, b, layer, r );
502 r->
Report(
_(
"Items belong to the same net. Clearance is 0." ) );
517 reportHeader(
_(
"Physical clearance resolution for:" ), a, b, layer, r );
526 r->
Report(
_(
"No 'physical_clearance' constraints defined." ) );
561 wxCHECK( a && b, 0 );
590 wxCHECK( a && b, 0 );
615 ZONE* zone =
dynamic_cast<ZONE*
>( a );
620 bool compileError =
false;
625 if( copperIntersection.any() && zone &&
pad && zone->
GetNetCode() ==
pad->GetNetCode() )
635 reportHeader(
_(
"Zone connection resolution for:" ), a, b, layer, r );
643 reportHeader(
_(
"Thermal relief gap resolution for:" ), a, b, layer, r );
657 reportHeader(
_(
"Spoke width resolution for:" ), a, b, layer, r );
671 reportHeader(
_(
"Spoke count resolution for:" ), a, b, layer, r );
683 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
pad->GetBoard()->GetConnectivity();
689 reportHeader(
_(
"Zone clearance resolution for:" ), a, b, layer, r );
709 if( !
pad->FlashLayer( layer ) )
737 reportHeader(
_(
"Zone clearance resolution for:" ), a, b, layer, r );
750 else if( copperIntersection.any() && !aFP && !bFP )
754 if( !copperIntersection.test( layer ) )
755 layer = copperIntersection.
Seq().front();
758 reportHeader(
_(
"Clearance resolution for:" ), a, b, layer, r );
763 r->
Report(
_(
"Items belong to the same net. Clearance is 0." ) );
801 reportHeader(
_(
"Diff pair gap resolution for:" ), ac, bc, active, r );
814 reportHeader(
_(
"Diff pair max uncoupled length resolution for:" ), ac, bc, active, r );
819 r->
Report(
_(
"No 'diff_pair_uncoupled' constraints defined." ) );
834 auto isOnCorrespondingLayer=
846 if( aItem->
IsOnLayer( correspondingMask ) )
852 "applied to holes." ),
864 if( ( a->
IsOnLayer( layer ) && isOnCorrespondingLayer( b, layer, &warning ) )
865 || ( b->
IsOnLayer( layer ) && isOnCorrespondingLayer( a, layer, &warning ) ) )
868 reportHeader(
_(
"Silkscreen clearance resolution for:" ), a, b, layer, r );
878 if( !warning.IsEmpty() )
893 if( aCourtyard && bCourtyard )
896 reportHeader(
_(
"Courtyard clearance resolution for:" ), a, b, layer, r );
915 bool pageAdded =
false;
940 reportHeader(
_(
"Hole clearance resolution for:" ), a, b, layer, r );
969 reportHeader(
_(
"Hole to hole clearance resolution for:" ), a, b, r );
1008 reportHeader(
_(
"Edge clearance resolution for:" ), a, b, layer, r );
1026 auto reportPhysicalClearance =
1029 reportHeader(
_(
"Physical clearance resolution for:" ), a, b, aLayer, r );
1041 r->
Report(
_(
"No 'physical_clearance' constraints defined." ) );
1055 if( layerIntersection.any() )
1059 if( !layerIntersection.test( layer ) )
1060 layer = layerIntersection.
Seq().front();
1062 reportPhysicalClearance( layer );
1068 reportPhysicalClearance(
F_CrtYd );
1071 reportPhysicalClearance(
B_CrtYd );
1076 reportPhysicalClearance(
F_CrtYd );
1079 reportPhysicalClearance(
B_CrtYd );
1095 reportHeader(
_(
"Physical hole clearance resolution for:" ), a, b, layer, r );
1107 r->
Report(
_(
"No 'physical_hole_clearance' constraints defined." ) );
1127#define EVAL_RULES( constraint, a, b, layer, r ) drcEngine.EvalRules( constraint, a, b, layer, r )
1151 bool compileError =
false;
1152 bool courtyardError =
false;
1161 reportHeader(
_(
"Track width resolution for:" ), item, r );
1180 reportHeader(
_(
"Via diameter resolution for:" ), item, r );
1197 reportHeader(
_(
"Via annular width resolution for:" ), item, r );
1218 reportHeader(
_(
"Hole diameter resolution for:" ), item, r );
1240 reportHeader(
_(
"Text height resolution for:" ), item, r );
1256 reportHeader(
_(
"Text thickness resolution for:" ), item, r );
1280 if( courtyardError )
1283 r->
Report(
_(
"Report may be incomplete: some footprint courtyards are malformed." )
1284 + wxT(
" <a href='drc'>" ) +
_(
"Run DRC for a full analysis." ) + wxT(
"</a>" ) );
1290 r->
Report(
_(
"Item <b>disallowed</b> at current location." ) );
1292 r->
Report(
_(
"Item allowed at current location." ) );
1302 if( courtyardError )
1305 r->
Report(
_(
"Report may be incomplete: some footprint courtyards are malformed." )
1306 + wxT(
" <a href='drc'>" ) +
_(
"Run DRC for a full analysis." ) + wxT(
"</a>" ) );
1335 request3DviewRedraw =
false;
1338 if( request3DviewRedraw )
1352 bool enableHighlight =
false;
1357 std::set<int> netcodes;
1362 netcodes.insert( ci->GetNetCode() );
1365 enableHighlight = !netcodes.empty();
1367 if( enableHighlight && netcodes.size() > 1 )
1374 for(
int multiNet : netcodes )
1382 else if( enableHighlight )
1384 net = *netcodes.begin();
1408 bool saved =
filter.lockedItems;
1409 filter.lockedItems =
true;
1413 filter.lockedItems = saved;
1421 for(
int i = collector.GetCount() - 1; i >= 0; i-- )
1423 LSET itemLayers = collector[i]->GetLayerSet();
1426 ( highContrast && !itemLayers.
Contains( contrastLayer ) ) )
1428 collector.Remove( i );
1433 enableHighlight = ( collector.GetCount() > 0 );
1436 if( enableHighlight )
1447 const std::set<int>& netcodes = settings->GetHighlightNetCodes();
1450 if( netcodes.count( net ) )
1451 enableHighlight = !settings->IsHighlightEnabled();
1453 if( enableHighlight != settings->IsHighlightEnabled() || !netcodes.count( net ) )
1455 if( !netcodes.empty() )
1456 m_lastHighlighted = netcodes;
1458 settings->SetHighlight( enableHighlight, net );
1459 m_toolMgr->GetView()->UpdateAllLayersColor();
1463 if( enableHighlight && net >= 0 )
1465 m_currentlyHighlighted = netcodes;
1466 board->SetHighLightNet( net );
1467 board->HighLightON();
1473 std::vector<MSG_PANEL_ITEM> items;
1475 m_frame->SetMsgPanel( items );
1476 m_frame->SendCrossProbeNetName( netinfo->
GetNetname() );
1481 m_currentlyHighlighted.clear();
1482 board->ResetNetHighLight();
1483 m_frame->SetMsgPanel( board );
1484 m_frame->SendCrossProbeNetName(
"" );
1493 int netcode = aEvent.
Parameter<intptr_t>();
1500 settings->SetHighlight(
true, netcode );
1512 std::set<int> temp = highlighted;
1581 for(
PAD*
pad : fp->Pads() )
1589 if(
PAD*
pad = dyn_cast<PAD*>( item) )
1591 pad->SetLocalRatsnestVisible( !
pad->GetLocalRatsnestVisible() );
1593 else if(
FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( item) )
1595 if( !fp->Pads().empty() )
1597 bool enable = !fp->Pads()[0]->GetLocalRatsnestVisible();
1599 for(
PAD* childPad : fp->Pads() )
1600 childPad->SetLocalRatsnestVisible( enable );
1612 [
this,
board](
int aCondition )
1618 for(
PAD*
pad : fp->Pads() )
1648 auto&
selection = selectionTool->GetSelection();
1649 auto connectivity = getModel<BOARD>()->GetConnectivity();
1653 connectivity->ClearLocalRatsnest();
1668 getModel<BOARD>()->GetConnectivity()->ClearLocalRatsnest();
1681 std::vector<BOARD_ITEM*> items;
1684 for( std::size_t i = 0; i < queued_items.size(); ++i )
1693 items.push_back(
pad );
1701 queued_items.push_back( aItem );
1707 items.push_back( boardItem );
1711 if( items.empty() || std::none_of( items.begin(), items.end(),
1714 return( aItem->Type() == PCB_TRACE_T
1715 || aItem->Type() == PCB_PAD_T
1716 || aItem->Type() == PCB_ARC_T
1717 || aItem->Type() == PCB_ZONE_T
1718 || aItem->Type() == PCB_FOOTPRINT_T
1719 || aItem->Type() == PCB_VIA_T );
1728 connectivity->BlockRatsnestItems( items );
1826 if( bci->GetNetCode() > 0 )
static TOOL_ACTION pickerTool
void OnNetVisibilityChanged(int aNetCode, bool aVisibility)
Notifies the panel when a net has been hidden or shown via the external tool.
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 bool IsTented() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer, bool aIncludeCourtyards=false) const
Test to see if this object is on the given layer.
virtual bool IsOnCopperLayer() const
virtual bool HasHole() const
Information pertinent to a Pcbnew printed circuit board.
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
BOARD_ITEM * GetItem(const KIID &aID) const
void ResetNetHighLight()
Reset all high light data to the init state.
FOOTPRINTS & Footprints()
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
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 Move(const VECTOR2I &aDelta)
Moves the connectivity list anchors.
Dialog to show common board info.
ZONE_CONNECTION m_ZoneConnection
Design Rule Checker object that performs all the DRC tests.
bool HasRulesForConstraintType(DRC_CONSTRAINT_T constraintID)
void ProcessAssertions(const BOARD_ITEM *a, std::function< void(const DRC_CONSTRAINT *)> aFailureHandler, REPORTER *aReporter=nullptr)
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
DRC_CONSTRAINT EvalZoneConnection(const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
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.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const
Return a user-visible description string of this item.
EDA_ITEM_FLAGS GetFlags() const
A general implementation of a COLLECTORS_GUIDE.
void SetIgnoreZoneFills(bool ignore)
void SetPreferredLayer(PCB_LAYER_ID aLayer)
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.
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 GetHighContrast() const
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
virtual int GetTopLayer() const
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
const wxString GetName() const
Handle the data for a net.
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
DISPLAY_OPTIONS m_Display
static TOOL_ACTION highlightItem
static TOOL_ACTION listNets
static TOOL_ACTION toggleNetHighlight
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION highlightNet
static TOOL_ACTION hideNetInRatsnest
static TOOL_ACTION hideLocalRatsnest
static TOOL_ACTION showNetInRatsnest
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION toggleLastNetHighlight
static TOOL_ACTION inspectConstraints
static TOOL_ACTION clearHighlight
static TOOL_ACTION inspectClearance
static TOOL_ACTION updateLocalRatsnest
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION highlightNetSelection
static TOOL_ACTION boardStatistics
static TOOL_ACTION localRatsnestTool
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
APPEARANCE_CONTROLS * GetAppearancePanel()
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
void SendCrossProbeItem(BOARD_ITEM *aSyncItem)
Send a message to the schematic editor so that it may move its cursor to an item with the same refere...
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
A set of BOARD_ITEMs (i.e., without duplicates).
std::unordered_set< BOARD_ITEM * > & GetItems()
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
int Size() const
Returns the number of selected parts.
bool Empty() const
Checks if there is anything selected.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
Handle a list of polygons defining a copper zone.
virtual bool IsOnLayer(PCB_LAYER_ID, bool aIncludeCourtyards=false) const override
Test to see if this object is on the given layer.
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
@ DRCE_MICROVIA_DRILL_OUT_OF_RANGE
@ ANNULAR_WIDTH_CONSTRAINT
@ COURTYARD_CLEARANCE_CONSTRAINT
@ VIA_DIAMETER_CONSTRAINT
@ DIFF_PAIR_MAX_UNCOUPLED_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
@ SILK_CLEARANCE_CONSTRAINT
@ EDGE_CLEARANCE_CONSTRAINT
@ MIN_RESOLVED_SPOKES_CONSTRAINT
@ TEXT_THICKNESS_CONSTRAINT
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
@ THERMAL_SPOKE_WIDTH_CONSTRAINT
@ CONNECTION_WIDTH_CONSTRAINT
@ THERMAL_RELIEF_GAP_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ PHYSICAL_CLEARANCE_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)
Tests 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
@ SMD
Smd pad, appears on the solder paste layer (default)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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,...
bool m_ShowModuleRatsnest
This file contains data structures that are saved in the project file or project local settings file ...
@ 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_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_FP_TEXT_T
class FP_TEXT, text 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)
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.