54 virtual bool Run()
override;
56 virtual const wxString
GetName()
const override {
return wxT(
"edge_clearance" ); }
73 std::shared_ptr<SHAPE> shape;
81 int minClearance = constraint.GetValue().Min();
87 if( itemShape->
Collide( shape.get(), minClearance, &
actual, &pos ) )
90 if( minClearance > 0 &&
actual == minClearance )
98 if( castellatedPad->GetEffectiveHoleShape()->Collide( pos ) )
106 if( minClearance > 0 )
108 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
109 constraint.GetName(),
113 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
117 drcItem->SetViolatingRule( constraint.GetParentRule() );
135 if( !
reportPhase(
_(
"Checking copper to board edge clearances..." ) ) )
140 if( !
reportPhase(
_(
"Checking silk to board edge clearances..." ) ) )
145 REPORT_AUX( wxT(
"Edge clearance violations ignored. Tests not run." ) );
160 std::vector<std::unique_ptr<PCB_SHAPE>> edges;
183 edges.back()->SetStart( seg->GetStart() );
184 edges.back()->SetEnd( seg->GetEnd() );
185 edges.back()->SetStroke( stroke );
192 edges.back()->SetEndX( shape->
GetStartX() );
193 edges.back()->SetStroke( stroke );
196 edges.back()->SetEndY( shape->
GetStartY() );
197 edges.back()->SetStroke( stroke );
200 edges.back()->SetStartX( shape->
GetEndX() );
201 edges.back()->SetStroke( stroke );
204 edges.back()->SetStartY( shape->
GetEndY() );
205 edges.back()->SetStroke( stroke );
218 edges.back()->SetStart( seg.
A );
219 edges.back()->SetEnd( seg.
B );
220 edges.back()->SetStroke( stroke );
226 edges.back()->SetStroke( stroke );
232 for(
const std::unique_ptr<PCB_SHAPE>& edge : edges )
236 if( edge->IsOnLayer( layer ) )
243 for(
PAD*
pad : footprint->Pads() )
249 if(
pad->GetDrillSizeX() !=
pad->GetDrillSizeY() )
261 const int progressDelta = 200;
278 if( !testCopper && !testSilk )
295 std::vector<PCB_LAYER_ID> layersToTest;
297 switch( item->
Type() )
300 layersToTest =
static_cast<PAD*
>( item )->Padstack().UniqueLayers();
304 layersToTest =
static_cast<PCB_VIA*
>( item )->Padstack().UniqueLayers();
331 if( edgesTree.
QueryColliding( item, shapeLayer, testLayer,
nullptr,
334 return testAgainstEdge( item, itemShape.get(), edge,
335 SILK_CLEARANCE_CONSTRAINT,
336 DRCE_SILK_EDGE_CLEARANCE );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
virtual bool IsOnCopperLayer() const
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
const MINOPTMAX< int > & GetValue() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Implement an R-tree for fast spatial and layer indexing of connectable items.
void Insert(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int aWorstClearance=0)
Insert an item into the tree on a particular layer with an optional worst clearance.
int QueryColliding(BOARD_ITEM *aRefItem, PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer, std::function< bool(BOARD_ITEM *)> aFilter=nullptr, std::function< bool(BOARD_ITEM *)> aVisitor=nullptr, int aClearance=0) const
This is a fast test which essentially does bounding-box overlap given a worst-case clearance.
DRC_TEST_PROVIDER_EDGE_CLEARANCE()
int m_largestEdgeClearance
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual ~DRC_TEST_PROVIDER_EDGE_CLEARANCE()=default
virtual const wxString GetName() const override
std::vector< PAD * > m_castellatedPads
bool testAgainstEdge(BOARD_ITEM *item, SHAPE *itemShape, BOARD_ITEM *other, DRC_CONSTRAINT_T aConstraintType, PCB_DRC_CODE aErrorCode)
static std::vector< KICAD_T > s_allBasicItemsButZones
virtual bool reportPhase(const wxString &aStageName)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
void reportTwoItemGeometry(std::shared_ptr< DRC_ITEM > &aDrcItem, const VECTOR2I &aMarkerPos, const BOARD_ITEM *aItem1, const BOARD_ITEM *aItem2, PCB_LAYER_ID aLayer, int aDistance)
bool isInvisibleText(const BOARD_ITEM *aItem) const
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
KICAD_T Type() const
Returns the type of object.
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
SHAPE_POLY_SET & GetPolyShape()
int GetCornerRadius() const
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllLayersMask()
STROKE_PARAMS GetStroke() const override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual size_t GetSegmentCount() const override
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
An abstract shape on 2D plane.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
@ DRCE_SILK_EDGE_CLEARANCE
@ EDGE_CLEARANCE_CONSTRAINT
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID
A quick note on layer IDs:
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
@ CASTELLATED
a pad with a castellated through hole
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I