KiCad PCB EDA Suite
DRC Class Reference

Design Rule Checker object that performs all the DRC tests. More...

#include <drc.h>

Inheritance diagram for DRC:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 DRC ()
 
 ~DRC ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool LoadRules ()
 Load the DRC rules. More...
 
void ShowDRCDialog (wxWindow *aParent)
 Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and creates the MARKERS. More...
 
int ShowDRCDialog (const TOOL_EVENT &aEvent)
 
bool IsDRCDialogShown ()
 Check to see if the DRC dialog is currently shown. More...
 
void DestroyDRCDialog (int aReason)
 Deletes this ui dialog box and zeros out its pointer to remember the state of the dialog's existence. More...
 
void RunTests (wxTextCtrl *aMessages=NULL)
 Run all the tests specified with a previous call to SetSettings() More...
 
virtual bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Static Public Member Functions

static wxPoint GetLocation (TRACK *aTrack, ZONE_CONTAINER *aConflictZone)
 Fetches a reasonable point for marking a violoation between two non-point objects. More...
 
static wxPoint GetLocation (TRACK *aTrack, const SEG &aConflictSeg)
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 0x01, IPO_FLIP = 0x02, IPO_SINGLE_CLICK = 0x04, IPO_REPEAT = 0x08 }
 Options for placing items interactively. More...
 

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void setTransitions () override
 

Sets up handlers for various events.

More...
 
void updatePointers ()
 Update needed pointers from the one pointer which is known not to change. More...
 
EDA_UNITS userUnits () const
 
void addMarkerToPcb (BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
 Adds a DRC marker to the PCB through the COMMIT mechanism. More...
 
void testTracks (BOARD_COMMIT &aCommit, wxWindow *aActiveWindow, bool aShowProgressBar)
 Perform the DRC on all tracks. More...
 
void testPadClearances (BOARD_COMMIT &aCommit)
 
void testUnconnected ()
 
void testZones (BOARD_COMMIT &aCommit)
 
void testCopperDrawItem (BOARD_COMMIT &aCommit, BOARD_ITEM *aDrawing)
 
void testCopperTextAndGraphics (BOARD_COMMIT &aCommit)
 
void testDisabledLayers (BOARD_COMMIT &aCommit)
 
void testOutline (BOARD_COMMIT &aCommit)
 Test that the board outline is contiguous and composed of valid elements. More...
 
bool doPadToPadsDrc (BOARD_COMMIT &aCommit, D_PAD *aRefPad, D_PAD **aStart, D_PAD **aEnd, int x_limit)
 Test the clearance between aRefPad and other pads. More...
 
void doTrackDrc (BOARD_COMMIT &aCommit, TRACK *aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt, bool aTestZones)
 Test the current segment. More...
 
bool checkClearancePadToPad (D_PAD *aRefPad, D_PAD *aPad, int aMinClearance, int *aActualDist)
 
bool checkClearanceSegmToPad (const SEG &seg, int segWidth, const D_PAD *pad, int minClearance, int *aActualDist)
 Check the distance from a pad to segment. More...
 

Private Attributes

bool m_doUnconnectedTest
 
bool m_testTracksAgainstZones
 
bool m_doKeepoutTest
 
bool m_refillZones
 
bool m_reportAllTrackErrors
 
bool m_testFootprints
 
PCB_EDIT_FRAMEm_editFrame
 
BOARDm_pcb
 
SHAPE_POLY_SET m_board_outlines
 
bool m_board_outline_valid
 
DIALOG_DRCm_drcDialog
 
std::vector< DRC_ITEM * > m_unconnected
 
std::vector< DRC_ITEM * > m_footprints
 
bool m_drcRun
 
bool m_footprintsTested
 
std::vector< DRC_SELECTOR * > m_ruleSelectors
 
std::vector< DRC_RULE * > m_rules
 
wxString m_msg
 
wxString m_clearanceSource
 
int m_largestClearance
 

Friends

class DIALOG_DRC
 

Detailed Description

Design Rule Checker object that performs all the DRC tests.

The output of the checking goes to the BOARD file in the form of two MARKER lists. Those two lists are displayable in the drc dialog box. And they can optionally be sent to a text file on disk. This class is given access to the windows and the BOARD that it needs via its constructor or public access functions.

Definition at line 105 of file drc.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

Handle the rotate action in the loop by calling the item's rotate method.

IPO_FLIP 

Handle flip action in the loop by calling the item's flip method.

IPO_SINGLE_CLICK 

Create an item immediately on placement starting, otherwise show the pencil cursor until the item is created.

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 116 of file pcb_tool_base.h.

116  {
118  IPO_ROTATE = 0x01,
119 
121  IPO_FLIP = 0x02,
122 
125  IPO_SINGLE_CLICK = 0x04,
126 
128  IPO_REPEAT = 0x08
129  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

80  {
81  RUN,
82  MODEL_RELOAD,
83  GAL_SWITCH
84  };
Model changes (required full reload)
Definition: tool_base.h:82
Tool is invoked after being inactive.
Definition: tool_base.h:81
Rendering engine changes.
Definition: tool_base.h:83

Constructor & Destructor Documentation

◆ DRC()

DRC::DRC ( )

Definition at line 64 of file pcbnew/drc/drc.cpp.

64  :
65  PCB_TOOL_BASE( "pcbnew.DRCTool" ),
66  m_editFrame( nullptr ),
67  m_pcb( nullptr ),
68  m_board_outline_valid( false ),
69  m_drcDialog( nullptr ),
71 {
72  // establish initial values for everything:
73  m_doUnconnectedTest = true; // enable unconnected tests
74  m_testTracksAgainstZones = false; // disable zone to items clearance tests
75  m_doKeepoutTest = true; // enable keepout areas to items clearance tests
76  m_refillZones = false; // Only fill zones if requested by user.
77  m_reportAllTrackErrors = false;
78  m_testFootprints = false;
79 
80  m_drcRun = false;
81  m_footprintsTested = false;
82 }
bool m_refillZones
Definition: drc.h:120
int m_largestClearance
Definition: drc.h:144
BOARD * m_pcb
Definition: drc.h:125
bool m_testFootprints
Definition: drc.h:122
bool m_doKeepoutTest
Definition: drc.h:119
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
bool m_reportAllTrackErrors
Definition: drc.h:121
bool m_drcRun
Definition: drc.h:132
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75
bool m_testTracksAgainstZones
Definition: drc.h:118
bool m_footprintsTested
Definition: drc.h:133
bool m_board_outline_valid
Definition: drc.h:127
DIALOG_DRC * m_drcDialog
Definition: drc.h:128
bool m_doUnconnectedTest
Definition: drc.h:117

References m_doKeepoutTest, m_doUnconnectedTest, m_drcRun, m_footprintsTested, m_refillZones, m_reportAllTrackErrors, m_testFootprints, and m_testTracksAgainstZones.

◆ ~DRC()

DRC::~DRC ( )

Definition at line 85 of file pcbnew/drc/drc.cpp.

86 {
87  for( DRC_ITEM* unconnectedItem : m_unconnected )
88  delete unconnectedItem;
89 
90  for( DRC_ITEM* footprintItem : m_footprints )
91  delete footprintItem;
92 }
std::vector< DRC_ITEM * > m_footprints
Definition: drc.h:131
std::vector< DRC_ITEM * > m_unconnected
Definition: drc.h:130

References m_footprints, and m_unconnected.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ addMarkerToPcb()

void DRC::addMarkerToPcb ( BOARD_COMMIT aCommit,
MARKER_PCB aMarker 
)
private

Adds a DRC marker to the PCB through the COMMIT mechanism.

Definition at line 160 of file pcbnew/drc/drc.cpp.

161 {
162  if( m_pcb->GetDesignSettings().Ignore( aMarker->GetRCItem()->GetErrorCode() ) )
163  {
164  delete aMarker;
165  return;
166  }
167 
168  aCommit.Add( aMarker );
169 }
RC_ITEM * GetRCItem()
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.
Definition: marker_base.h:117
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
BOARD * m_pcb
Definition: drc.h:125
int GetErrorCode() const
Definition: rc_item.h:160

References COMMIT::Add(), BOARD::GetDesignSettings(), RC_ITEM::GetErrorCode(), MARKER_BASE::GetRCItem(), BOARD_DESIGN_SETTINGS::Ignore(), and m_pcb.

Referenced by doPadToPadsDrc(), doTrackDrc(), RunTests(), testCopperDrawItem(), testDisabledLayers(), testOutline(), testPadClearances(), testTracks(), and testZones().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 166 of file pcb_tool_base.h.

166 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), EDIT_TOOL::MoveExact(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PAD_TOOL::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), EDIT_TOOL::Remove(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), PCBNEW_CONTROL::TrackDisplayMode(), POINT_EDITOR::updateItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ checkClearancePadToPad()

bool DRC::checkClearancePadToPad ( D_PAD aRefPad,
D_PAD aPad,
int  aMinClearance,
int *  aActualDist 
)
private
Parameters
aRefPadThe reference pad to check
aPadAnother pad to check against
aMinClearanceis the minimum allowed distance between the pads
aActualDist[out] it the actual distance (only guaranteed to be set for violations)
Returns
true if clearance between aRefPad and aPad is >= aMinClearance, else false

Definition at line 618 of file drc_clearance_test_functions.cpp.

619 {
620  int center2center = KiROUND( EuclideanNorm( aPad->ShapePos() - aRefPad->ShapePos() ) );
621 
622  // Quick test: Clearance is OK if the bounding circles are further away than aMinClearance
623  if( center2center - aRefPad->GetBoundingRadius() - aPad->GetBoundingRadius() >= aMinClearance )
624  return true;
625 
626  int actual = INT_MAX;
627 
628  for( const std::shared_ptr<SHAPE>& aShape : aRefPad->GetEffectiveShapes() )
629  {
630  for( const std::shared_ptr<SHAPE>& bShape : aPad->GetEffectiveShapes() )
631  {
632  int this_dist;
633 
634  if( aShape->Collide( bShape.get(), aMinClearance, &this_dist ) )
635  actual = std::min( actual, this_dist );
636  }
637  }
638 
639  if( actual < INT_MAX )
640  {
641  // returns the actual clearance (clearance < aMinClearance) for diags:
642  if( aActual )
643  *aActual = std::max( 0, actual );
644 
645  return false;
646  }
647 
648  return true;
649 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
const std::vector< std::shared_ptr< SHAPE > > & GetEffectiveShapes() const
Function GetEffectiveShapes Returns a list of SHAPE objects representing the pad's copper.
Definition: class_pad.cpp:194
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:212
wxPoint ShapePos() const
Definition: class_pad.cpp:491
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References EuclideanNorm(), D_PAD::GetBoundingRadius(), D_PAD::GetEffectiveShapes(), KiROUND(), and D_PAD::ShapePos().

Referenced by doPadToPadsDrc().

◆ checkClearanceSegmToPad()

bool DRC::checkClearanceSegmToPad ( const SEG seg,
int  segWidth,
const D_PAD pad,
int  minClearance,
int *  aActualDist 
)
private

Check the distance from a pad to segment.

This function uses several instance variable not passed in:

Parameters
aPadIs the pad involved in the check
aSegmentWidthwidth of the segment to test
aMinDistIs the minimum clearance needed
aActualDist[out] Is the actual clearance (only guarantted to be set on violations)
Returns
true distance >= dist_min, false if distance < dist_min

Definition at line 656 of file drc_clearance_test_functions.cpp.

658 {
659  if( ( pad->GetShape() == PAD_SHAPE_CIRCLE || pad->GetShape() == PAD_SHAPE_OVAL ) )
660  {
661  /* Treat an oval pad as a line segment along the hole's major axis,
662  * shortened by half its minor axis.
663  * A circular pad is just a degenerate case of an oval hole.
664  */
665  wxPoint padStart, padEnd;
666  int padWidth;
667 
668  pad->GetOblongGeometry( pad->GetSize(), &padStart, &padEnd, &padWidth );
669  padStart += pad->ShapePos();
670  padEnd += pad->ShapePos();
671 
672  SEG padSeg( padStart, padEnd );
673  int widths = ( padWidth + refSegWidth ) / 2;
674  int center2centerAllowed = minClearance + widths;
675 
676  // Avoid square-roots if possible (for performance)
677  SEG::ecoord center2center_squared = refSeg.SquaredDistance( padSeg );
678 
679  if( center2center_squared < SEG::Square( center2centerAllowed ) )
680  {
681  *aActualDist = std::max( 0.0, sqrt( center2center_squared ) - widths );
682  return false;
683  }
684  }
685  else if( ( pad->GetShape() == PAD_SHAPE_RECT || pad->GetShape() == PAD_SHAPE_ROUNDRECT )
686  && ( (int) pad->GetOrientation() % 900 == 0 ) )
687  {
688  EDA_RECT padBBox = pad->GetBoundingBox();
689  int widths = refSegWidth / 2;
690 
691  // Note a ROUNDRECT pad with a corner radius = r can be treated as a smaller
692  // RECT (size - 2*r) with a clearance increased by r
693  if( pad->GetShape() == PAD_SHAPE_ROUNDRECT )
694  {
695  padBBox.Inflate( - pad->GetRoundRectCornerRadius() );
696  widths += pad->GetRoundRectCornerRadius();
697  }
698 
699  SHAPE_RECT padShape( padBBox.GetPosition(), padBBox.GetWidth(), padBBox.GetHeight() );
700  int actual;
701 
702  if( padShape.Collide( refSeg, minClearance + widths, &actual ) )
703  {
704  *aActualDist = std::max( 0, actual - widths );
705  return false;
706  }
707  }
708  else // Convert the rest to polygons
709  {
710  SHAPE_POLY_SET polyset;
711 
712  BOARD* board = pad->GetBoard();
713  int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
714 
715  pad->TransformShapeWithClearanceToPolygon( polyset, 0, maxError );
716 
717  const SHAPE_LINE_CHAIN& refpoly = polyset.COutline( 0 );
718  int widths = refSegWidth / 2;
719  int actual;
720 
721  if( !poly2segmentDRC( (wxPoint*) &refpoly.CPoint( 0 ), refpoly.PointCount(),
722  (wxPoint) refSeg.A, (wxPoint) refSeg.B,
723  minClearance + widths, &actual ) )
724  {
725  *aActualDist = std::max( 0, actual - widths );
726  return false;
727  }
728  }
729 
730  return true;
731 }
BOARD * board() const
VECTOR2I::extended_type ecoord
Definition: seg.h:42
int GetWidth() const
Definition: eda_rect.h:119
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
int PointCount() const
Function PointCount()
static SEG::ecoord Square(int a)
Definition: seg.h:116
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
const wxPoint GetPosition() const
Definition: eda_rect.h:115
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetHeight() const
Definition: eda_rect.h:120
Definition: seg.h:39
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
bool poly2segmentDRC(wxPoint *aTref, int aTrefCount, wxPoint aSegStart, wxPoint aSegEnd, int aDist, int *aActual)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
SHAPE_LINE_CHAIN.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:313
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:491
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetRoundRectCornerRadius() const
Definition: class_pad.cpp:163
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:153
const wxSize & GetSize() const
Definition: class_pad.h:220
void GetOblongGeometry(const wxSize &aDrillOrPadSize, wxPoint *aStartPoint, wxPoint *aEndPoint, int *aWidth) const
JEY TODO: temporary until Tom is done with DRC stuff....
Definition: class_pad.cpp:753
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:371
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References SEG::A, SEG::B, PCB_TOOL_BASE::board(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), BOARD_ITEM::GetBoard(), D_PAD::GetBoundingBox(), BOARD::GetDesignSettings(), EDA_RECT::GetHeight(), D_PAD::GetOblongGeometry(), D_PAD::GetOrientation(), EDA_RECT::GetPosition(), D_PAD::GetRoundRectCornerRadius(), D_PAD::GetShape(), D_PAD::GetSize(), EDA_RECT::GetWidth(), EDA_RECT::Inflate(), BOARD_DESIGN_SETTINGS::m_MaxError, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, SHAPE_LINE_CHAIN::PointCount(), poly2segmentDRC(), D_PAD::ShapePos(), SEG::Square(), SEG::SquaredDistance(), and D_PAD::TransformShapeWithClearanceToPolygon().

Referenced by doTrackDrc(), and testPadClearances().

◆ controls()

◆ DestroyDRCDialog()

void DRC::DestroyDRCDialog ( int  aReason)

Deletes this ui dialog box and zeros out its pointer to remember the state of the dialog's existence.

Parameters
aReasonIndication of which button was clicked to cause the destruction. if aReason == wxID_OK, design parameters values which can be entered from the dialog will bbe saved in design parameters list

Definition at line 172 of file pcbnew/drc/drc.cpp.

173 {
174  if( m_drcDialog )
175  {
176  m_drcDialog->Destroy();
177  m_drcDialog = nullptr;
178  }
179 }
DIALOG_DRC * m_drcDialog
Definition: drc.h:128

References m_drcDialog.

Referenced by DIALOG_DRC::OnActivateDlg(), DIALOG_DRC::OnCancelClick(), DIALOG_PLOT::onRunDRC(), and Reset().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 264 of file pcb_tool_base.cpp.

265 {
266  return frame()->GetDisplayOptions();
267 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
PCB_BASE_EDIT_FRAME * frame() const

References PCB_TOOL_BASE::frame(), and PCB_BASE_FRAME::GetDisplayOptions().

Referenced by PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), PCBNEW_CONTROL::HighContrastMode(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PNS::TOOL_BASE::pickSingleItem(), PCBNEW_CONTROL::ToggleRatsnest(), PCBNEW_CONTROL::TrackDisplayMode(), PCBNEW_CONTROL::ViaDisplayMode(), and PCBNEW_CONTROL::ZoneDisplayMode().

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 37 of file pcb_tool_base.cpp.

40 {
41  using namespace std::placeholders;
42  std::unique_ptr<BOARD_ITEM> newItem;
43 
44  frame()->PushTool( aTool );
45  Activate();
46 
47  BOARD_COMMIT commit( frame() );
48 
50 
51  // do not capture or auto-pan until we start placing an item
52  controls()->ShowCursor( true );
53  controls()->SetSnapping( true );
54 
55  // Add a VIEW_GROUP that serves as a preview for the new item
56  PCBNEW_SELECTION preview;
57  view()->Add( &preview );
58 
59  aPlacer->m_board = board();
60  aPlacer->m_frame = frame();
61  aPlacer->m_modifiers = 0;
62 
63  auto makeNewItem = [&] ( VECTOR2I aPosition )
64  {
65  if( frame()->GetModel() )
66  newItem = aPlacer->CreateItem();
67 
68  if( newItem )
69  {
70  newItem->SetPosition( (wxPoint) aPosition );
71  preview.Add( newItem.get() );
72 
73  if( newItem->Type() == PCB_MODULE_T )
74  {
75  auto module = dyn_cast<MODULE*>( newItem.get() );
76 
77  // modules have more drawable parts
78  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
79  }
80  }
81  };
82 
83  if( aOptions & IPO_SINGLE_CLICK )
84  makeNewItem( controls()->GetCursorPosition() );
85 
86  // Main loop: keep receiving events
87  while( TOOL_EVENT* evt = Wait() )
88  {
89  if( !newItem )
90  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
91  else
92  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
93 
94  VECTOR2I cursorPos = controls()->GetCursorPosition();
95  aPlacer->m_modifiers = evt->Modifier();
96 
97  auto cleanup = [&] ()
98  {
99  newItem = nullptr;
100  preview.Clear();
101  view()->Update( &preview );
102  controls()->SetAutoPan( false );
103  controls()->CaptureCursor( false );
104  controls()->ShowCursor( true );
105  };
106 
107  if( evt->IsCancelInteractive() )
108  {
109  if( aOptions & IPO_SINGLE_CLICK )
110  {
111  cleanup();
112  frame()->PopTool( aTool );
113  break;
114  }
115  else if( newItem )
116  cleanup();
117  else
118  {
119  frame()->PopTool( aTool );
120  break;
121  }
122  }
123  else if( evt->IsActivate() )
124  {
125  if( newItem )
126  cleanup();
127 
128  if( evt->IsPointEditor() )
129  {
130  // don't exit (the point editor runs in the background)
131  }
132  else if( evt->IsMoveTool() )
133  {
134  // leave ourselves on the stack so we come back after the move
135  break;
136  }
137  else
138  {
139  frame()->PopTool( aTool );
140  break;
141  }
142  }
143  else if( evt->IsClick( BUT_LEFT ) )
144  {
145  if( !newItem )
146  {
147  // create the item if possible
148  makeNewItem( cursorPos );
149 
150  // no item created, so wait for another click
151  if( !newItem )
152  continue;
153 
154  controls()->CaptureCursor( true );
155  controls()->SetAutoPan( true );
156  }
157  else
158  {
159  auto oldFlags = newItem->GetFlags();
160  newItem->ClearFlags();
161 
162  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
163  {
164  newItem->SetFlags( oldFlags );
165  continue;
166  }
167 
168  preview.Clear();
169  newItem.release();
170  commit.Push( aCommitMessage );
171 
172  controls()->CaptureCursor( false );
173  controls()->SetAutoPan( false );
174  controls()->ShowCursor( true );
175 
176  if( !( aOptions & IPO_REPEAT ) )
177  break;
178 
179  if( aOptions & IPO_SINGLE_CLICK )
180  makeNewItem( controls()->GetCursorPosition() );
181  }
182  }
183  else if( evt->IsClick( BUT_RIGHT ) )
184  {
186  }
187  else if( newItem && evt->Category() == TC_COMMAND )
188  {
189  /*
190  * Handle any events that can affect the item as we move it around
191  */
192  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
193  {
194  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
195  newItem->Rotate( newItem->GetPosition(), rotationAngle );
196  view()->Update( &preview );
197  }
198  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
199  {
200  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
201  view()->Update( &preview );
202  }
203  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
204  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
205  {
206  // Refresh preview after event runs
208  }
209  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
210  {
211  preview.Clear();
212  newItem.release();
213 
214  makeNewItem( controls()->GetCursorPosition() );
215  view()->Update( &preview );
216  }
217  }
218 
219  else if( newItem && evt->IsMotion() )
220  {
221  // track the cursor
222  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
223  aPlacer->SnapItem( newItem.get() );
224 
225  // Show a preview of the item
226  view()->Update( &preview );
227  }
228 
229  else
230  evt->SetPassEvent();
231  }
232 
233  view()->Remove( &preview );
234 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:95
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Handle flip action in the loop by calling the item's flip method.
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:279
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
Allow repeat placement of the item.
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:100
Handle the rotate action in the loop by calling the item's rotate method.
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
PCBNEW_SETTINGS & Settings()
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:62
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:280
static TOOL_ACTION refreshPreview
Definition: actions.h:101
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetSnapping(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and PAD_TOOL::PlacePad().

◆ doPadToPadsDrc()

bool DRC::doPadToPadsDrc ( BOARD_COMMIT aCommit,
D_PAD aRefPad,
D_PAD **  aStart,
D_PAD **  aEnd,
int  x_limit 
)
private

Test the clearance between aRefPad and other pads.

The pad list must be sorted by x coordinate.

Parameters
aRefPadis the pad to test
aStartis the first pad of the list to test against aRefPad
aEndis the end of the list and is not included
x_limitis used to stop the test (i.e. when the current pad pos X in list exceeds this limit, because the list is sorted by X coordinate)

Definition at line 1213 of file pcbnew/drc/drc.cpp.

1215 {
1216  const static LSET all_cu = LSET::AllCuMask();
1217 
1218  LSET layerMask = aRefPad->GetLayerSet() & all_cu;
1219 
1220  // For hole testing we use a dummy pad which is given the shape of the hole. Note that
1221  // this pad must have a parent because some functions expect a non-null parent to find
1222  // the pad's board.
1223  MODULE dummymodule( m_pcb ); // Creates a dummy parent
1224  D_PAD dummypad( &dummymodule );
1225 
1226  // Ensure the hole is on all copper layers
1227  dummypad.SetLayerSet( all_cu | dummypad.GetLayerSet() );
1228 
1229  for( D_PAD** pad_list = aStart; pad_list<aEnd; ++pad_list )
1230  {
1231  D_PAD* pad = *pad_list;
1232 
1233  if( pad == aRefPad )
1234  continue;
1235 
1236  // We can stop the test when pad->GetPosition().x > x_limit
1237  // because the list is sorted by X values
1238  if( pad->GetPosition().x > x_limit )
1239  break;
1240 
1241  // No problem if pads which are on copper layers are on different copper layers,
1242  // (pads can be only on a technical layer, to build complex pads)
1243  // but their hole (if any ) can create DRC error because they are on all
1244  // copper layers, so we test them
1245  if( ( pad->GetLayerSet() & layerMask ) == 0 &&
1246  ( pad->GetLayerSet() & all_cu ) != 0 &&
1247  ( aRefPad->GetLayerSet() & all_cu ) != 0 )
1248  {
1249  // if holes are in the same location and have the same size and shape,
1250  // this can be accepted
1251  if( pad->GetPosition() == aRefPad->GetPosition()
1252  && pad->GetDrillSize() == aRefPad->GetDrillSize()
1253  && pad->GetDrillShape() == aRefPad->GetDrillShape() )
1254  {
1255  if( aRefPad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
1256  continue;
1257 
1258  // for oval holes: must also have the same orientation
1259  if( pad->GetOrientation() == aRefPad->GetOrientation() )
1260  continue;
1261  }
1262 
1263  /* Here, we must test clearance between holes and pads
1264  * dummy pad size and shape is adjusted to pad drill size and shape
1265  */
1266  if( pad->GetDrillSize().x )
1267  {
1268  // pad under testing has a hole, test this hole against pad reference
1269  dummypad.SetPosition( pad->GetPosition() );
1270  dummypad.SetSize( pad->GetDrillSize() );
1271  dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
1273  dummypad.SetOrientation( pad->GetOrientation() );
1274 
1275  int minClearance = aRefPad->GetClearance( nullptr, &m_clearanceSource );
1276  int actual;
1277 
1278  if( !checkClearancePadToPad( aRefPad, &dummypad, minClearance, &actual ) )
1279  {
1281 
1282  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
1284  MessageTextFromValue( userUnits(), minClearance, true ),
1285  MessageTextFromValue( userUnits(), actual, true ) );
1286 
1287  drcItem->SetErrorMessage( m_msg );
1288  drcItem->SetItems( pad, aRefPad );
1289 
1290  MARKER_PCB* marker = new MARKER_PCB( drcItem, pad->GetPosition() );
1291  addMarkerToPcb( aCommit, marker );
1292  return false;
1293  }
1294  }
1295 
1296  if( aRefPad->GetDrillSize().x ) // pad reference has a hole
1297  {
1298  dummypad.SetPosition( aRefPad->GetPosition() );
1299  dummypad.SetSize( aRefPad->GetDrillSize() );
1300  dummypad.SetShape( aRefPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
1302  dummypad.SetOrientation( aRefPad->GetOrientation() );
1303 
1304  int minClearance = pad->GetClearance( nullptr, &m_clearanceSource );
1305  int actual;
1306 
1307  if( !checkClearancePadToPad( pad, &dummypad, minClearance, &actual ) )
1308  {
1310 
1311  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
1313  MessageTextFromValue( userUnits(), minClearance, true ),
1314  MessageTextFromValue( userUnits(), actual, true ) );
1315 
1316  drcItem->SetErrorMessage( m_msg );
1317  drcItem->SetItems( aRefPad, pad );
1318 
1319  MARKER_PCB* marker = new MARKER_PCB( drcItem, aRefPad->GetPosition() );
1320  addMarkerToPcb( aCommit, marker );
1321  return false;
1322  }
1323  }
1324 
1325  continue;
1326  }
1327 
1328  // The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
1329  // But no problem if pads have the same netcode (same net)
1330  if( pad->GetNetCode() && ( aRefPad->GetNetCode() == pad->GetNetCode() ) )
1331  continue;
1332 
1333  // if pads are from the same footprint
1334  if( pad->GetParent() == aRefPad->GetParent() )
1335  {
1336  // and have the same pad number ( equivalent pads )
1337 
1338  // one can argue that this 2nd test is not necessary, that any
1339  // two pads from a single module are acceptable. This 2nd test
1340  // should eventually be a configuration option.
1341  if( pad->PadNameEqual( aRefPad ) )
1342  continue;
1343  }
1344 
1345  // if either pad has no drill and is only on technical layers, not a clearance violation
1346  if( ( ( pad->GetLayerSet() & layerMask ) == 0 && !pad->GetDrillSize().x ) ||
1347  ( ( aRefPad->GetLayerSet() & layerMask ) == 0 && !aRefPad->GetDrillSize().x ) )
1348  {
1349  continue;
1350  }
1351 
1352  int minClearance = aRefPad->GetClearance( pad, &m_clearanceSource );
1353  int clearanceAllowed = minClearance - m_pcb->GetDesignSettings().GetDRCEpsilon();
1354  int actual;
1355 
1356  if( !checkClearancePadToPad( aRefPad, pad, clearanceAllowed, &actual ) )
1357  {
1359 
1360  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
1362  MessageTextFromValue( userUnits(), minClearance, true ),
1363  MessageTextFromValue( userUnits(), actual, true ) );
1364 
1365  drcItem->SetErrorMessage( m_msg );
1366  drcItem->SetItems( aRefPad, pad );
1367 
1368  MARKER_PCB* marker = new MARKER_PCB( drcItem, aRefPad->GetPosition() );
1369  addMarkerToPcb( aCommit, marker );
1370  return false;
1371  }
1372  }
1373 
1374  return true;
1375 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
int GetNetCode() const
Function GetNetCode.
wxString m_msg
Definition: drc.h:142
items are too close together
Definition: drc.h:44
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
bool PadNameEqual(const D_PAD *other) const
Definition: class_pad.h:136
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:155
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
EDA_UNITS userUnits() const
Definition: drc.h:155
bool checkClearancePadToPad(D_PAD *aRefPad, D_PAD *aPad, int aMinClearance, int *aActualDist)
wxString m_clearanceSource
Definition: drc.h:143
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
LSET is a set of PCB_LAYER_IDs.
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:318
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:329
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
MODULE * GetParent() const
Definition: class_pad.h:107
virtual int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
#define _(s)
Definition: 3d_actions.cpp:33
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:313
const wxSize & GetDrillSize() const
Definition: class_pad.h:226
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
const wxPoint GetPosition() const override
Definition: class_pad.h:161

References _, addMarkerToPcb(), LSET::AllCuMask(), checkClearancePadToPad(), DRC_ITEM::Create(), DRCE_CLEARANCE, BOARD_CONNECTED_ITEM::GetClearance(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetDRCEpsilon(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), RC_ITEM::GetErrorText(), D_PAD::GetLayerSet(), BOARD_CONNECTED_ITEM::GetNetCode(), D_PAD::GetOrientation(), D_PAD::GetParent(), D_PAD::GetPosition(), m_clearanceSource, m_msg, m_pcb, MessageTextFromValue(), PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, D_PAD::PadNameEqual(), RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), D_PAD::SetLayerSet(), D_PAD::SetOrientation(), D_PAD::SetPosition(), D_PAD::SetShape(), D_PAD::SetSize(), userUnits(), and wxPoint::x.

Referenced by testPadClearances().

◆ doTrackDrc()

void DRC::doTrackDrc ( BOARD_COMMIT aCommit,
TRACK aRefSeg,
TRACKS::iterator  aStartIt,
TRACKS::iterator  aEndIt,
bool  aTestZones 
)
private

Test the current segment.

Parameters
aRefSegThe segment to test
aStartItthe iterator to the first track to test
aEndItthe marker for the iterator end
aTestZonestrue if should do copper zones test. This can be very time consumming
Returns
bool - true if no problems, else false and m_currentMarker is filled in with the problem information.

Definition at line 78 of file drc_clearance_test_functions.cpp.

80 {
82 
83  SEG refSeg( aRefSeg->GetStart(), aRefSeg->GetEnd() );
84  PCB_LAYER_ID refLayer = aRefSeg->GetLayer();
85  LSET refLayerSet = aRefSeg->GetLayerSet();
86 
87  EDA_RECT refSegBB = aRefSeg->GetBoundingBox();
88  int refSegWidth = aRefSeg->GetWidth();
89 
90 
91  /******************************************/
92  /* Phase 0 : via DRC tests : */
93  /******************************************/
94 
95  if( aRefSeg->Type() == PCB_VIA_T )
96  {
97  VIA *refvia = static_cast<VIA*>( aRefSeg );
98  int viaAnnulus = ( refvia->GetWidth() - refvia->GetDrill() ) / 2;
99  int minAnnulus = refvia->GetMinAnnulus( &m_clearanceSource );
100 
101  // test if the via size is smaller than minimum
102  if( refvia->GetViaType() == VIATYPE::MICROVIA )
103  {
104  if( viaAnnulus < minAnnulus )
105  {
107 
108  m_msg.Printf( _( "Via annulus too small (%s %s; actual %s)" ),
110  MessageTextFromValue( userUnits(), minAnnulus, true ),
111  MessageTextFromValue( userUnits(), viaAnnulus, true ) );
112 
113  drcItem->SetErrorMessage( m_msg );
114  drcItem->SetItems( refvia );
115 
116  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
117  addMarkerToPcb( aCommit, marker );
118  }
119 
120  if( refvia->GetWidth() < bds.m_MicroViasMinSize )
121  {
123 
124  m_msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; actual %s)" ),
126  MessageTextFromValue( userUnits(), refvia->GetWidth(), true ) );
127 
128  drcItem->SetErrorMessage( m_msg );
129  drcItem->SetItems( refvia );
130 
131  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
132  addMarkerToPcb( aCommit, marker );
133  }
134  }
135  else
136  {
137  if( bds.m_ViasMinAnnulus > minAnnulus )
138  {
139  minAnnulus = bds.m_ViasMinAnnulus;
140  m_clearanceSource = _( "board minimum" );
141  }
142 
143  if( viaAnnulus < minAnnulus )
144  {
146 
147  m_msg.Printf( _( "Via annulus too small (%s %s; actual %s)" ),
149  MessageTextFromValue( userUnits(), minAnnulus, true ),
150  MessageTextFromValue( userUnits(), viaAnnulus, true ) );
151 
152  drcItem->SetErrorMessage( m_msg );
153  drcItem->SetItems( refvia );
154 
155  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
156  addMarkerToPcb( aCommit, marker );
157  }
158 
159  if( refvia->GetWidth() < bds.m_ViasMinSize )
160  {
162 
163  m_msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; actual %s)" ),
165  MessageTextFromValue( userUnits(), refvia->GetWidth(), true ) );
166 
167  drcItem->SetErrorMessage( m_msg );
168  drcItem->SetItems( refvia );
169 
170  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
171  addMarkerToPcb( aCommit, marker );
172  }
173  }
174 
175  // test if via's hole is bigger than its diameter
176  // This test is necessary since the via hole size and width can be modified
177  // and a default via hole can be bigger than some vias sizes
178  if( refvia->GetDrillValue() > refvia->GetWidth() )
179  {
181 
182  m_msg.Printf( drcItem->GetErrorText() + _( " (diameter %s; drill %s)" ),
183  MessageTextFromValue( userUnits(), refvia->GetWidth(), true ),
184  MessageTextFromValue( userUnits(), refvia->GetDrillValue(), true ) );
185 
186  drcItem->SetErrorMessage( m_msg );
187  drcItem->SetItems( refvia );
188 
189  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
190  addMarkerToPcb( aCommit, marker );
191  }
192 
193  // test if the type of via is allowed due to design rules
194  if( refvia->GetViaType() == VIATYPE::MICROVIA && !bds.m_MicroViasAllowed )
195  {
197 
198  m_msg.Printf( _( "Microvia not allowed (board design rule constraints)" ) );
199  drcItem->SetErrorMessage( m_msg );
200  drcItem->SetItems( refvia );
201 
202  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
203  addMarkerToPcb( aCommit, marker );
204  }
205 
206  // test if the type of via is allowed due to design rules
207  if( refvia->GetViaType() == VIATYPE::BLIND_BURIED && !bds.m_BlindBuriedViaAllowed )
208  {
210 
211  m_msg.Printf( _( "Blind/buried via not allowed (board design rule constraints)" ) );
212  drcItem->SetErrorMessage( m_msg );
213  drcItem->SetItems( refvia );
214 
215  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
216  addMarkerToPcb( aCommit, marker );
217  }
218 
219  // For microvias: test if they are blind vias and only between 2 layers
220  // because they are used for very small drill size and are drill by laser
221  // and **only one layer** can be drilled
222  if( refvia->GetViaType() == VIATYPE::MICROVIA )
223  {
224  PCB_LAYER_ID layer1, layer2;
225  bool err = true;
226 
227  refvia->LayerPair( &layer1, &layer2 );
228 
229  if( layer1 > layer2 )
230  std::swap( layer1, layer2 );
231 
232  if( layer2 == B_Cu && layer1 == bds.GetCopperLayerCount() - 2 )
233  err = false;
234  else if( layer1 == F_Cu && layer2 == In1_Cu )
235  err = false;
236 
237  if( err )
238  {
240 
241  m_msg.Printf( _( "Microvia through too many layers (%s and %s not adjacent)" ),
242  m_pcb->GetLayerName( layer1 ),
243  m_pcb->GetLayerName( layer2 ) );
244 
245  drcItem->SetErrorMessage( m_msg );
246  drcItem->SetItems( refvia );
247 
248  MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );
249  addMarkerToPcb( aCommit, marker );
250  }
251  }
252 
253  }
254  else // This is a track segment
255  {
256  int minWidth, maxWidth;
257  aRefSeg->GetWidthConstraints( &minWidth, &maxWidth, &m_clearanceSource );
258 
259  int errorCode = 0;
260  int constraintWidth;
261 
262  if( refSegWidth < minWidth )
263  {
264  errorCode = DRCE_TRACK_WIDTH;
265  constraintWidth = minWidth;
266  }
267  else if( refSegWidth > maxWidth )
268  {
269  errorCode = DRCE_TRACK_WIDTH;
270  constraintWidth = maxWidth;
271  }
272 
273  if( errorCode )
274  {
275  wxPoint refsegMiddle = ( aRefSeg->GetStart() + aRefSeg->GetEnd() ) / 2;
276 
277  DRC_ITEM* drcItem = DRC_ITEM::Create( errorCode );
278 
279  m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
281  MessageTextFromValue( userUnits(), constraintWidth, true ),
282  MessageTextFromValue( userUnits(), refSegWidth, true ) );
283 
284  drcItem->SetErrorMessage( m_msg );
285  drcItem->SetItems( aRefSeg );
286 
287  MARKER_PCB* marker = new MARKER_PCB( drcItem, refsegMiddle );
288  addMarkerToPcb( aCommit, marker );
289  }
290  }
291 
292 
293  /******************************************/
294  /* Phase 1 : test DRC track to pads : */
295  /******************************************/
296 
297  // Compute the min distance to pads
298  for( MODULE* mod : m_pcb->Modules() )
299  {
300  // Don't preflight at the module level. Getting a module's bounding box goes
301  // through all its pads anyway (so it's no faster), and also all its drawings
302  // (so it's in fact slower).
303 
304  for( D_PAD* pad : mod->Pads() )
305  {
306  // Preflight based on bounding boxes.
307  EDA_RECT inflatedBB = refSegBB;
308  inflatedBB.Inflate( pad->GetBoundingRadius() + m_largestClearance );
309 
310  if( !inflatedBB.Contains( pad->GetPosition() ) )
311  continue;
312 
313  if( !( pad->GetLayerSet() & refLayerSet ).any() )
314  continue;
315 
316  // No need to check pads with the same net as the refSeg.
317  if( pad->GetNetCode() && aRefSeg->GetNetCode() == pad->GetNetCode() )
318  continue;
319 
320  if( pad->GetDrillSize().x > 0 )
321  {
322  // For hole testing we use a dummy pad which is a copy of the current pad
323  // shrunk down to nothing but its hole.
324  D_PAD dummypad( *pad );
325  dummypad.SetSize( pad->GetDrillSize() );
326  dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
328  // Ensure the hole is on all copper layers
329  const static LSET all_cu = LSET::AllCuMask();
330  dummypad.SetLayerSet( all_cu | dummypad.GetLayerSet() );
331 
332  int minClearance;
333  DRC_RULE* rule = GetRule( aRefSeg, &dummypad, CLEARANCE_CONSTRAINT );
334 
335  if( rule )
336  {
337  m_clearanceSource = wxString::Format( _( "'%s' rule" ), rule->m_Name );
338  minClearance = rule->m_Clearance.Min;
339  }
340  else
341  {
342  minClearance = aRefSeg->GetClearance( nullptr, &m_clearanceSource );
343  }
344 
345  /* Treat an oval hole as a line segment along the hole's major axis,
346  * shortened by half its minor axis.
347  * A circular hole is just a degenerate case of an oval hole.
348  */
349  wxPoint slotStart, slotEnd;
350  int slotWidth;
351 
352  pad->GetOblongGeometry( pad->GetDrillSize(), &slotStart, &slotEnd, &slotWidth );
353  slotStart += pad->GetPosition();
354  slotEnd += pad->GetPosition();
355 
356  SEG slotSeg( slotStart, slotEnd );
357  int widths = ( slotWidth + refSegWidth ) / 2;
358  int center2centerAllowed = minClearance + widths + bds.GetDRCEpsilon();
359 
360  // Avoid square-roots if possible (for performance)
361  SEG::ecoord center2center_squared = refSeg.SquaredDistance( slotSeg );
362 
363  if( center2center_squared < SEG::Square( center2centerAllowed ) )
364  {
365  int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
367 
368  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
370  MessageTextFromValue( userUnits(), minClearance, true ),
371  MessageTextFromValue( userUnits(), actual, true ) );
372 
373  drcItem->SetErrorMessage( m_msg );
374  drcItem->SetItems( aRefSeg, pad );
375 
376  MARKER_PCB* marker = new MARKER_PCB( drcItem, GetLocation( aRefSeg, slotSeg ) );
377  addMarkerToPcb( aCommit, marker );
378 
380  return;
381  }
382  }
383 
384  int minClearance = aRefSeg->GetClearance( pad, &m_clearanceSource );
385  int clearanceAllowed = minClearance - bds.GetDRCEpsilon();
386  int actual;
387 
388  if( !checkClearanceSegmToPad( refSeg, refSegWidth, pad, clearanceAllowed, &actual ) )
389  {
390  actual = std::max( 0, actual );
391  SEG padSeg( pad->GetPosition(), pad->GetPosition() );
393 
394  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
396  MessageTextFromValue( userUnits(), minClearance, true ),
397  MessageTextFromValue( userUnits(), actual, true ) );
398 
399  drcItem->SetErrorMessage( m_msg );
400  drcItem->SetItems( aRefSeg, pad );
401 
402  MARKER_PCB* marker = new MARKER_PCB( drcItem, GetLocation( aRefSeg, padSeg ) );
403  addMarkerToPcb( aCommit, marker );
404 
406  return;
407  }
408  }
409  }
410 
411  /***********************************************/
412  /* Phase 2: test DRC with other track segments */
413  /***********************************************/
414 
415  // Test the reference segment with other track segments
416  for( auto it = aStartIt; it != aEndIt; it++ )
417  {
418  TRACK* track = *it;
419 
420  // No problem if segments have the same net code:
421  if( aRefSeg->GetNetCode() == track->GetNetCode() )
422  continue;
423 
424  // No problem if tracks are on different layers:
425  // Note that while the general case of GetLayerSet intersection always works,
426  // the others are much faster.
427  bool sameLayers;
428 
429  if( aRefSeg->Type() == PCB_VIA_T )
430  {
431  if( track->Type() == PCB_VIA_T )
432  sameLayers = ( refLayerSet & track->GetLayerSet() ).any();
433  else
434  sameLayers = refLayerSet.test( track->GetLayer() );
435  }
436  else
437  {
438  if( track->Type() == PCB_VIA_T )
439  sameLayers = track->GetLayerSet().test( refLayer );
440  else
441  sameLayers = track->GetLayer() == refLayer;
442  }
443 
444  if( !sameLayers )
445  continue;
446 
447  // Preflight based on worst-case inflated bounding boxes:
448  EDA_RECT trackBB = track->GetBoundingBox();
449  trackBB.Inflate( m_largestClearance );
450 
451  if( !trackBB.Intersects( refSegBB ) )
452  continue;
453 
454  int minClearance = aRefSeg->GetClearance( track, &m_clearanceSource );
455  SEG trackSeg( track->GetStart(), track->GetEnd() );
456  int widths = ( refSegWidth + track->GetWidth() ) / 2;
457  int center2centerAllowed = minClearance + widths;
458 
459  // Avoid square-roots if possible (for performance)
460  SEG::ecoord center2center_squared = refSeg.SquaredDistance( trackSeg );
461  OPT_VECTOR2I intersection = refSeg.Intersect( trackSeg );
462 
463  // Check two tracks crossing first as it reports a DRCE without distances
464  if( intersection )
465  {
467  drcItem->SetErrorMessage( m_msg );
468  drcItem->SetItems( aRefSeg, track );
469 
470  MARKER_PCB* marker = new MARKER_PCB( drcItem, (wxPoint) intersection.get() );
471  addMarkerToPcb( aCommit, marker );
472 
474  return;
475  }
476  else if( center2center_squared < SEG::Square( center2centerAllowed ) )
477  {
478  int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
480 
481  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
483  MessageTextFromValue( userUnits(), minClearance, true ),
484  MessageTextFromValue( userUnits(), actual, true ) );
485 
486  drcItem->SetErrorMessage( m_msg );
487  drcItem->SetItems( aRefSeg, track );
488 
489  MARKER_PCB* marker = new MARKER_PCB( drcItem, GetLocation( aRefSeg, trackSeg ) );
490  addMarkerToPcb( aCommit, marker );
491 
493  return;
494  }
495  }
496 
497  /***************************************/
498  /* Phase 3: test DRC with copper zones */
499  /***************************************/
500  // Can be *very* time consumming.
501  if( aTestZones )
502  {
503  SEG testSeg( aRefSeg->GetStart(), aRefSeg->GetEnd() );
504 
505  for( ZONE_CONTAINER* zone : m_pcb->Zones() )
506  {
507  if( !( refLayerSet & zone->GetLayerSet() ).any() || zone->GetIsKeepout() )
508  continue;
509 
510  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
511  {
512  if( zone->GetFilledPolysList( layer ).IsEmpty() )
513  continue;
514 
515  if( zone->GetNetCode() && zone->GetNetCode() == aRefSeg->GetNetCode() )
516  continue;
517 
518  int minClearance = aRefSeg->GetClearance( zone, &m_clearanceSource );
519  int widths = refSegWidth / 2;
520  int center2centerAllowed = minClearance + widths;
521  SHAPE_POLY_SET* outline =
522  const_cast<SHAPE_POLY_SET*>( &zone->GetFilledPolysList( layer ) );
523 
524  SEG::ecoord center2center_squared = outline->SquaredDistance( testSeg );
525 
526  // to avoid false positive, due to rounding issues and approxiamtions
527  // in distance and clearance calculations, use a small threshold for distance
528  // (1 micron)
529  #define THRESHOLD_DIST Millimeter2iu( 0.001 )
530 
531  if( center2center_squared + THRESHOLD_DIST < SEG::Square( center2centerAllowed ) )
532  {
533  int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
535 
536  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
538  MessageTextFromValue( userUnits(), minClearance, true ),
539  MessageTextFromValue( userUnits(), actual, true ) );
540 
541  drcItem->SetErrorMessage( m_msg );
542  drcItem->SetItems( aRefSeg, zone );
543 
544  MARKER_PCB* marker = new MARKER_PCB( drcItem, GetLocation( aRefSeg, zone ) );
545  addMarkerToPcb( aCommit, marker );
546  }
547  }
548  }
549  }
550 
551  /***********************************************/
552  /* Phase 4: test DRC with to board edge */
553  /***********************************************/
555  {
556  int minClearance = bds.m_CopperEdgeClearance;
557  m_clearanceSource = _( "board edge" );
558 
559  static DRAWSEGMENT dummyEdge;
560  dummyEdge.SetLayer( Edge_Cuts );
561 
562  if( aRefSeg->GetRuleClearance( &dummyEdge, &minClearance, &m_clearanceSource ) )
563  /* minClearance and m_clearanceSource set in GetRuleClearance() */;
564 
565  SEG testSeg( aRefSeg->GetStart(), aRefSeg->GetEnd() );
566  int halfWidth = refSegWidth / 2;
567  int center2centerAllowed = minClearance + halfWidth;
568 
569  for( auto it = m_board_outlines.IterateSegmentsWithHoles(); it; it++ )
570  {
571  SEG::ecoord center2center_squared = testSeg.SquaredDistance( *it );
572 
573  if( center2center_squared < SEG::Square( center2centerAllowed ) )
574  {
575  VECTOR2I pt = testSeg.NearestPoint( *it );
576 
577  KICAD_T types[] = { PCB_LINE_T, EOT };
578  DRAWSEGMENT* edge = nullptr;
579  INSPECTOR_FUNC inspector =
580  [&] ( EDA_ITEM* item, void* testData )
581  {
582  DRAWSEGMENT* test_edge = dynamic_cast<DRAWSEGMENT*>( item );
583 
584  if( !test_edge || test_edge->GetLayer() != Edge_Cuts )
586 
587  if( test_edge->HitTest( (wxPoint) pt, minClearance + halfWidth ) )
588  {
589  edge = test_edge;
590  return SEARCH_RESULT::QUIT;
591  }
592 
594  };
595 
596  // Best-efforts search for edge segment
597  BOARD::IterateForward<BOARD_ITEM*>( m_pcb->Drawings(), inspector, nullptr, types );
598 
599  int actual = std::max( 0.0, sqrt( center2center_squared ) - halfWidth );
601 
602  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
604  MessageTextFromValue( userUnits(), minClearance, true ),
605  MessageTextFromValue( userUnits(), actual, true ) );
606 
607  drcItem->SetErrorMessage( m_msg );
608  drcItem->SetItems( aRefSeg, edge );
609 
610  MARKER_PCB* marker = new MARKER_PCB( drcItem, (wxPoint) pt );
611  addMarkerToPcb( aCommit, marker );
612  }
613  }
614  }
615 }
int GetMinAnnulus(wxString *aSource) const
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
Too small via size.
Definition: drc.h:53
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void GetWidthConstraints(int *aMin, int *aMax, wxString *aSource) const
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
int GetNetCode() const
Function GetNetCode.
std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a li...
Definition: base_struct.h:80
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
wxString m_msg
Definition: drc.h:142
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
items are too close together
Definition: drc.h:44
wxString m_Name
Definition: drc_rule.h:73
const wxPoint & GetStart() const
Definition: class_track.h:118
int m_largestClearance
Definition: drc.h:144
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
VECTOR2I::extended_type ecoord
Definition: seg.h:42
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
a copper item is too close to the board edge
Definition: drc.h:46
#define CLEARANCE_CONSTRAINT
Definition: drc_rule.h:35
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
EDA_UNITS userUnits() const
Definition: drc.h:155
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:37
Too small micro via size.
Definition: drc.h:58
SEG::ecoord SquaredDistance(VECTOR2I aPoint) const
Function SquaredDistance computes the minimum distance squared between aPoint and all the polygons in...
tracks are crossing
Definition: drc.h:45
#define THRESHOLD_DIST
static SEG::ecoord Square(int a)
Definition: seg.h:116
a disallowed item has been used
Definition: drc.h:43
bool Contains(const wxPoint &aPoint) const
Function Contains.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
wxString m_clearanceSource
Definition: drc.h:143
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
PCB_LAYER_ID
A quick note on layer IDs:
DRC_RULE * GetRule(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint)
Definition: drc_rule.cpp:67
LSET is a set of PCB_LAYER_IDs.
Track width is too small or too large.
Definition: drc.h:52
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
MODULES & Modules()
Definition: class_board.h:266
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:37
MINOPTMAX m_Clearance
Definition: drc_rule.h:79
SHAPE_POLY_SET.
int GetDrill() const
Function GetDrill returns the local drill setting for this VIA.
Definition: class_track.h:449
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
bool m_reportAllTrackErrors
Definition: drc.h:121
via's hole is bigger than its diameter
Definition: drc.h:56
const wxPoint GetPosition() const override
Definition: class_track.h:406
virtual int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
bool m_board_outline_valid
Definition: drc.h:127
Definition: seg.h:39
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
SHAPE_POLY_SET m_board_outlines
Definition: drc.h:126
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
int GetWidth() const
Definition: class_track.h:112
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
something is wrong with a pad or via stackup
Definition: drc.h:57
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
VIATYPE GetViaType() const
Definition: class_track.h:368
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
const wxPoint & GetEnd() const
Definition: class_track.h:115
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
bool m_MicroViasAllowed
true to allow micro vias
Via size and drill leave annulus too small or too large.
Definition: drc.h:54
static wxPoint GetLocation(TRACK *aTrack, ZONE_CONTAINER *aConflictZone)
Fetches a reasonable point for marking a violoation between two non-point objects.
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
int GetCopperLayerCount() const
Function GetCopperLayerCount.
DRAWINGS & Drawings()
Definition: class_board.h:275
virtual bool GetRuleClearance(BOARD_ITEM *aItem, int *aClearance, wxString *aSource) const
Function GetRuleClearance returns any rule-based clearance.
virtual LSET GetLayerSet() const
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
bool checkClearanceSegmToPad(const SEG &seg, int segWidth, const D_PAD *pad, int minClearance, int *aActualDist)
Check the distance from a pad to segment.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, addMarkerToPcb(), LSET::AllCuMask(), B_Cu, DIALOG_DRC::bds(), BLIND_BURIED, checkClearanceSegmToPad(), CLEARANCE_CONSTRAINT, EDA_RECT::Contains(), CONTINUE, DRC_ITEM::Create(), BOARD::Drawings(), DRCE_ALLOWED_ITEMS, DRCE_CLEARANCE, DRCE_COPPER_EDGE_CLEARANCE, DRCE_PADSTACK, DRCE_TOO_SMALL_MICROVIA, DRCE_TOO_SMALL_VIA, DRCE_TRACK_WIDTH, DRCE_TRACKS_CROSSING, DRCE_VIA_ANNULUS, DRCE_VIA_HOLE_BIGGER, Edge_Cuts, EOT, F_Cu, Format(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_DESIGN_SETTINGS::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetDRCEpsilon(), VIA::GetDrill(), VIA::GetDrillValue(), TRACK::GetEnd(), RC_ITEM::GetErrorText(), BOARD_ITEM::GetLayer(), BOARD::GetLayerName(), BOARD_ITEM::GetLayerSet(), D_PAD::GetLayerSet(), GetLocation(), VIA::GetMinAnnulus(), BOARD_CONNECTED_ITEM::GetNetCode(), VIA::GetPosition(), GetRule(), BOARD_CONNECTED_ITEM::GetRuleClearance(), TRACK::GetStart(), VIA::GetViaType(), TRACK::GetWidth(), TRACK::GetWidthConstraints(), DRAWSEGMENT::HitTest(), In1_Cu, EDA_RECT::Inflate(), EDA_RECT::Intersects(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), VIA::LayerPair(), BOARD_DESIGN_SETTINGS::m_BlindBuriedViaAllowed, m_board_outline_valid, m_board_outlines, DRC_RULE::m_Clearance, m_clearanceSource, BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, m_largestClearance, BOARD_DESIGN_SETTINGS::m_MicroViasAllowed, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, m_msg, DRC_RULE::m_Name, m_pcb, m_reportAllTrackErrors, BOARD_DESIGN_SETTINGS::m_ViasMinAnnulus, BOARD_DESIGN_SETTINGS::m_ViasMinSize, MessageTextFromValue(), MICROVIA, DRC_RULE::MINOPTMAX::Min, BOARD::Modules(), PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PCB_LINE_T, PCB_VIA_T, QUIT, RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), BOARD_ITEM::SetLayer(), D_PAD::SetLayerSet(), D_PAD::SetShape(), D_PAD::SetSize(), SEG::Square(), SEG::SquaredDistance(), SHAPE_POLY_SET::SquaredDistance(), THRESHOLD_DIST, EDA_ITEM::Type(), userUnits(), and BOARD::Zones().

Referenced by testTracks().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 161 of file pcb_tool_base.h.

162  {
163  return getEditFrame<PCB_BASE_EDIT_FRAME>();
164  }

Referenced by POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), EDIT_TOOL::Init(), SELECTION_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCBNEW_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), POINT_EDITOR::updateItem(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetLocation() [1/2]

wxPoint DRC::GetLocation ( TRACK aTrack,
ZONE_CONTAINER aConflictZone 
)
static

Fetches a reasonable point for marking a violoation between two non-point objects.

Definition at line 1387 of file pcbnew/drc/drc.cpp.

1388 {
1389  SHAPE_POLY_SET* conflictOutline;
1390 
1391  PCB_LAYER_ID l = aTrack->GetLayer();
1392 
1393  if( aConflictZone->IsFilled() )
1394  conflictOutline = const_cast<SHAPE_POLY_SET*>( &aConflictZone->GetFilledPolysList( l ) );
1395  else
1396  conflictOutline = aConflictZone->Outline();
1397 
1398  wxPoint pt1 = aTrack->GetPosition();
1399  wxPoint pt2 = aTrack->GetEnd();
1400 
1401  // If the mid-point is in the zone, then that's a fine place for the marker
1402  if( conflictOutline->SquaredDistance( ( pt1 + pt2 ) / 2 ) == 0 )
1403  return ( pt1 + pt2 ) / 2;
1404 
1405  // Otherwise do a binary search for a "good enough" marker location
1406  else
1407  {
1408  while( GetLineLength( pt1, pt2 ) > UI_EPSILON )
1409  {
1410  if( conflictOutline->SquaredDistance( pt1 ) < conflictOutline->SquaredDistance( pt2 ) )
1411  pt2 = ( pt1 + pt2 ) / 2;
1412  else
1413  pt1 = ( pt1 + pt2 ) / 2;
1414  }
1415 
1416  // Once we're within UI_EPSILON pt1 and pt2 are "equivalent"
1417  return pt1;
1418  }
1419 }
bool IsFilled() const
Definition: class_zone.h:185
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:206
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
const SHAPE_POLY_SET & GetFilledPolysList(PCB_LAYER_ID aLayer) const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:602
SEG::ecoord SquaredDistance(VECTOR2I aPoint) const
Function SquaredDistance computes the minimum distance squared between aPoint and all the polygons in...
const int UI_EPSILON
PCB_LAYER_ID
A quick note on layer IDs:
const wxPoint GetPosition() const override
Definition: class_track.h:108
SHAPE_POLY_SET.
const wxPoint & GetEnd() const
Definition: class_track.h:115
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References TRACK::GetEnd(), ZONE_CONTAINER::GetFilledPolysList(), BOARD_ITEM::GetLayer(), GetLineLength(), TRACK::GetPosition(), ZONE_CONTAINER::IsFilled(), ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::SquaredDistance(), and UI_EPSILON.

Referenced by DRC_KEEPOUT_TESTER::checkTracksAndVias(), doTrackDrc(), and testCopperDrawItem().

◆ GetLocation() [2/2]

wxPoint DRC::GetLocation ( TRACK aTrack,
const SEG aConflictSeg 
)
static

Definition at line 1422 of file pcbnew/drc/drc.cpp.

1423 {
1424  wxPoint pt1 = aTrack->GetPosition();
1425  wxPoint pt2 = aTrack->GetEnd();
1426 
1427  // Do a binary search along the track for a "good enough" marker location
1428  while( GetLineLength( pt1, pt2 ) > UI_EPSILON )
1429  {
1430  if( aConflictSeg.SquaredDistance( pt1 ) < aConflictSeg.SquaredDistance( pt2 ) )
1431  pt2 = ( pt1 + pt2 ) / 2;
1432  else
1433  pt1 = ( pt1 + pt2 ) / 2;
1434  }
1435 
1436  // Once we're within UI_EPSILON pt1 and pt2 are "equivalent"
1437  return pt1;
1438 }
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:206
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:37
const int UI_EPSILON
const wxPoint GetPosition() const override
Definition: class_track.h:108
const wxPoint & GetEnd() const
Definition: class_track.h:115

References TRACK::GetEnd(), GetLineLength(), TRACK::GetPosition(), SEG::SquaredDistance(), and UI_EPSILON.

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:284
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:286

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool PCB_TOOL_BASE::Init ( )
overridevirtualinherited

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Reimplemented in SELECTION_TOOL, EDIT_TOOL, DRAWING_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, FOOTPRINT_EDITOR_TOOLS, GLOBAL_EDIT_TOOL, PAD_TOOL, PCB_INSPECTION_TOOL, and ROUTER_TOOL.

Definition at line 237 of file pcb_tool_base.cpp.

238 {
239  // A basic context manu. Many (but not all) tools will choose to override this.
240 
241  auto& ctxMenu = m_menu.GetMenu();
242 
243  // cancel current tool goes in main context menu at the top if present
245  ctxMenu.AddSeparator( 1 );
246 
247  // Finally, add the standard zoom/grid items
248  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
249 
250  return true;
251 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

References CONDITIONAL_MENU::AddItem(), ACTIONS::cancelInteractive, TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::m_menu, and SELECTION_CONDITIONS::ShowAlways().

◆ IsDRCDialogShown()

bool DRC::IsDRCDialogShown ( )

Check to see if the DRC dialog is currently shown.

Returns
true if the dialog is shown

Definition at line 151 of file pcbnew/drc/drc.cpp.

152 {
153  if( m_drcDialog )
154  return m_drcDialog->IsShown();
155 
156  return false;
157 }
DIALOG_DRC * m_drcDialog
Definition: drc.h:128

References m_drcDialog.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

◆ LoadRules()

bool DRC::LoadRules ( )

Load the DRC rules.

Must be called after the netclasses have been read.

Definition at line 182 of file pcbnew/drc/drc.cpp.

183 {
184  wxString rulesFilepath = m_editFrame->Prj().AbsolutePath( "drc-rules" );
185  wxFileName rulesFile( rulesFilepath );
186 
187  if( rulesFile.FileExists() )
188  {
189  m_ruleSelectors.clear();
190  m_rules.clear();
191 
192  FILE* fp = wxFopen( rulesFilepath, wxT( "rt" ) );
193 
194  if( fp )
195  {
196  try
197  {
198  DRC_RULES_PARSER parser( m_pcb, fp, rulesFilepath );
199  parser.Parse( m_ruleSelectors, m_rules );
200  }
201  catch( PARSE_ERROR& pe )
202  {
203  // Don't leave possibly malformed stuff around for us to trip over
204  m_ruleSelectors.clear();
205  m_rules.clear();
206 
207  wxSafeYield( m_editFrame );
209  pe.lineNumber, pe.byteIndex );
210 
211  return false;
212  }
213  }
214  }
215 
216  std::reverse( std::begin( m_ruleSelectors ), std::end( m_ruleSelectors ) );
217 
220  bds.m_DRCRules = m_rules;
221 
222  return true;
223 }
std::vector< DRC_SELECTOR * > m_DRCRuleSelectors
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:270
BOARD * m_pcb
Definition: drc.h:125
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:125
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
std::vector< DRC_SELECTOR * > m_ruleSelectors
Definition: drc.h:135
Struct PARSE_ERROR contains a filename or source description, a problem input line,...
Definition: ki_exception.h:123
#define ID_RULES_EDITOR
#define _(s)
Definition: 3d_actions.cpp:33
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:126
std::vector< DRC_RULE * > m_DRCRules
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aErrorMsg=wxEmptyString, int aErrorCtrlId=-1, int aErrorLine=-1, int aErrorCol=-1)
Function ShowBoardSetupDialog.
std::vector< DRC_RULE * > m_rules
Definition: drc.h:136
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, PROJECT::AbsolutePath(), PARSE_ERROR::byteIndex, BOARD::GetDesignSettings(), ID_RULES_EDITOR, PARSE_ERROR::lineNumber, BOARD_DESIGN_SETTINGS::m_DRCRules, BOARD_DESIGN_SETTINGS::m_DRCRuleSelectors, m_editFrame, m_pcb, m_rules, m_ruleSelectors, DRC_RULES_PARSER::Parse(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), and IO_ERROR::What().

Referenced by RunTests().

◆ module()

◆ Reset()

void DRC::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 95 of file pcbnew/drc/drc.cpp.

96 {
97  m_editFrame = getEditFrame<PCB_EDIT_FRAME>();
98 
99  if( m_pcb != m_editFrame->GetBoard() )
100  {
101  if( m_drcDialog )
102  DestroyDRCDialog( wxID_OK );
103 
105  }
106 }
void DestroyDRCDialog(int aReason)
Deletes this ui dialog box and zeros out its pointer to remember the state of the dialog's existence.
BOARD * m_pcb
Definition: drc.h:125
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
DIALOG_DRC * m_drcDialog
Definition: drc.h:128
BOARD * GetBoard() const

References DestroyDRCDialog(), PCB_BASE_FRAME::GetBoard(), m_drcDialog, m_editFrame, and m_pcb.

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ RunTests()

void DRC::RunTests ( wxTextCtrl *  aMessages = NULL)

Run all the tests specified with a previous call to SetSettings()

Parameters
aMessages= a wxTextControl where to display some activity messages. Can be NULL

Definition at line 226 of file pcbnew/drc/drc.cpp.

227 {
228  // Make absolutely sure these are up-to-date
229  if( !LoadRules() )
230  return;
231 
232  wxASSERT( m_pcb == m_editFrame->GetBoard() );
233 
234  BOARD_COMMIT commit( m_editFrame );
236 
238 
239  if( !bds.Ignore( DRCE_INVALID_OUTLINE )
241  {
242  if( aMessages )
243  {
244  aMessages->AppendText( _( "Board Outline...\n" ) );
245  wxSafeYield();
246  }
247 
248  testOutline( commit );
249  }
250 
251  if( aMessages )
252  {
253  aMessages->AppendText( _( "Netclasses...\n" ) );
254  wxSafeYield();
255  }
256 
257  DRC_NETCLASS_TESTER netclassTester( [&]( MARKER_PCB* aMarker )
258  {
259  addMarkerToPcb( commit, aMarker );
260  } );
261 
262  if( !netclassTester.RunDRC( userUnits(), *m_pcb ) )
263  {
264  // testing the netclasses is a special case because if the netclasses
265  // do not pass the BOARD_DESIGN_SETTINGS checks, then every member of a net
266  // class (a NET) will cause its items such as tracks, vias, and pads
267  // to also fail. So quit after *all* netclass errors have been reported.
268  if( aMessages )
269  aMessages->AppendText( _( "Netclasses are not valid: Cannot run DRC\n"
270  "Please open Board Setup and\ncheck netclass definitions" ) );
271 
272  commit.Push( wxEmptyString, false, false );
273 
274  // update the m_drcDialog listboxes
275  updatePointers();
276 
277  return;
278  }
279 
280  // test pad to pad clearances, nothing to do with tracks, vias or zones.
281  if( !bds.Ignore( DRCE_COPPER_EDGE_CLEARANCE ) )
282  {
283  if( aMessages )
284  {
285  aMessages->AppendText( _( "Pad clearances...\n" ) );
286  wxSafeYield();
287  }
288 
289  testPadClearances( commit );
290  }
291 
292  // test drilled holes
294  || !bds.Ignore( DRCE_TOO_SMALL_DRILL )
296  {
297  if( aMessages )
298  {
299  aMessages->AppendText( _( "Drill sizes and clearances...\n" ) );
300  wxSafeYield();
301  }
302 
303  DRC_DRILLED_HOLE_TESTER tester( [&]( MARKER_PCB* aMarker )
304  {
305  addMarkerToPcb( commit, aMarker );
306  } );
307 
308  tester.RunDRC( userUnits(), *m_pcb );
309  }
310 
311  // caller (a wxTopLevelFrame) is the wxDialog or the Pcb Editor frame that call DRC:
312  wxWindow* caller = aMessages ? aMessages->GetParent() : m_editFrame;
313 
314  if( m_refillZones )
315  {
316  if( aMessages )
317  aMessages->AppendText( _( "Refilling all zones...\n" ) );
318 
319  m_toolMgr->GetTool<ZONE_FILLER_TOOL>()->FillAllZones( caller );
320  }
321  else
322  {
323  if( aMessages )
324  aMessages->AppendText( _( "Checking zone fills...\n" ) );
325 
326  m_toolMgr->GetTool<ZONE_FILLER_TOOL>()->CheckAllZones( caller );
327  }
328 
329  // test track and via clearances to other tracks, pads, and vias
330  if( aMessages )
331  {
332  aMessages->AppendText( _( "Track clearances...\n" ) );
333  wxSafeYield();
334  }
335 
336  testTracks( commit, aMessages ? aMessages->GetParent() : m_editFrame, true );
337 
338  // test zone clearances to other zones
339  if( aMessages )
340  {
341  aMessages->AppendText( _( "Zone to zone clearances...\n" ) );
342  wxSafeYield();
343  }
344 
345  testZones( commit );
346 
347  // find and gather unconnected pads.
349  && !bds.Ignore( DRCE_UNCONNECTED_ITEMS ) )
350  {
351  if( aMessages )
352  {
353  aMessages->AppendText( _( "Unconnected pads...\n" ) );
354  aMessages->Refresh();
355  }
356 
357  testUnconnected();
358  }
359 
360  // find and gather vias, tracks, pads inside keepout areas.
361  if( m_doKeepoutTest )
362  {
363  if( aMessages )
364  {
365  aMessages->AppendText( _( "Keepout areas ...\n" ) );
366  aMessages->Refresh();
367  }
368 
369  DRC_KEEPOUT_TESTER tester( [&]( MARKER_PCB* aMarker )
370  {
371  addMarkerToPcb( commit, aMarker );
372  } );
373 
374  tester.RunDRC( userUnits(), *m_pcb );
375  }
376 
377  // find and gather vias, tracks, pads inside text boxes.
378  if( !bds.Ignore( DRCE_CLEARANCE ) )
379  {
380  if( aMessages )
381  {
382  aMessages->AppendText( _( "Text and graphic clearances...\n" ) );
383  wxSafeYield();
384  }
385 
386  testCopperTextAndGraphics( commit );
387  }
388 
389  // test courtyards
391  || !bds.Ignore( DRCE_MISSING_COURTYARD )
393  || !bds.Ignore( DRCE_PTH_IN_COURTYARD )
394  || !bds.Ignore( DRCE_NPTH_IN_COURTYARD ) )
395  {
396  if( aMessages )
397  {
398  aMessages->AppendText( _( "Courtyard areas...\n" ) );
399  aMessages->Refresh();
400  }
401 
402  DRC_COURTYARD_TESTER tester( [&]( MARKER_PCB* aMarker )
403  {
404  addMarkerToPcb( commit, aMarker );
405  } );
406 
407  tester.RunDRC( userUnits(), *m_pcb );
408  }
409 
410  for( DRC_ITEM* footprintItem : m_footprints )
411  delete footprintItem;
412 
413  m_footprints.clear();
414  m_footprintsTested = false;
415 
416  if( m_testFootprints && !Kiface().IsSingle() )
417  {
418  if( aMessages )
419  {
420  aMessages->AppendText( _( "Checking footprints against schematic...\n" ) );
421  aMessages->Refresh();
422  }
423 
424  NETLIST netlist;
426 
427  if( m_drcDialog )
428  m_drcDialog->Raise();
429 
430  TestFootprints( netlist, m_pcb, m_footprints );
431  m_footprintsTested = true;
432  }
433 
434  // Check if there are items on disabled layers
435  if( !bds.Ignore( DRCE_DISABLED_LAYER_ITEM ) )
436  {
437  if( aMessages )
438  {
439  aMessages->AppendText( _( "Items on disabled layers...\n" ) );
440  aMessages->Refresh();
441  }
442 
443  testDisabledLayers( commit );
444  }
445 
446  if( !bds.Ignore( DRCE_UNRESOLVED_VARIABLE ) )
447  {
448  if( aMessages )
449  {
450  aMessages->AppendText( _( "Unresolved text variables...\n" ) );
451  aMessages->Refresh();
452  }
453 
454  DRC_TEXTVAR_TESTER tester( [&]( MARKER_PCB* aMarker )
455  {
456  addMarkerToPcb( commit, aMarker );
457  },
459 
460  tester.RunDRC( userUnits(), *m_pcb );
461  }
462 
463  commit.Push( wxEmptyString, false, false );
464  m_drcRun = true;
465 
466  // update the m_drcDialog listboxes
467  updatePointers();
468 
469  if( aMessages )
470  {
471  // no newline on this one because it is last, don't want the window
472  // to unnecessarily scroll.
473  aMessages->AppendText( _( "Finished" ) );
474  }
475 }
bool m_refillZones
Definition: drc.h:120
std::vector< DRC_ITEM * > m_footprints
Definition: drc.h:131
overlapping drilled holes break drill bits
Definition: drc.h:51
bool RunDRC(EDA_UNITS aUnits, BOARD &aBoard) override
Runs this provider against the given PCB with configured options (if any).
items are too close together
Definition: drc.h:44
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
void testTracks(BOARD_COMMIT &aCommit, wxWindow *aActiveWindow, bool aShowProgressBar)
Perform the DRC on all tracks.
int m_largestClearance
Definition: drc.h:144
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
void testCopperTextAndGraphics(BOARD_COMMIT &aCommit)
a copper item is too close to the board edge
Definition: drc.h:46
void testZones(BOARD_COMMIT &aCommit)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
footprint has a courtyard but malformed (not convertible to a closed polygon with holes)
Definition: drc.h:63
EDA_UNITS userUnits() const
Definition: drc.h:155
bool RunDRC(EDA_UNITS aUnits, BOARD &aBoard) override
Runs this provider against the given PCB with configured options (if any).
void TestFootprints(NETLIST &aNetlist, BOARD *aBoard, std::vector< DRC_ITEM * > &aDRCList)
BOARD * m_pcb
Definition: drc.h:125
bool m_testFootprints
Definition: drc.h:122
bool m_doKeepoutTest
Definition: drc.h:119
ZONE_FILLER_TOOL.
NETLIST stores all of information read from a netlist along with the flags used to update the NETLIST...
Definition: pcb_netlist.h:212
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
item on a disabled layer
Definition: drc.h:67
void updatePointers()
Update needed pointers from the one pointer which is known not to change.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
invalid board outline
Definition: drc.h:68
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
Too small via or pad drill.
Definition: drc.h:55
bool m_drcRun
Definition: drc.h:132
bool LoadRules()
Load the DRC rules.
Too small micro via drill.
Definition: drc.h:59
bool m_footprintsTested
Definition: drc.h:133
bool RunDRC(EDA_UNITS aUnits, BOARD &aBoard) override
Runs this provider against the given PCB with configured options (if any).
KIGFX::WS_PROXY_VIEW_ITEM * GetWorksheet() const
#define _(s)
Definition: 3d_actions.cpp:33
footprint has no courtyard defined
Definition: drc.h:62
items are unconnected
Definition: drc.h:42
footprint courtyards overlap
Definition: drc.h:61
void testPadClearances(BOARD_COMMIT &aCommit)
void testDisabledLayers(BOARD_COMMIT &aCommit)
DIALOG_DRC * m_drcDialog
Definition: drc.h:128
BOARD * GetBoard() const
void testUnconnected()
void testOutline(BOARD_COMMIT &aCommit)
Test that the board outline is contiguous and composed of valid elements.
bool FetchNetlistFromSchematic(NETLIST &aNetlist, FETCH_NETLIST_MODE aMode)
bool m_doUnconnectedTest
Definition: drc.h:117
bool RunDRC(EDA_UNITS aUnits, BOARD &aBoard) override
Runs this provider against the given PCB with configured options (if any).
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, addMarkerToPcb(), PCB_EDIT_FRAME::ANNOTATION_DIALOG, DRCE_CLEARANCE, DRCE_COPPER_EDGE_CLEARANCE, DRCE_DISABLED_LAYER_ITEM, DRCE_DRILLED_HOLES_TOO_CLOSE, DRCE_INVALID_OUTLINE, DRCE_MALFORMED_COURTYARD, DRCE_MISSING_COURTYARD, DRCE_NPTH_IN_COURTYARD, DRCE_OVERLAPPING_FOOTPRINTS, DRCE_PTH_IN_COURTYARD, DRCE_TOO_SMALL_DRILL, DRCE_TOO_SMALL_MICROVIA_DRILL, DRCE_UNCONNECTED_ITEMS, DRCE_UNRESOLVED_VARIABLE, PCB_EDIT_FRAME::FetchNetlistFromSchematic(), BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetDesignSettings(), TOOL_MANAGER::GetTool(), PCB_DRAW_PANEL_GAL::GetWorksheet(), BOARD_DESIGN_SETTINGS::Ignore(), Kiface(), LoadRules(), m_doKeepoutTest, m_doUnconnectedTest, m_drcDialog, m_drcRun, m_editFrame, m_footprints, m_footprintsTested, m_largestClearance, m_pcb, m_refillZones, m_testFootprints, TOOL_BASE::m_toolMgr, DRC_COURTYARD_TESTER::RunDRC(), DRC_TEXTVAR_TESTER::RunDRC(), DRC_KEEPOUT_TESTER::RunDRC(), DRC_DRILLED_HOLE_TESTER::RunDRC(), testCopperTextAndGraphics(), testDisabledLayers(), TestFootprints(), testOutline(), testPadClearances(), testTracks(), testUnconnected(), testZones(), updatePointers(), and userUnits().

Referenced by DIALOG_DRC::OnRunDRCClick().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 275 of file pcb_tool_base.cpp.

276 {
277  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
278  const auto& selection = selTool->GetSelection();
279  return selection;
280 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

References TOOL_MANAGER::GetTool(), and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 283 of file pcb_tool_base.cpp.

284 {
285  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
286  auto& selection = selTool->GetSelection();
287  return selection;
288 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

References TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, and PCB_TOOL_BASE::selection().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetEditModules()

void PCB_TOOL_BASE::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

Toggles edit module mode. When enabled, one may select parts of modules individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 101 of file pcb_tool_base.h.

102  {
103  m_editModules = aEnabled;
104  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void DRC::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1378 of file pcbnew/drc/drc.cpp.

1379 {
1380  Go( &DRC::ShowDRCDialog, PCB_ACTIONS::runDRC.MakeEvent() );
1381 }
void ShowDRCDialog(wxWindow *aParent)
Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and create...
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION runDRC
Definition: pcb_actions.h:320

References TOOL_INTERACTIVE::Go(), PCB_ACTIONS::runDRC, and ShowDRCDialog().

◆ ShowDRCDialog() [1/2]

void DRC::ShowDRCDialog ( wxWindow *  aParent)

Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and creates the MARKERS.

The dialog is only created if it is not already in existence.

Parameters
aParentis the parent window for wxWidgets. Usually the PCB editor frame but can be another dialog if aParent == NULL (default), the parent will be the PCB editor frame and the dialog will be not modal (just float on parent if aParent is specified, the dialog will be modal. The modal mode is mandatory if the dialog is created from another dialog, not from the PCB editor frame

Definition at line 109 of file pcbnew/drc/drc.cpp.

110 {
111  bool show_dlg_modal = true;
112 
113  // the dialog needs a parent frame. if it is not specified, this is
114  // the PCB editor frame specified in DRC class.
115  if( !aParent )
116  {
117  // if any parent is specified, the dialog is modal.
118  // if this is the default PCB editor frame, it is not modal
119  show_dlg_modal = false;
120  aParent = m_editFrame;
121  }
122 
123  Activate();
125 
126  if( !m_drcDialog )
127  {
128  m_drcDialog = new DIALOG_DRC( this, m_editFrame, aParent );
129  updatePointers();
130 
131  if( show_dlg_modal )
132  m_drcDialog->ShowModal();
133  else
134  m_drcDialog->Show( true );
135  }
136  else // The dialog is just not visible (because the user has double clicked on an error item)
137  {
138  updatePointers();
139  m_drcDialog->Show( true );
140  }
141 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
void updatePointers()
Update needed pointers from the one pointer which is known not to change.
friend class DIALOG_DRC
Definition: drc.h:107
bool Show(bool show) override
void Activate()
Function Activate() Runs the tool.
DIALOG_DRC * m_drcDialog
Definition: drc.h:128

References TOOL_INTERACTIVE::Activate(), DIALOG_DRC, m_drcDialog, m_editFrame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, DIALOG_SHIM::Show(), and updatePointers().

Referenced by DIALOG_PLOT::onRunDRC(), setTransitions(), and ShowDRCDialog().

◆ ShowDRCDialog() [2/2]

int DRC::ShowDRCDialog ( const TOOL_EVENT aEvent)

Definition at line 144 of file pcbnew/drc/drc.cpp.

145 {
146  ShowDRCDialog( nullptr );
147  return 0;
148 }
void ShowDRCDialog(wxWindow *aParent)
Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and create...

References ShowDRCDialog().

◆ testCopperDrawItem()

void DRC::testCopperDrawItem ( BOARD_COMMIT aCommit,
BOARD_ITEM aDrawing 
)
private

Definition at line 907 of file pcbnew/drc/drc.cpp.

908 {
909  EDA_RECT bbox;
910  std::vector<SEG> itemShape;
911  int itemWidth;
912  DRAWSEGMENT* drawItem = dynamic_cast<DRAWSEGMENT*>( aItem );
913  EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aItem );
914 
915  if( drawItem )
916  {
917  bbox = drawItem->GetBoundingBox();
918  itemWidth = drawItem->GetWidth();
919 
920  switch( drawItem->GetShape() )
921  {
922  case S_ARC:
923  {
924  SHAPE_ARC arc( drawItem->GetCenter(), drawItem->GetArcStart(),
925  (double) drawItem->GetAngle() / 10.0 );
926 
927  SHAPE_LINE_CHAIN l = arc.ConvertToPolyline();
928 
929  for( int i = 0; i < l.SegmentCount(); i++ )
930  itemShape.push_back( l.Segment( i ) );
931 
932  break;
933  }
934 
935  case S_SEGMENT:
936  itemShape.emplace_back( SEG( drawItem->GetStart(), drawItem->GetEnd() ) );
937  break;
938 
939  case S_RECT:
940  {
941  std::vector<wxPoint> pts;
942  drawItem->GetRectCorners( &pts );
943 
944  itemShape.emplace_back( SEG( pts[0], pts[1] ) );
945  itemShape.emplace_back( SEG( pts[1], pts[2] ) );
946  itemShape.emplace_back( SEG( pts[2], pts[3] ) );
947  itemShape.emplace_back( SEG( pts[3], pts[0] ) );
948  }
949  break;
950 
951  case S_CIRCLE:
952  {
953  // SHAPE_CIRCLE has no ConvertToPolyline() method, so use a 360.0 SHAPE_ARC
954  SHAPE_ARC circle( drawItem->GetCenter(), drawItem->GetEnd(), 360.0 );
955 
956  SHAPE_LINE_CHAIN l = circle.ConvertToPolyline();
957 
958  for( int i = 0; i < l.SegmentCount(); i++ )
959  itemShape.push_back( l.Segment( i ) );
960 
961  break;
962  }
963 
964  case S_CURVE:
965  {
966  drawItem->RebuildBezierToSegmentsPointsList( drawItem->GetWidth() );
967  wxPoint start_pt = drawItem->GetBezierPoints()[0];
968 
969  for( unsigned int jj = 1; jj < drawItem->GetBezierPoints().size(); jj++ )
970  {
971  wxPoint end_pt = drawItem->GetBezierPoints()[jj];
972  itemShape.emplace_back( SEG( start_pt, end_pt ) );
973  start_pt = end_pt;
974  }
975 
976  break;
977  }
978 
979  case S_POLYGON:
980  {
981  SHAPE_LINE_CHAIN l = drawItem->GetPolyShape().Outline( 0 );
982 
983  for( int i = 0; i < l.SegmentCount(); i++ )
984  itemShape.push_back( l.Segment( i ) );
985  }
986  break;
987 
988  default:
989  wxFAIL_MSG( "DRC::testCopperDrawItem unsupported DRAWSEGMENT shape: "
990  + STROKE_T_asString( drawItem->GetShape() ) );
991  break;
992  }
993  }
994  else if( textItem )
995  {
996  bbox = textItem->GetTextBox();
997  itemWidth = textItem->GetEffectiveTextPenWidth();
998 
999  std::vector<wxPoint> textShape;
1000  textItem->TransformTextShapeToSegmentList( textShape );
1001 
1002  for( unsigned jj = 0; jj < textShape.size(); jj += 2 )
1003  itemShape.emplace_back( SEG( textShape[jj], textShape[jj+1] ) );
1004  }
1005  else
1006  {
1007  wxFAIL_MSG( "unknown item type in testCopperDrawItem()" );
1008  return;
1009  }
1010 
1011  SHAPE_RECT rect_area( bbox.GetX(), bbox.GetY(), bbox.GetWidth(), bbox.GetHeight() );
1012 
1013  if( itemShape.empty() )
1014  return;
1015 
1016  // Test tracks and vias
1017  for( auto track : m_pcb->Tracks() )
1018  {
1019  if( !track->IsOnLayer( aItem->GetLayer() ) )
1020  continue;
1021 
1022  int minClearance = track->GetClearance( aItem, &m_clearanceSource );
1023  int widths = ( track->GetWidth() + itemWidth ) / 2;
1024  int center2centerAllowed = minClearance + widths;
1025 
1026  SEG trackSeg( track->GetStart(), track->GetEnd() );
1027 
1028  // Fast test to detect a track segment candidate inside the text bounding box
1029  if( !rect_area.Collide( trackSeg, center2centerAllowed ) )
1030  continue;
1031 
1032  OPT<SEG> minSeg;
1033  SEG::ecoord center2center_squared = 0;
1034 
1035  for( const SEG& itemSeg : itemShape )
1036  {
1037  SEG::ecoord thisDist_squared = trackSeg.SquaredDistance( itemSeg );
1038 
1039  if( !minSeg || thisDist_squared < center2center_squared )
1040  {
1041  minSeg = itemSeg;
1042  center2center_squared = thisDist_squared;
1043  }
1044  }
1045 
1046  if( center2center_squared < SEG::Square( center2centerAllowed ) )
1047  {
1048  int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
1050 
1051  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
1053  MessageTextFromValue( userUnits(), minClearance, true ),
1054  MessageTextFromValue( userUnits(), actual, true ) );
1055 
1056  drcItem->SetErrorMessage( m_msg );
1057  drcItem->SetItems( track, aItem );
1058 
1059  wxPoint pos = GetLocation( track, minSeg.get() );
1060  MARKER_PCB* marker = new MARKER_PCB( drcItem, pos );
1061  addMarkerToPcb( aCommit, marker );
1062  }
1063  }
1064 
1065  // Test pads
1066  for( auto pad : m_pcb->GetPads() )
1067  {
1068  if( !pad->IsOnLayer( aItem->GetLayer() ) )
1069  continue;
1070 
1071  // Graphic items are allowed to act as net-ties within their own footprint
1072  if( drawItem && pad->GetParent() == drawItem->GetParent() )
1073  continue;
1074 
1075  int minClearance = pad->GetClearance( aItem, &m_clearanceSource );
1076  int widths = itemWidth / 2;
1077  int center2centerAllowed = minClearance + widths;
1078 
1079  // Fast test to detect a pad candidate inside the text bounding box
1080  // Finer test (time consumming) is made only for pads near the text.
1081  int bb_radius = pad->GetBoundingRadius() + minClearance;
1082 
1083  if( !rect_area.Collide( SEG( pad->GetPosition(), pad->GetPosition() ), bb_radius ) )
1084  continue;
1085 
1086  SHAPE_POLY_SET padOutline;
1087  pad->TransformShapeWithClearanceToPolygon( padOutline, 0 );
1088 
1089  OPT<SEG> minSeg;
1090  SEG::ecoord center2center_squared = 0;
1091 
1092  for( const SEG& itemSeg : itemShape )
1093  {
1094  SEG::ecoord thisCenter2center_squared = padOutline.SquaredDistance( itemSeg );
1095 
1096  if( !minSeg || thisCenter2center_squared < center2center_squared )
1097  {
1098  minSeg = itemSeg;
1099  center2center_squared = thisCenter2center_squared;
1100  }
1101  }
1102 
1103  if( center2center_squared < SEG::Square( center2centerAllowed ) )
1104  {
1105  int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
1107 
1108  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
1110  MessageTextFromValue( userUnits(), minClearance, true ),
1111  MessageTextFromValue( userUnits(), actual, true ) );
1112 
1113  drcItem->SetErrorMessage( m_msg );
1114  drcItem->SetItems( pad, aItem );
1115 
1116  MARKER_PCB* marker = new MARKER_PCB( drcItem, pad->GetPosition() );
1117  addMarkerToPcb( aCommit, marker );
1118  }
1119  }
1120 }
wxString m_msg
Definition: drc.h:142
items are too close together
Definition: drc.h:44
const wxPoint GetCenter() const override
Function GetCenter()
int GetX() const
Definition: eda_rect.h:111
STROKE_T GetShape() const
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
polygon (not yet used for tracks, but could be in microwave apps)
VECTOR2I::extended_type ecoord
Definition: seg.h:42
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:217
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
int GetWidth() const
Definition: eda_rect.h:119
usual segment : line with rounded ends
EDA_UNITS userUnits() const
Definition: drc.h:155
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:37
SEG::ecoord SquaredDistance(VECTOR2I aPoint) const
Function SquaredDistance computes the minimum distance squared between aPoint and all the polygons in...
const std::vector< wxPoint > & GetBezierPoints() const
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
static SEG::ecoord Square(int a)
Definition: seg.h:116
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:152
wxString m_clearanceSource
Definition: drc.h:143
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:112
segment with non rounded ends
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Arcs (with rounded ends)
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
void TransformTextShapeToSegmentList(std::vector< wxPoint > &aCornerBuffer) const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:578
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
const wxPoint & GetArcStart() const
SHAPE_POLY_SET & GetPolyShape()
Bezier Curve.
int SegmentCount() const
Function SegmentCount()
int GetHeight() const
Definition: eda_rect.h:120
int GetWidth() const
Definition: seg.h:39
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
static wxString STROKE_T_asString(STROKE_T a)
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
double GetAngle() const
SEG Segment(int aIndex)
Function Segment()
#define _(s)
Definition: 3d_actions.cpp:33
SHAPE_LINE_CHAIN.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetY() const
Definition: eda_rect.h:112
boost::optional< T > OPT
Definition: optional.h:7
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
static wxPoint GetLocation(TRACK *aTrack, ZONE_CONTAINER *aConflictZone)
Fetches a reasonable point for marking a violoation between two non-point objects.
void GetRectCorners(std::vector< wxPoint > *pts) const
BOARD_ITEM_CONTAINER * GetParent() const
TRACKS & Tracks()
Definition: class_board.h:257
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References _, addMarkerToPcb(), DRC_ITEM::Create(), DRCE_CLEARANCE, DRAWSEGMENT::GetAngle(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetBezierPoints(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::GetCenter(), EDA_TEXT::GetEffectiveTextPenWidth(), DRAWSEGMENT::GetEnd(), RC_ITEM::GetErrorText(), EDA_RECT::GetHeight(), BOARD_ITEM::GetLayer(), GetLocation(), BOARD::GetPads(), BOARD_ITEM::GetParent(), DRAWSEGMENT::GetPolyShape(), DRAWSEGMENT::GetRectCorners(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), EDA_TEXT::GetTextBox(), DRAWSEGMENT::GetWidth(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), m_clearanceSource, m_msg, m_pcb, MessageTextFromValue(), SHAPE_POLY_SET::Outline(), DRAWSEGMENT::RebuildBezierToSegmentsPointsList(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SHAPE_LINE_CHAIN::Segment(), SHAPE_LINE_CHAIN::SegmentCount(), RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), SEG::Square(), SEG::SquaredDistance(), SHAPE_POLY_SET::SquaredDistance(), STROKE_T_asString(), BOARD::Tracks(), EDA_TEXT::TransformTextShapeToSegmentList(), and userUnits().

Referenced by testCopperTextAndGraphics().

◆ testCopperTextAndGraphics()

void DRC::testCopperTextAndGraphics ( BOARD_COMMIT aCommit)
private

Definition at line 869 of file pcbnew/drc/drc.cpp.

870 {
871  // Test copper items for clearance violations with vias, tracks and pads
872 
873  for( BOARD_ITEM* brdItem : m_pcb->Drawings() )
874  {
875  if( IsCopperLayer( brdItem->GetLayer() ) )
876  testCopperDrawItem( aCommit, brdItem );
877  }
878 
879  for( MODULE* module : m_pcb->Modules() )
880  {
881  TEXTE_MODULE& ref = module->Reference();
882  TEXTE_MODULE& val = module->Value();
883 
884  if( ref.IsVisible() && IsCopperLayer( ref.GetLayer() ) )
885  testCopperDrawItem( aCommit, &ref );
886 
887  if( val.IsVisible() && IsCopperLayer( val.GetLayer() ) )
888  testCopperDrawItem( aCommit, &val );
889 
890  if( module->IsNetTie() )
891  continue;
892 
893  for( BOARD_ITEM* item : module->GraphicalItems() )
894  {
895  if( IsCopperLayer( item->GetLayer() ) )
896  {
897  if( item->Type() == PCB_MODULE_TEXT_T && ( (TEXTE_MODULE*) item )->IsVisible() )
898  testCopperDrawItem( aCommit, item );
899  else if( item->Type() == PCB_MODULE_EDGE_T )
900  testCopperDrawItem( aCommit, item );
901  }
902  }
903  }
904 }
TEXTE_MODULE & Reference()
Definition: class_module.h:474
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool IsVisible() const
Definition: eda_text.h:185
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD * m_pcb
Definition: drc.h:125
void testCopperDrawItem(BOARD_COMMIT &aCommit, BOARD_ITEM *aDrawing)
bool IsNetTie() const
Definition: class_module.h:263
MODULES & Modules()
Definition: class_board.h:266
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:473
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
MODULE * module() const
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
DRAWINGS & Drawings()
Definition: class_board.h:275

References BOARD::Drawings(), BOARD_ITEM::GetLayer(), MODULE::GraphicalItems(), IsCopperLayer(), MODULE::IsNetTie(), EDA_TEXT::IsVisible(), m_pcb, PCB_TOOL_BASE::module(), BOARD::Modules(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, MODULE::Reference(), testCopperDrawItem(), and MODULE::Value().

Referenced by RunTests().

◆ testDisabledLayers()

void DRC::testDisabledLayers ( BOARD_COMMIT aCommit)
private

Definition at line 1149 of file pcbnew/drc/drc.cpp.

1150 {
1151  LSET disabledLayers = m_pcb->GetEnabledLayers().flip();
1152 
1153  // Perform the test only for copper layers
1154  disabledLayers &= LSET::AllCuMask();
1155 
1156  for( TRACK* track : m_pcb->Tracks() )
1157  {
1158  if( disabledLayers.test( track->GetLayer() ) )
1159  {
1161 
1162  m_msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
1163  track->GetLayerName() );
1164 
1165  drcItem->SetErrorMessage( m_msg );
1166  drcItem->SetItems( track );
1167 
1168  MARKER_PCB* marker = new MARKER_PCB( drcItem, track->GetPosition() );
1169  addMarkerToPcb( aCommit, marker );
1170  }
1171  }
1172 
1173  for( MODULE* module : m_pcb->Modules() )
1174  {
1176  [&]( BOARD_ITEM* child )
1177  {
1178  if( disabledLayers.test( child->GetLayer() ) )
1179  {
1181 
1182  m_msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
1183  child->GetLayerName() );
1184 
1185  drcItem->SetErrorMessage( m_msg );
1186  drcItem->SetItems( child );
1187 
1188  MARKER_PCB* marker = new MARKER_PCB( drcItem, child->GetPosition() );
1189  addMarkerToPcb( aCommit, marker );
1190  }
1191  } );
1192  }
1193 
1194  for( ZONE_CONTAINER* zone : m_pcb->Zones() )
1195  {
1196  if( disabledLayers.test( zone->GetLayer() ) )
1197  {
1199 
1200  m_msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
1201  zone->GetLayerName() );
1202 
1203  drcItem->SetErrorMessage( m_msg );
1204  drcItem->SetItems( zone );
1205 
1206  MARKER_PCB* marker = new MARKER_PCB( drcItem, zone->GetPosition() );
1207  addMarkerToPcb( aCommit, marker );
1208  }
1209  }
1210 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
wxString m_msg
Definition: drc.h:142
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
virtual const wxPoint GetPosition() const
Definition: base_struct.h:337
LSET is a set of PCB_LAYER_IDs.
MODULES & Modules()
Definition: class_board.h:266
item on a disabled layer
Definition: drc.h:67
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:33
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
TRACKS & Tracks()
Definition: class_board.h:257

References _, addMarkerToPcb(), LSET::AllCuMask(), DRC_ITEM::Create(), DRCE_DISABLED_LAYER_ITEM, BOARD::GetEnabledLayers(), RC_ITEM::GetErrorText(), BOARD_ITEM::GetLayer(), BOARD_ITEM::GetLayerName(), EDA_ITEM::GetPosition(), m_msg, m_pcb, PCB_TOOL_BASE::module(), BOARD::Modules(), MODULE::RunOnChildren(), RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), BOARD::Tracks(), and BOARD::Zones().

Referenced by RunTests().

◆ testOutline()

void DRC::testOutline ( BOARD_COMMIT aCommit)
private

Test that the board outline is contiguous and composed of valid elements.

Definition at line 1123 of file pcbnew/drc/drc.cpp.

1124 {
1126 
1128  m_board_outline_valid = false;
1129 
1130  if( m_pcb->GetBoardPolygonOutlines( m_board_outlines, nullptr, &error_loc ) )
1131  {
1132  m_board_outline_valid = true;
1133  }
1134  else
1135  {
1137 
1138  m_msg.Printf( drcItem->GetErrorText() + _( " (not a closed shape)" ) );
1139 
1140  drcItem->SetErrorMessage( m_msg );
1141  drcItem->SetItems( m_pcb );
1142 
1143  MARKER_PCB* marker = new MARKER_PCB( drcItem, error_loc );
1144  addMarkerToPcb( aCommit, marker );
1145  }
1146 }
wxString m_msg
Definition: drc.h:142
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:793
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
const wxPoint GetPosition() const
Definition: eda_rect.h:115
invalid board outline
Definition: drc.h:68
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, wxString *aErrorText=nullptr, wxPoint *aErrorLocation=nullptr)
Function GetBoardPolygonOutlines Extracts the board outlines and build a closed polygon from lines,...
bool m_board_outline_valid
Definition: drc.h:127
SHAPE_POLY_SET m_board_outlines
Definition: drc.h:126
#define _(s)
Definition: 3d_actions.cpp:33
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117

References _, addMarkerToPcb(), DRC_ITEM::Create(), DRCE_INVALID_OUTLINE, BOARD::GetBoardEdgesBoundingBox(), BOARD::GetBoardPolygonOutlines(), RC_ITEM::GetErrorText(), EDA_RECT::GetPosition(), m_board_outline_valid, m_board_outlines, m_msg, m_pcb, SHAPE_POLY_SET::RemoveAllContours(), RC_ITEM::SetErrorMessage(), and RC_ITEM::SetItems().

Referenced by RunTests().

◆ testPadClearances()

void DRC::testPadClearances ( BOARD_COMMIT aCommit)
private

Definition at line 496 of file pcbnew/drc/drc.cpp.

497 {
499  std::vector<D_PAD*> sortedPads;
500 
501  m_pcb->GetSortedPadListByXthenYCoord( sortedPads );
502 
503  if( sortedPads.empty() )
504  return;
505 
506  // find the max size of the pads (used to stop the pad-to-pad tests)
507  int max_size = 0;
508 
509  for( D_PAD* pad : sortedPads )
510  {
511  // GetBoundingRadius() is the radius of the minimum sized circle fully containing the pad
512  int radius = pad->GetBoundingRadius();
513 
514  if( radius > max_size )
515  max_size = radius;
516  }
517 
518  // Better to be fast than accurate; this keeps us from having to look up / calculate the
519  // actual clearances
520  max_size += m_largestClearance;
521 
522  // Upper limit of pad list (limit not included)
523  D_PAD** listEnd = &sortedPads[0] + sortedPads.size();
524 
525  // Test the pads
526  for( auto& pad : sortedPads )
527  {
529  {
530  int minClearance = bds.m_CopperEdgeClearance;
531  m_clearanceSource = _( "board edge" );
532 
533  static DRAWSEGMENT dummyEdge;
534  dummyEdge.SetLayer( Edge_Cuts );
535 
536  if( pad->GetRuleClearance( &dummyEdge, &minClearance, &m_clearanceSource ) )
537  /* minClearance and m_clearanceSource set in GetRuleClearance() */;
538 
539  for( auto it = m_board_outlines.IterateSegmentsWithHoles(); it; it++ )
540  {
541  int actual;
542 
543  if( !checkClearanceSegmToPad( *it, 0, pad, minClearance, &actual ) )
544  {
545  actual = std::max( 0, actual );
547 
548  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
550  MessageTextFromValue( userUnits(), minClearance, true ),
551  MessageTextFromValue( userUnits(), actual, true ) );
552 
553  drcItem->SetErrorMessage( m_msg );
554  drcItem->SetItems( pad );
555 
556  MARKER_PCB* marker = new MARKER_PCB( drcItem, pad->GetPosition() );
557  addMarkerToPcb( aCommit, marker );
558 
559  break;
560  }
561  }
562  }
563 
564  if( !bds.Ignore( DRCE_CLEARANCE ) )
565  {
566  int x_limit = pad->GetPosition().x + pad->GetBoundingRadius() + max_size;
567 
568  doPadToPadsDrc( aCommit, pad, &pad, listEnd, x_limit );
569  }
570  }
571 }
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
wxString m_msg
Definition: drc.h:142
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
items are too close together
Definition: drc.h:44
int m_largestClearance
Definition: drc.h:144
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
void GetSortedPadListByXthenYCoord(std::vector< D_PAD * > &aVector, int aNetCode=-1)
Function GetSortedPadListByXthenYCoord first empties then fills the vector with all pads and sorts th...
a copper item is too close to the board edge
Definition: drc.h:46
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
EDA_UNITS userUnits() const
Definition: drc.h:155
bool doPadToPadsDrc(BOARD_COMMIT &aCommit, D_PAD *aRefPad, D_PAD **aStart, D_PAD **aEnd, int x_limit)
Test the clearance between aRefPad and other pads.
wxString m_clearanceSource
Definition: drc.h:143
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
bool m_board_outline_valid
Definition: drc.h:127
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
SHAPE_POLY_SET m_board_outlines
Definition: drc.h:126
#define _(s)
Definition: 3d_actions.cpp:33
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
bool checkClearanceSegmToPad(const SEG &seg, int segWidth, const D_PAD *pad, int minClearance, int *aActualDist)
Check the distance from a pad to segment.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, addMarkerToPcb(), checkClearanceSegmToPad(), DRC_ITEM::Create(), doPadToPadsDrc(), DRCE_CLEARANCE, DRCE_COPPER_EDGE_CLEARANCE, Edge_Cuts, BOARD::GetDesignSettings(), RC_ITEM::GetErrorText(), BOARD::GetSortedPadListByXthenYCoord(), BOARD_DESIGN_SETTINGS::Ignore(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), m_board_outline_valid, m_board_outlines, m_clearanceSource, BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, m_largestClearance, m_msg, m_pcb, MessageTextFromValue(), RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), BOARD_ITEM::SetLayer(), and userUnits().

Referenced by RunTests().

◆ testTracks()

void DRC::testTracks ( BOARD_COMMIT aCommit,
wxWindow *  aActiveWindow,
bool  aShowProgressBar 
)
private

Perform the DRC on all tracks.

This test can take a while, a progress bar can be displayed

Parameters
aActiveWindow= the active window ued as parent for the progress bar
aShowProgressBar= true to show a progress bar (Note: it is shown only if there are many tracks)

Definition at line 574 of file pcbnew/drc/drc.cpp.

575 {
576  wxProgressDialog* progressDialog = NULL;
577  const int delta = 500; // This is the number of tests between 2 calls to the
578  // progress bar
579  int count = m_pcb->Tracks().size();
580  int deltamax = count/delta;
581 
582  if( aShowProgressBar && deltamax > 3 )
583  {
584  // Do not use wxPD_APP_MODAL style here: it is not necessary and create issues
585  // on OSX
586  progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString,
587  deltamax, aActiveWindow,
588  wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME );
589  progressDialog->Update( 0, wxEmptyString );
590  }
591 
592  std::shared_ptr<CONNECTIVITY_DATA> connectivity = m_pcb->GetConnectivity();
594 
595 
598  {
599  connectivity->Clear();
600  connectivity->Build( m_pcb ); // just in case. This really needs to be reliable.
601  }
602 
603  int ii = 0;
604  count = 0;
605 
606  for( auto seg_it = m_pcb->Tracks().begin(); seg_it != m_pcb->Tracks().end(); seg_it++ )
607  {
608  if( ii++ > delta )
609  {
610  ii = 0;
611  count++;
612 
613  if( progressDialog )
614  {
615  if( !progressDialog->Update( count, wxEmptyString ) )
616  break; // Aborted by user
617 #ifdef __WXMAC__
618  // Work around a dialog z-order issue on OS X
619  if( count == deltamax )
620  aActiveWindow->Raise();
621 #endif
622  }
623  }
624 
625  // Test new segment against tracks and pads, optionally against copper zones
626  doTrackDrc( aCommit, *seg_it, seg_it + 1, m_pcb->Tracks().end(), m_testTracksAgainstZones );
627 
628  // Test for dangling items
629  int code = (*seg_it)->Type() == PCB_VIA_T ? DRCE_DANGLING_VIA : DRCE_DANGLING_TRACK;
630  wxPoint pos;
631 
632  if( !settings.Ignore( code ) && connectivity->TestTrackEndpointDangling( *seg_it, &pos ) )
633  {
634  DRC_ITEM* drcItem = DRC_ITEM::Create( code );
635  drcItem->SetItems( *seg_it );
636 
637  MARKER_PCB* marker = new MARKER_PCB( drcItem, pos );
638  addMarkerToPcb( aCommit, marker );
639  }
640  }
641 
642  if( progressDialog )
643  progressDialog->Destroy();
644 }
void doTrackDrc(BOARD_COMMIT &aCommit, TRACK *aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt, bool aTestZones)
Test the current segment.
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
BOARD * m_pcb
Definition: drc.h:125
#define NULL
track with at least one end not connected to anything
Definition: drc.h:50
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
bool m_testTracksAgainstZones
Definition: drc.h:118
#define _(s)
Definition: 3d_actions.cpp:33
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
via which isn't connected to anything
Definition: drc.h:49
TRACKS & Tracks()
Definition: class_board.h:257
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, addMarkerToPcb(), DRC_ITEM::Create(), doTrackDrc(), DRCE_DANGLING_TRACK, DRCE_DANGLING_VIA, BOARD::GetConnectivity(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::Ignore(), m_pcb, m_testTracksAgainstZones, NULL, PCB_VIA_T, RC_ITEM::SetItems(), and BOARD::Tracks().

Referenced by RunTests().

◆ testUnconnected()

void DRC::testUnconnected ( )
private

Definition at line 647 of file pcbnew/drc/drc.cpp.

648 {
649  for( DRC_ITEM* unconnectedItem : m_unconnected )
650  delete unconnectedItem;
651 
652  m_unconnected.clear();
653 
654  auto connectivity = m_pcb->GetConnectivity();
655 
656  connectivity->Clear();
657  connectivity->Build( m_pcb ); // just in case. This really needs to be reliable.
658  connectivity->RecalculateRatsnest();
659 
660  std::vector<CN_EDGE> edges;
661  connectivity->GetUnconnectedEdges( edges );
662 
663  for( const CN_EDGE& edge : edges )
664  {
666  item->SetItems( edge.GetSourceNode()->Parent(), edge.GetTargetNode()->Parent() );
667  m_unconnected.push_back( item );
668  }
669 }
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
BOARD * m_pcb
Definition: drc.h:125
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
std::vector< DRC_ITEM * > m_unconnected
Definition: drc.h:130
items are unconnected
Definition: drc.h:42

References DRC_ITEM::Create(), DRCE_UNCONNECTED_ITEMS, BOARD::GetConnectivity(), m_pcb, m_unconnected, and RC_ITEM::SetItems().

Referenced by RunTests().

◆ testZones()

void DRC::testZones ( BOARD_COMMIT aCommit)
private

Definition at line 672 of file pcbnew/drc/drc.cpp.

673 {
675 
676  // Test copper areas for valid netcodes
677  // if a netcode is < 0 the netname was not found when reading a netlist
678  // if a netcode is == 0 the netname is void, and the zone is not connected.
679  // This is allowed, but i am not sure this is a good idea
680  //
681  // In recent Pcbnew versions, the netcode is always >= 0, but an internal net name
682  // is stored, and initialized from the file or the zone properties editor.
683  // if it differs from the net name from net code, there is a DRC issue
684 
685  std::vector<SHAPE_POLY_SET> smoothed_polys;
686  smoothed_polys.resize( m_pcb->GetAreaCount() );
687 
688  for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
689  {
690  ZONE_CONTAINER* zone = m_pcb->GetArea( ii );
691 
692  if( !bds.Ignore( DRCE_ZONE_HAS_EMPTY_NET ) && zone->IsOnCopperLayer() )
693  {
694  int netcode = zone->GetNetCode();
695  // a netcode < 0 or > 0 and no pad in net is a error or strange
696  // perhaps a "dead" net, which happens when all pads in this net were removed
697  // Remark: a netcode < 0 should not happen (this is more a bug somewhere)
698  int pads_in_net = ( netcode > 0 ) ? m_pcb->GetConnectivity()->GetPadCount( netcode ) : 1;
699 
700  if( ( netcode < 0 ) || pads_in_net == 0 )
701  {
703  drcItem->SetItems( zone );
704 
705  MARKER_PCB* marker = new MARKER_PCB( drcItem, zone->GetPosition() );
706  addMarkerToPcb( aCommit, marker );
707  }
708  }
709 
710  ZONE_CONTAINER* zoneRef = m_pcb->GetArea( ii );
711  std::set<VECTOR2I> colinearCorners;
712  zoneRef->GetColinearCorners( m_pcb, colinearCorners );
713 
714  zoneRef->BuildSmoothedPoly( smoothed_polys[ii], &colinearCorners );
715  }
716 
717  // iterate through all areas
718  for( int ia = 0; ia < m_pcb->GetAreaCount(); ia++ )
719  {
720  ZONE_CONTAINER* zoneRef = m_pcb->GetArea( ia );
721 
722  if( !zoneRef->IsOnCopperLayer() )
723  continue;
724 
725  // If we are testing a single zone, then iterate through all other zones
726  // Otherwise, we have already tested the zone combination
727  for( int ia2 = ia + 1; ia2 < m_pcb->GetAreaCount(); ia2++ )
728  {
729  ZONE_CONTAINER* zoneToTest = m_pcb->GetArea( ia2 );
730 
731  if( zoneRef == zoneToTest )
732  continue;
733 
734  // test for same layer
735  if( zoneRef->GetLayer() != zoneToTest->GetLayer() )
736  continue;
737 
738  // Test for same net
739  if( zoneRef->GetNetCode() == zoneToTest->GetNetCode() && zoneRef->GetNetCode() >= 0 )
740  continue;
741 
742  // test for different priorities
743  if( zoneRef->GetPriority() != zoneToTest->GetPriority() )
744  continue;
745 
746  // test for different types
747  if( zoneRef->GetIsKeepout() != zoneToTest->GetIsKeepout() )
748  continue;
749 
750  // Examine a candidate zone: compare zoneToTest to zoneRef
751 
752  // Get clearance used in zone to zone test. The policy used to
753  // obtain that value is now part of the zone object itself by way of
754  // ZONE_CONTAINER::GetClearance().
755  int zone2zoneClearance = zoneRef->GetClearance( zoneToTest, &m_clearanceSource );
756 
757  // Keepout areas have no clearance, so set zone2zoneClearance to 1
758  // ( zone2zoneClearance = 0 can create problems in test functions)
759  if( zoneRef->GetIsKeepout() )
760  zone2zoneClearance = 1;
761 
762  // test for some corners of zoneRef inside zoneToTest
763  for( auto iterator = smoothed_polys[ia].IterateWithHoles(); iterator; iterator++ )
764  {
765  VECTOR2I currentVertex = *iterator;
766  wxPoint pt( currentVertex.x, currentVertex.y );
767 
768  if( smoothed_polys[ia2].Contains( currentVertex ) )
769  {
771  drcItem->SetItems( zoneRef, zoneToTest );
772 
773  MARKER_PCB* marker = new MARKER_PCB( drcItem, pt );
774  addMarkerToPcb( aCommit, marker );
775  }
776  }
777 
778  // test for some corners of zoneToTest inside zoneRef
779  for( auto iterator = smoothed_polys[ia2].IterateWithHoles(); iterator; iterator++ )
780  {
781  VECTOR2I currentVertex = *iterator;
782  wxPoint pt( currentVertex.x, currentVertex.y );
783 
784  if( smoothed_polys[ia].Contains( currentVertex ) )
785  {
787  drcItem->SetItems( zoneToTest, zoneRef );
788 
789  MARKER_PCB* marker = new MARKER_PCB( drcItem, pt );
790  addMarkerToPcb( aCommit, marker );
791  }
792  }
793 
794  // Iterate through all the segments of refSmoothedPoly
795  std::map<wxPoint, int> conflictPoints;
796 
797  for( auto refIt = smoothed_polys[ia].IterateSegmentsWithHoles(); refIt; refIt++ )
798  {
799  // Build ref segment
800  SEG refSegment = *refIt;
801 
802  // Iterate through all the segments in smoothed_polys[ia2]
803  for( auto testIt = smoothed_polys[ia2].IterateSegmentsWithHoles(); testIt; testIt++ )
804  {
805  // Build test segment
806  SEG testSegment = *testIt;
807  wxPoint pt;
808 
809  int ax1, ay1, ax2, ay2;
810  ax1 = refSegment.A.x;
811  ay1 = refSegment.A.y;
812  ax2 = refSegment.B.x;
813  ay2 = refSegment.B.y;
814 
815  int bx1, by1, bx2, by2;
816  bx1 = testSegment.A.x;
817  by1 = testSegment.A.y;
818  bx2 = testSegment.B.x;
819  by2 = testSegment.B.y;
820 
821  int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2,
822  0,
823  ax1, ay1, ax2, ay2,
824  0,
825  zone2zoneClearance,
826  &pt.x, &pt.y );
827 
828  if( d < zone2zoneClearance )
829  {
830  if( conflictPoints.count( pt ) )
831  conflictPoints[ pt ] = std::min( conflictPoints[ pt ], d );
832  else
833  conflictPoints[ pt ] = d;
834  }
835  }
836  }
837 
838  for( const std::pair<const wxPoint, int>& conflict : conflictPoints )
839  {
840  int actual = conflict.second;
841  DRC_ITEM* drcItem;
842 
843  if( actual <= 0 )
844  {
846  }
847  else
848  {
849  drcItem = DRC_ITEM::Create( DRCE_CLEARANCE );
850 
851  m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ),
853  MessageTextFromValue( userUnits(), zone2zoneClearance, true ),
854  MessageTextFromValue( userUnits(), conflict.second, true ) );
855 
856  drcItem->SetErrorMessage( m_msg );
857  }
858 
859  drcItem->SetItems( zoneRef, zoneToTest );
860 
861  MARKER_PCB* marker = new MARKER_PCB( drcItem, conflict.first );
862  addMarkerToPcb( aCommit, marker );
863  }
864  }
865  }
866 }
copper area outlines intersect
Definition: drc.h:47
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
wxString m_msg
Definition: drc.h:142
items are too close together
Definition: drc.h:44
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:236
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
EDA_UNITS userUnits() const
Definition: drc.h:155
const wxPoint GetPosition() const override
Definition: class_zone.cpp:230
wxString m_clearanceSource
Definition: drc.h:143
wxString GetErrorText() const
Definition: rc_item.h:169
BOARD * m_pcb
Definition: drc.h:125
void GetColinearCorners(BOARD *aBoard, std::set< VECTOR2I > &colinearCorners)
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
bool BuildSmoothedPoly(SHAPE_POLY_SET &aSmoothedPoly, std::set< VECTOR2I > *aPreserveCorners) const
Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
void addMarkerToPcb(BOARD_COMMIT &aCommit, MARKER_PCB *aMarker)
Adds a DRC marker to the PCB through the COMMIT mechanism.
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
copper area has a net but no pads in nets, which is suspicious
Definition: drc.h:48
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
virtual int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
Definition: seg.h:39
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:101
#define _(s)
Definition: 3d_actions.cpp:33
VECTOR2I A
Definition: seg.h:47
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:242
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
VECTOR2I B
Definition: seg.h:48

References _, SEG::A, addMarkerToPcb(), SEG::B, ZONE_CONTAINER::BuildSmoothedPoly(), DRC_ITEM::Create(), DRCE_CLEARANCE, DRCE_ZONE_HAS_EMPTY_NET, DRCE_ZONES_INTERSECT, BOARD::GetArea(), BOARD::GetAreaCount(), BOARD_CONNECTED_ITEM::GetClearance(), ZONE_CONTAINER::GetColinearCorners(), BOARD::GetConnectivity(), BOARD::GetDesignSettings(), RC_ITEM::GetErrorText(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPosition(), ZONE_CONTAINER::GetPriority(), BOARD_DESIGN_SETTINGS::Ignore(), ZONE_CONTAINER::IsOnCopperLayer(), m_clearanceSource, m_msg, m_pcb, MessageTextFromValue(), RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), userUnits(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by RunTests().

◆ updatePointers()

void DRC::updatePointers ( )
private

Update needed pointers from the one pointer which is known not to change.

Definition at line 478 of file pcbnew/drc/drc.cpp.

479 {
480  // update my pointers, m_editFrame is the only unchangeable one
482 
484 
485  if( m_drcDialog ) // Use diag list boxes only in DRC dialog
486  {
489  &m_unconnected ) );
491  &m_footprints ) );
492  }
493 }
std::vector< DRC_ITEM * > m_footprints
Definition: drc.h:131
RATSNEST_DRC_ITEMS_PROVIDER.
Definition: drc_provider.h:273
void ResolveDRCExclusions()
Update markers to match recorded exclusions.
BOARD * m_pcb
Definition: drc.h:125
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
BOARD_DRC_ITEMS_PROVIDER is an implementation of the RC_ITEMS_PROVIDER interface which uses a BOARD i...
Definition: drc_provider.h:84
void SetFootprintsProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: dialog_drc.cpp:229
std::vector< DRC_ITEM * > m_unconnected
Definition: drc.h:130
void SetMarkersProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: dialog_drc.cpp:213
DIALOG_DRC * m_drcDialog
Definition: drc.h:128
BOARD * GetBoard() const
VECTOR_DRC_ITEMS_PROVIDER is an implementation of the interface named DRC_ITEMS_PROVIDER which uses a...
Definition: drc_provider.h:176
void SetUnconnectedProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: dialog_drc.cpp:221

References PCB_BASE_FRAME::GetBoard(), m_drcDialog, m_editFrame, m_footprints, m_pcb, m_unconnected, PCB_EDIT_FRAME::ResolveDRCExclusions(), DIALOG_DRC::SetFootprintsProvider(), DIALOG_DRC::SetMarkersProvider(), and DIALOG_DRC::SetUnconnectedProvider().

Referenced by RunTests(), and ShowDRCDialog().

◆ userUnits()

EDA_UNITS DRC::userUnits ( ) const
inlineprivate

Definition at line 155 of file drc.h.

155 { return m_editFrame->GetUserUnits(); }
PCB_EDIT_FRAME * m_editFrame
Definition: drc.h:124
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits(), and m_editFrame.

Referenced by doPadToPadsDrc(), doTrackDrc(), RunTests(), testCopperDrawItem(), testPadClearances(), and testZones().

◆ view()

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Friends And Related Function Documentation

◆ DIALOG_DRC

friend class DIALOG_DRC
friend

Definition at line 107 of file drc.h.

Referenced by ShowDRCDialog().

Member Data Documentation

◆ m_board_outline_valid

bool DRC::m_board_outline_valid
private

Definition at line 127 of file drc.h.

Referenced by doTrackDrc(), testOutline(), and testPadClearances().

◆ m_board_outlines

SHAPE_POLY_SET DRC::m_board_outlines
private

Definition at line 126 of file drc.h.

Referenced by doTrackDrc(), testOutline(), and testPadClearances().

◆ m_clearanceSource

wxString DRC::m_clearanceSource
private

Definition at line 143 of file drc.h.

Referenced by doPadToPadsDrc(), doTrackDrc(), testCopperDrawItem(), testPadClearances(), and testZones().

◆ m_doKeepoutTest

bool DRC::m_doKeepoutTest
private

Definition at line 119 of file drc.h.

Referenced by DRC(), and RunTests().

◆ m_doUnconnectedTest

bool DRC::m_doUnconnectedTest
private

Definition at line 117 of file drc.h.

Referenced by DRC(), and RunTests().

◆ m_drcDialog

DIALOG_DRC* DRC::m_drcDialog
private

◆ m_drcRun

bool DRC::m_drcRun
private

Definition at line 132 of file drc.h.

Referenced by DRC(), RunTests(), and DIALOG_DRC::updateDisplayedCounts().

◆ m_editFrame

PCB_EDIT_FRAME* DRC::m_editFrame
private

Definition at line 124 of file drc.h.

Referenced by LoadRules(), Reset(), RunTests(), ShowDRCDialog(), updatePointers(), and userUnits().

◆ m_editModules

◆ m_footprints

std::vector<DRC_ITEM*> DRC::m_footprints
private

Definition at line 131 of file drc.h.

Referenced by RunTests(), updatePointers(), and ~DRC().

◆ m_footprintsTested

bool DRC::m_footprintsTested
private

Definition at line 133 of file drc.h.

Referenced by DRC(), RunTests(), and DIALOG_DRC::updateDisplayedCounts().

◆ m_largestClearance

int DRC::m_largestClearance
private

Definition at line 144 of file drc.h.

Referenced by doTrackDrc(), RunTests(), and testPadClearances().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_msg

wxString DRC::m_msg
private

◆ m_pcb

◆ m_refillZones

bool DRC::m_refillZones
private

Definition at line 120 of file drc.h.

Referenced by DRC(), DIALOG_DRC::OnRunDRCClick(), and RunTests().

◆ m_reportAllTrackErrors

bool DRC::m_reportAllTrackErrors
private

Definition at line 121 of file drc.h.

Referenced by doTrackDrc(), DRC(), and DIALOG_DRC::OnRunDRCClick().

◆ m_rules

std::vector<DRC_RULE*> DRC::m_rules
private

Definition at line 136 of file drc.h.

Referenced by LoadRules().

◆ m_ruleSelectors

std::vector<DRC_SELECTOR*> DRC::m_ruleSelectors
private

Definition at line 135 of file drc.h.

Referenced by LoadRules().

◆ m_testFootprints

bool DRC::m_testFootprints
private

Definition at line 122 of file drc.h.

Referenced by DRC(), DIALOG_DRC::OnRunDRCClick(), and RunTests().

◆ m_testTracksAgainstZones

bool DRC::m_testTracksAgainstZones
private

Definition at line 118 of file drc.h.

Referenced by DRC(), DIALOG_DRC::OnRunDRCClick(), and testTracks().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_unconnected

std::vector<DRC_ITEM*> DRC::m_unconnected
private

Definition at line 130 of file drc.h.

Referenced by testUnconnected(), updatePointers(), and ~DRC().


The documentation for this class was generated from the following files: