77 virtual bool Run()
override;
79 virtual const wxString
GetName()
const override {
return wxT(
"microvia_stack" ); };
83 void checkColumn(
const std::vector<PCB_VIA*>& aColumn );
91 std::vector<PCB_VIA*> vias;
100 vias.push_back(
via );
115 drcItem->SetItems( aStack );
120 std::map<int, int> layerToIndex;
124 layerToIndex[layer] = spanLen++;
126 std::set<int> covered;
131 auto top = layerToIndex.find(
via->TopLayer() );
132 auto bot = layerToIndex.find(
via->BottomLayer() );
134 if(
top == layerToIndex.end() || bot == layerToIndex.end() ||
std::abs(
top->second - bot->second ) != 1 )
140 if( !covered.insert( std::min(
top->second, bot->second ) ).second )
147 if( broken || (
int) covered.size() != spanLen - 1 )
150 drcItem->SetItems( aStack );
167 && (
int) aColumn.size() > depthConstraint.
GetValue().
Max()
171 drcItem->SetErrorMessage( wxString::Format(
_(
"Stack is %d hops deep, limit is %d" ), (
int) aColumn.size(),
173 drcItem->SetItems(
top );
174 drcItem->SetViolatingRule( depthConstraint.
GetParentRule() );
184 bool boardFillsVias =
m_drcEngine->GetBoard()->GetDesignSettings().m_FillVias;
188 if( !
via->Padstack().Drill().is_filled.value_or( boardFillsVias ) )
191 drcItem->SetItems(
via );
202 const int progressDelta = 250;
205 for(
const std::vector<PCB_VIA*>& column : columns )
216static int stackThickness(
const std::vector<BOARD_STACKUP_ITEM*>& aStack,
int aFirst,
int aLast )
220 for(
int i = aFirst; i < aLast; ++i )
248 if( !checkRatio && !checkCore )
252 const std::vector<BOARD_STACKUP_ITEM*>& stack = stackup.
GetList();
254 const int progressDelta = 500;
267 if(
via->GetDrillValue() <= 0 )
273 for(
int i = 0; i < (int) stack.size(); ++i )
280 if( layer ==
via->TopLayer() || layer ==
via->BottomLayer() )
289 if( first < 0 || last < 0 )
296 for(
int i = first + 1; i < last; ++i )
299 && stack[i]->GetTypeName() ==
KEY_CORE )
303 drcItem->SetErrorMessage(
304 wxString::Format(
_(
"The stackup gives the dielectric between %s and %s as core" ),
306 drcItem->SetItems(
via );
323 double limit = ratioConstraint.
GetValue().
Max() / 1000.0;
330 bool fromBack = botExternal && !topExternal;
332 int thickness =
stackThickness( stack, first + 1, last ) + stack[fromBack ? last : first]->GetThickness();
337 thickness += stack[fromBack ? first : last]->GetThickness();
339 double ratio = (double) thickness / (
double)
via->GetDrillValue();
355 drcItem->SetErrorMessage( wxString::Format(
_(
"Aspect ratio %.2f exceeds the %.2f limit" ), ratio, limit ) );
357 drcItem->SetItems(
via );
358 drcItem->SetViolatingRule( ratioConstraint.
GetParentRule() );
374 for(
PAD*
pad : footprint->Pads() )
383 int drill = std::min(
pad->GetDrillSize().x,
pad->GetDrillSize().y );
394 double limit = ratioConstraint.
GetValue().
Max() / 1000.0;
399 double ratio = (double) boardDepth / (
double) drill;
406 drcItem->SetErrorMessage(
407 wxString::Format(
_(
"Aspect ratio %.2f exceeds the %.2f limit" ), ratio, limit ) );
409 drcItem->SetItems(
pad );
410 drcItem->SetViolatingRule( ratioConstraint.
GetParentRule() );
428 if( !
reportPhase(
_(
"Checking hole aspect ratios and microvia stacks..." ) ) )
@ BS_ITEM_TYPE_DIELECTRIC
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage one layer needed to make a physical board.
int GetSublayersCount() const
int GetThickness(int aDielectricSubLayer=0) const
BOARD_STACKUP_ITEM_TYPE GetType() const
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
Information pertinent to a Pcbnew printed circuit board.
BOARD_STACKUP GetStackupOrDefault() const
const GENERATORS & Generators() const
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
DRC_RULE * GetParentRule() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
DRC_TEST_PROVIDER_VIA_STACK()
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_VIA_STACK()=default
void checkAspectRatio(BOARD *aBoard)
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
void checkColumn(const std::vector< PCB_VIA * > &aColumn)
void checkSpan(PCB_VIA_STACK *aStack, int aCopperLayers)
void checkLooseMicrovias(BOARD *aBoard)
virtual bool reportPhase(const wxString &aStageName)
void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::function< void(PCB_MARKER *)> &aPathGenerator=[](PCB_MARKER *){})
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
VECTOR2I GetPosition() const override
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
PCB_LAYER_ID GetStartLayer() const
PCB_LAYER_ID GetEndLayer() const
static bool IsSpanValid(BOARD *aBoard, PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd)
True when both span ends are copper layers within the board's copper layer count.
static std::vector< std::vector< PCB_VIA * > > CollectMicroviaColumns(BOARD *aBoard)
Runs of microvias that land on one another, each ordered from its outermost hop down.
@ HOLE_ASPECT_RATIO_CONSTRAINT
@ MICROVIA_STACK_DEPTH_CONSTRAINT
@ DRCE_MICROVIA_STACK_DEPTH
@ DRCE_MICROVIA_CROSSES_CORE
@ DRCE_MALFORMED_MICROVIA_STACK_SPAN
@ DRCE_MICROVIA_STACK_NOT_FILLED
static int stackThickness(const std::vector< BOARD_STACKUP_ITEM * > &aStack, int aFirst, int aLast)
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PTH
Plated through hole pad.
KIBIS top(path, &reporter)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)