7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 22:21:40 +00:00

Hatching knockout fixes.

This commit is contained in:
Jeff Young 2025-02-24 17:35:23 +00:00
parent 0de8d75dec
commit 907f21e739
2 changed files with 35 additions and 11 deletions

View File

@ -142,16 +142,16 @@ void BOARD_COMMIT::propagateDamage( BOARD_ITEM* aItem, std::vector<ZONE*>* aStal
BOX2I bbox = aItem->GetBoundingBox();
LSET layers = aItem->GetLayerSet();
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
layers = LSET::PhysicalLayersMask();
else
layers &= LSET::AllCuMask();
if( layers.empty() )
return;
if( aStaleZones )
{
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
layers = LSET::PhysicalLayersMask();
else
layers &= LSET::AllCuMask();
if( layers.empty() )
return;
for( ZONE* zone : board->Zones() )
{
if( zone->GetIsRuleArea() )

View File

@ -304,6 +304,9 @@ void PCB_SHAPE::updateHatching() const
{
EDA_SHAPE::updateHatching();
static std::initializer_list<KICAD_T> knockoutTypes = { PCB_TEXT_T, PCB_TEXTBOX_T,
PCB_SHAPE_T };
if( !m_hatching.IsEmpty() )
{
PCB_LAYER_ID layer = GetLayer();
@ -312,12 +315,33 @@ void PCB_SHAPE::updateHatching() const
for( BOARD_ITEM* item : GetBoard()->Drawings() )
{
if( ( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T )
&& item->GetLayer() == layer
&& item->GetBoundingBox().Intersects( bbox ) )
if( item == this )
continue;
if( item->IsType( knockoutTypes )
&& item->GetLayer() == layer
&& item->GetBoundingBox().Intersects( bbox ) )
{
item->TransformShapeToPolygon( holes, layer, 0, ARC_LOW_DEF, ERROR_OUTSIDE, true );
}
if( item->Type() == PCB_FOOTPRINT_T )
{
static_cast<FOOTPRINT*>( item )->RunOnDescendants(
[&]( BOARD_ITEM* descendant )
{
if( descendant == this )
return;
if( descendant->IsType( knockoutTypes )
&& descendant->GetLayer() == layer
&& descendant->GetBoundingBox().Intersects( bbox ) )
{
descendant->TransformShapeToPolygon( holes, layer, 0, ARC_LOW_DEF,
ERROR_OUTSIDE, true );
}
} );
}
}
m_hatching.BooleanSubtract( holes );