diff --git a/common/pcb.keywords b/common/pcb.keywords
index 90767b1437..aa5892082f 100644
--- a/common/pcb.keywords
+++ b/common/pcb.keywords
@@ -49,6 +49,7 @@ comment
company
connect
connect_pads
+copperpour
crossbar
date
descr
diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp
index bebae50f0e..d67142aaa8 100644
--- a/pcbnew/class_zone.cpp
+++ b/pcbnew/class_zone.cpp
@@ -58,10 +58,10 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
m_priority = 0;
m_smoothedPoly = NULL;
m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
- m_isKeepout = false;
- m_doNotAllowPads = true; // has meaning only if m_isKeepout == true
- m_doNotAllowVias = true; // has meaning only if m_isKeepout == true
- m_doNotAllowTracks = true; // has meaning only if m_isKeepout == true
+ SetIsKeepout( false );
+ SetDoNotAllowCopperPour( false ); // has meaning only if m_isKeepout == true
+ SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
+ SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
m_cornerRadius = 0;
utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations
@@ -92,7 +92,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_FillSegmList = aZone.m_FillSegmList;
m_isKeepout = aZone.m_isKeepout;
- m_doNotAllowPads = aZone.m_doNotAllowPads;
+ m_doNotAllowCopperPour = aZone.m_doNotAllowCopperPour;
m_doNotAllowVias = aZone.m_doNotAllowVias;
m_doNotAllowTracks = aZone.m_doNotAllowTracks;
diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h
index c3b715ae45..e6e33cc06b 100644
--- a/pcbnew/class_zone.h
+++ b/pcbnew/class_zone.h
@@ -539,12 +539,12 @@ public:
* Accessors to parameters used in Keepout zones:
*/
bool GetIsKeepout() const { return m_isKeepout; }
- bool GetDoNotAllowPads() const { return m_doNotAllowPads; }
+ bool GetDoNotAllowCopperPour() const { return m_doNotAllowCopperPour; }
bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
- void SetDoNotAllowPads( bool aEnable ) { m_doNotAllowPads = aEnable; }
+ void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
@@ -605,7 +605,7 @@ private:
/* For keepout zones only:
* what is not allowed inside the keepout ( pads, tracks and vias )
*/
- bool m_doNotAllowPads;
+ bool m_doNotAllowCopperPour;
bool m_doNotAllowVias;
bool m_doNotAllowTracks;
diff --git a/pcbnew/class_zone_settings.cpp b/pcbnew/class_zone_settings.cpp
index b4ff1340fd..750f6b48c4 100644
--- a/pcbnew/class_zone_settings.cpp
+++ b/pcbnew/class_zone_settings.cpp
@@ -64,7 +64,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_cornerRadius = 0;
SetIsKeepout( false );
- SetDoNotAllowPads( false );
+ SetDoNotAllowCopperPour( false );
SetDoNotAllowVias( true );
SetDoNotAllowTracks( true );
}
@@ -86,7 +86,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_cornerSmoothingType = aSource.GetCornerSmoothingType();
m_cornerRadius = aSource.GetCornerRadius();
m_isKeepout = aSource.GetIsKeepout();
- m_keepoutDoNotAllowPads = aSource.GetDoNotAllowPads();
+ m_keepoutDoNotAllowCopperPour = aSource.GetDoNotAllowCopperPour();
m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
@@ -107,7 +107,7 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
aTarget.SetCornerRadius( m_cornerRadius );
aTarget.SetIsKeepout( GetIsKeepout() );
- aTarget.SetDoNotAllowPads( GetDoNotAllowPads() );
+ aTarget.SetDoNotAllowCopperPour( GetDoNotAllowCopperPour() );
aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
diff --git a/pcbnew/class_zone_settings.h b/pcbnew/class_zone_settings.h
index 6808885a9f..b26db0c7b8 100644
--- a/pcbnew/class_zone_settings.h
+++ b/pcbnew/class_zone_settings.h
@@ -65,7 +65,7 @@ private:
/* For keepout zones only:
* what is not allowed inside the keepout ( pads, tracks and vias )
*/
- bool m_keepoutDoNotAllowPads;
+ bool m_keepoutDoNotAllowCopperPour;
bool m_keepoutDoNotAllowVias;
bool m_keepoutDoNotAllowTracks;
@@ -115,12 +115,12 @@ public:
* Accessors to parameters used in Keepout zones:
*/
const bool GetIsKeepout() const { return m_isKeepout; }
- const bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
+ const bool GetDoNotAllowCopperPour() const { return m_keepoutDoNotAllowCopperPour; }
const bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
const bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
- void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
+ void SetDoNotAllowCopperPour( bool aEnable ) { m_keepoutDoNotAllowCopperPour = aEnable; }
void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
};
diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp
index 8a04849cdc..7963f6d29b 100644
--- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp
+++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp
@@ -175,7 +175,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
// Init keepout parameters:
m_cbTracksCtrl->SetValue( m_zonesettings.GetDoNotAllowTracks() );
m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() );
- m_cbPadsCtrl->SetValue( m_zonesettings.GetDoNotAllowPads() );
+ m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() );
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnCancelClick( wxCommandEvent& event )
@@ -208,12 +208,12 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
m_zonesettings.SetIsKeepout( true );
m_zonesettings.SetDoNotAllowTracks( m_cbTracksCtrl->GetValue() );
m_zonesettings.SetDoNotAllowVias( m_cbViasCtrl->GetValue() );
- m_zonesettings.SetDoNotAllowPads( m_cbPadsCtrl->GetValue() );
+ m_zonesettings.SetDoNotAllowCopperPour( m_cbCopperPourCtrl->GetValue() );
// Test for not allowed items: should have at least one item not allowed:
if( ! m_zonesettings.GetDoNotAllowTracks() &&
! m_zonesettings.GetDoNotAllowVias() &&
- ! m_zonesettings.GetDoNotAllowPads() )
+ ! m_zonesettings.GetDoNotAllowCopperPour() )
{
DisplayError( NULL,
_("Tracks, vias and pads are allowed. The keepout is useless" ) );
diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp
index 01340b0856..507de0d24e 100644
--- a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp
+++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp
@@ -67,8 +67,8 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind
m_cbViasCtrl = new wxCheckBox( this, wxID_ANY, _("No Vias"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerCutoutOpts->Add( m_cbViasCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
- m_cbPadsCtrl = new wxCheckBox( this, wxID_ANY, _("No Pads"), wxDefaultPosition, wxDefaultSize, 0 );
- sbSizerCutoutOpts->Add( m_cbPadsCtrl, 0, wxALL|wxEXPAND, 5 );
+ m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("No Copper Pour"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbSizerCutoutOpts->Add( m_cbCopperPourCtrl, 0, wxALL|wxEXPAND, 5 );
bSizerRight->Add( sbSizerCutoutOpts, 0, wxEXPAND|wxALL, 5 );
diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp
index 93aefed21e..d3b2aa9699 100644
--- a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp
+++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp
@@ -723,7 +723,7 @@
0
0
wxID_ANY
- No Pads
+ No Copper Pour
0
@@ -731,7 +731,7 @@
0
1
- m_cbPadsCtrl
+ m_cbCopperPourCtrl
1
diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.h b/pcbnew/dialogs/dialog_keepout_area_properties_base.h
index ac1aa7c18e..bd16619914 100644
--- a/pcbnew/dialogs/dialog_keepout_area_properties_base.h
+++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.h
@@ -49,7 +49,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM
wxRadioBox* m_OutlineAppearanceCtrl;
wxCheckBox* m_cbTracksCtrl;
wxCheckBox* m_cbViasCtrl;
- wxCheckBox* m_cbPadsCtrl;
+ wxCheckBox* m_cbCopperPourCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index cd8ec788da..9387c24cc3 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1011,10 +1011,10 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
if( aZone->GetIsKeepout() )
{
- m_out->Print( aNestLevel+1, "(keepout (tracks %s) (vias %s) (pads %s))\n",
+ m_out->Print( aNestLevel+1, "(keepout (tracks %s) (vias %s) (copperpour %s))\n",
aZone->GetDoNotAllowTracks() ? "not_allowed" : "allowed",
aZone->GetDoNotAllowVias() ? "not_allowed" : "allowed",
- aZone->GetDoNotAllowPads() ? "not_allowed" : "allowed" );
+ aZone->GetDoNotAllowCopperPour() ? "not_allowed" : "allowed" );
}
m_out->Print( aNestLevel+1, "(fill" );
diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
index 1407a0fbf2..028b2f9248 100644
--- a/pcbnew/legacy_plugin.cpp
+++ b/pcbnew/legacy_plugin.cpp
@@ -2223,10 +2223,10 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
data = strtok( NULL, delims );
zc->SetDoNotAllowVias( data && *data == 'N' );
}
- else if( !strcmp( data, "pads" ) )
+ else if( !strcmp( data, "copperpour" ) )
{
data = strtok( NULL, delims );
- zc->SetDoNotAllowPads( data && *data == 'N' );
+ zc->SetDoNotAllowCopperPour( data && *data == 'N' );
}
data = strtok( NULL, delims );
@@ -3596,10 +3596,10 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
if( me->GetIsKeepout() )
{
- fprintf( m_fp, "ZKeepout tracks %c vias %c pads %c\n",
+ fprintf( m_fp, "ZKeepout tracks %c vias %c copperpour %c\n",
me->GetDoNotAllowTracks() ? 'N' : 'Y',
me->GetDoNotAllowVias() ? 'N' : 'Y',
- me->GetDoNotAllowPads() ? 'N' : 'Y' );
+ me->GetDoNotAllowCopperPour() ? 'N' : 'Y' );
}
fprintf( m_fp, "ZSmoothing %d %s\n",
diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp
index c438041333..babb050af0 100644
--- a/pcbnew/pcb_parser.cpp
+++ b/pcbnew/pcb_parser.cpp
@@ -2490,16 +2490,16 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
zone->SetDoNotAllowVias( token == T_not_allowed );
break;
- case T_pads:
+ case T_copperpour:
token = NextTok();
if( token != T_allowed && token != T_not_allowed )
Expecting( "allowed or not_allowed" );
- zone->SetDoNotAllowPads( token == T_not_allowed );
+ zone->SetDoNotAllowCopperPour( token == T_not_allowed );
break;
default:
- Expecting( "tracks, vias or pads" );
+ Expecting( "tracks, vias or copperpour" );
}
NeedRIGHT();
diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp
index d00185fbd0..be1a66e462 100644
--- a/pcbnew/specctra_export.cpp
+++ b/pcbnew/specctra_export.cpp
@@ -1135,7 +1135,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
}
- //-------------------------------------
+ //-------------------------------------
+ // Note: only zones are output here, keepout areas be be created later
{
int netlessZones = 0;
@@ -1146,6 +1147,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
{
ZONE_CONTAINER* item = (ZONE_CONTAINER*) items[i];
+ if( item->GetIsKeepout() )
+ continue;
+
COPPER_PLANE* plane = new COPPER_PLANE( pcb->structure );
pcb->structure->planes.push_back( plane );
@@ -1214,7 +1218,80 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
}
}
- // keepouts could go here, there are none in Kicad at this time.
+ //-------------------------------------
+ {
+ static const KICAD_T scanZONEs[] = { PCB_ZONE_AREA_T, EOT };
+ items.Collect( aBoard, scanZONEs );
+
+ for( int i=0; iGetIsKeepout() )
+ continue;
+
+ // keepout areas have a type. types are
+ // T_place_keepout, T_via_keepout, T_wire_keepout,
+ // T_bend_keepout, T_elongate_keepout, T_keepout.
+ // Pcbnew knows only T_keepout, T_via_keepout and T_wire_keepout
+ DSN_T keepout_type;
+
+ if( item->GetDoNotAllowVias() && item->GetDoNotAllowTracks() )
+ keepout_type = T_keepout;
+ else if( item->GetDoNotAllowVias() )
+ keepout_type = T_via_keepout;
+ else if( item->GetDoNotAllowTracks() )
+ keepout_type = T_wire_keepout;
+ else
+ keepout_type = T_keepout;
+
+ KEEPOUT* keepout = new KEEPOUT( pcb->structure, keepout_type );
+ pcb->structure->keepouts.push_back( keepout );
+
+ PATH* mainPolygon = new PATH( keepout, T_polygon );
+ keepout->SetShape( mainPolygon );
+
+ mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
+
+ int count = item->m_Poly->corner.size();
+ int ndx = 0; // used in 2 for() loops below
+ for( ; ndxm_Poly->corner[ndx].x,
+ item->m_Poly->corner[ndx].y );
+ mainPolygon->AppendPoint( mapPt(point) );
+
+ // this was the end of the main polygon
+ if( item->m_Poly->corner[ndx].end_contour )
+ break;
+ }
+
+ WINDOW* window = 0;
+ PATH* cutout = 0;
+
+ // handle the cutouts
+ for( ++ndx; ndxm_Poly->corner[ndx-1].end_contour )
+ {
+ window = new WINDOW( keepout );
+ keepout->AddWindow( window );
+
+ cutout = new PATH( window, T_polygon );
+ window->SetShape( cutout );
+
+ cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
+ }
+
+ wxASSERT( window );
+ wxASSERT( cutout );
+
+ wxPoint point(item->m_Poly->corner[ndx].x,
+ item->m_Poly->corner[ndx].y );
+ cutout->AppendPoint( mapPt(point) );
+ }
+ }
+ }
//----------------------------
{
diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
index 282234a7a2..487ce0110d 100644
--- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
@@ -353,20 +353,20 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
}
- // Add zones outlines having an higher priority
+ // Add zones outlines having an higher priority and keepout
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetBoard()->GetArea( ii );
if( zone->GetLayer() != GetLayer() )
continue;
- if( zone->GetIsKeepout() )
+ if( !zone->GetIsKeepout() && zone->GetPriority() <= GetPriority() )
continue;
- if( zone->GetPriority() <= GetPriority() )
+ if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
continue;
- // A highter priority zone is found: remove its area
+ // A highter priority zone or keepout area is found: remove its area
item_boundingbox = zone->GetBoundingBox();
if( !item_boundingbox.Intersects( zone_boundingbox ) )
continue;
@@ -377,13 +377,17 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// the zone will be connected to the current zone, but filled areas
// will use different parameters (clearance, thermal shapes )
bool addclearance = GetNet() != zone->GetNet();
+ int clearance = zone_clearance;
if( zone->GetIsKeepout() )
- addclearance = false;
+ {
+ addclearance = true;
+ clearance = m_ZoneMinThickness / 2;
+ }
zone->TransformShapeWithClearanceToPolygon(
cornerBufferPolysToSubstract,
- zone_clearance, s_CircleToSegmentsCount,
+ clearance, s_CircleToSegmentsCount,
s_Correction, addclearance );
}
diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp
index 6d546d7874..d3971a44fd 100644
--- a/pcbnew/zones_functions_for_undo_redo.cpp
+++ b/pcbnew/zones_functions_for_undo_redo.cpp
@@ -5,7 +5,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
- * Copyright (C) 2009 Jean-Pierre Charras
+ * Copyright (C) 2009 Jean-Pierre Charras
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@@ -70,16 +70,16 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
if( m_Netname != aZoneToCompare.m_Netname )
return false;
- if( GetPriority() != aZoneToCompare.GetPriority() )
+ if( GetPriority() != aZoneToCompare.GetPriority() )
return false;
// Compare zone specific parameters
- if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
+ if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
return false;
- if( GetIsKeepout() )
+ if( GetIsKeepout() )
{
- if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
+ if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
return false;
if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
@@ -89,25 +89,25 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
return false;
}
- if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount )
+ if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount )
return false;
- if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
+ if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
return false;
- if( m_ZoneMinThickness != aZoneToCompare.m_ZoneMinThickness )
+ if( m_ZoneMinThickness != aZoneToCompare.m_ZoneMinThickness )
return false;
- if( m_FillMode != aZoneToCompare.m_FillMode )
+ if( m_FillMode != aZoneToCompare.m_FillMode )
return false;
- if( m_PadConnection != aZoneToCompare.m_PadConnection )
+ if( m_PadConnection != aZoneToCompare.m_PadConnection )
return false;
- if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
+ if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
return false;
- if( m_ThermalReliefCopperBridge != aZoneToCompare.m_ThermalReliefCopperBridge )
+ if( m_ThermalReliefCopperBridge != aZoneToCompare.m_ThermalReliefCopperBridge )
return false;