Allow text input to Convert to Polygon/Zone/Keepout.

Also fixes non-copper zone filler to honor fill keepouts.

Fixes https://gitlab.com/kicad/code/kicad/issues/14566
This commit is contained in:
Jeff Young 2023-04-28 17:39:48 +01:00
parent d5cb100f72
commit 6807ca6f9f
4 changed files with 27 additions and 6 deletions

View File

@ -85,7 +85,7 @@ DIALOG_RULE_AREA_PROPERTIES_BASE::DIALOG_RULE_AREA_PROPERTIES_BASE( wxWindow* pa
fgSizer2->Add( m_cbPadsCtrl, 0, wxRIGHT|wxLEFT, 5 );
m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("Keep out copper fill"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("Keep out zone fills"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbCopperPourCtrl->SetToolTip( _("Zones will not fill copper into this area") );
fgSizer2->Add( m_cbCopperPourCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );

View File

@ -703,7 +703,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Keep out copper fill</property>
<property name="label">Keep out zone fills</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -233,9 +233,10 @@ bool CONVERT_TOOL::Init()
m_menu->SetIcon( BITMAPS::convert );
m_menu->SetTitle( _( "Create from Selection" ) );
auto graphicLines = S_C::OnlyTypes( { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_RECT_T,
PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_ARC_T,
PCB_SHAPE_LOCATE_BEZIER_T } )
auto shapes = S_C::OnlyTypes( { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_RECT_T,
PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_ARC_T,
PCB_SHAPE_LOCATE_BEZIER_T,
PCB_TEXT_T } )
&& P_S_C::SameLayer();
auto graphicToTrack = S_C::OnlyTypes( { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_ARC_T } );
@ -248,7 +249,7 @@ bool CONVERT_TOOL::Init()
auto canCreateArcs = S_C::Count( 1 )
&& S_C::OnlyTypes( { PCB_TRACE_T, PCB_SHAPE_LOCATE_SEGMENT_T } );
auto canCreateArray = S_C::MoreThan( 0 );
auto canCreatePolyType = graphicLines || anyPolys || anyTracks;
auto canCreatePolyType = shapes || anyPolys || anyTracks;
auto canCreateLines = anyPolys;
auto canCreateTracks = anyPolys || graphicToTrack;
auto canCreate = canCreatePolyType
@ -782,6 +783,14 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromClosedGraphics( const std::deque<EDA_I
item->SetFlags( SKIP_STRUCT );
break;
case PCB_TEXT_T:
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextToPolySet( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE );
text->SetFlags( SKIP_STRUCT );
break;
}
default:
continue;
}

View File

@ -1632,6 +1632,18 @@ bool ZONE_FILLER::fillNonCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer,
aFillPolys = aSmoothedOutline;
aFillPolys.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST );
for( ZONE* keepout : m_board->Zones() )
{
if( !keepout->GetIsRuleArea() )
continue;
if( keepout->GetDoNotAllowCopperPour() && keepout->IsOnLayer( aLayer ) )
{
if( keepout->GetBoundingBox().Intersects( zone_boundingbox ) )
aFillPolys.BooleanSubtract( *keepout->Outline(), SHAPE_POLY_SET::PM_FAST );
}
}
// Features which are min_width should survive pruning; features that are *less* than
// min_width should not. Therefore we subtract epsilon from the min_width when
// deflating/inflating.