Commit c5725437 authored by charras's avatar charras

Zones not attached to a net are now allowed. Not sure it is a good idea, but a...

Zones not attached to a net are now allowed. Not sure it is a good idea, but a lot of users want this.
parent fbdd3406
......@@ -69,7 +69,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
m_FillModeCtrl->SetSelection(m_Zone_Setting->m_FillMode ? 1 : 0);
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_ClearanceValueTitle, g_UnitMetric );
msg = ReturnStringFromValue( g_UnitMetric,
......@@ -165,10 +165,13 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_Config->Read( ZONE_NET_FILTER_STRING_KEY );
}
// Build list of nets:
m_NetNameFilter->SetValue( NetNameFilter );
wxArrayString ListNetName;
m_Parent->GetBoard()->ReturnSortedNetnamesList( ListNetName,
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
m_Parent->GetBoard()->ReturnSortedNetnamesList(
ListNetName,
m_NetSorting ==
0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if( m_NetSorting != 0 )
{
......@@ -183,6 +186,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
}
}
ListNetName.Insert( wxT( "<no net>" ), 0 );
m_ListNetNameSelection->InsertItems( ListNetName, 0 );
// Select net:
......@@ -279,10 +283,11 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits );
if ( m_Zone_Setting->m_ZoneMinThickness < 10 )
if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{
DisplayError( this,
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch or 0.0254 mm)" ) );
_(
"Error :\nyou must choose a copper min thickness value bigger than 0.001 inch or 0.0254 mm)" ) );
return false;
}
......@@ -305,7 +310,9 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
if( m_Zone_Setting->m_ThermalReliefCopperBridgeValue <= m_Zone_Setting->m_ZoneMinThickness )
{
DisplayError( this, _( "Error :\nyou must choose a copper bridge value for thermal reliefs bigger than the min zone thickness" ) );
DisplayError( this,
_(
"Error :\nyou must choose a copper bridge value for thermal reliefs bigger than the min zone thickness" ) );
return false;
}
......@@ -333,11 +340,22 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return false;
}
if ( ii == 0 ) // the not connected option was selected: this is not a good practice: warn:
{
if( ! IsOK( this, _(
"You have chosen the \"not connected\" option. This will create insulated copper islands. Are you sure ?") )
)
return false;
}
wxString net_name = m_ListNetNameSelection->GetString( ii );
/* Search net_code for this net */
EQUIPOT* net;
g_Zone_Default_Setting.m_NetcodeSelection = 0;
/* Search net_code for this net, if a net was selected */
if( m_ListNetNameSelection->GetSelection() > 0 )
{
EQUIPOT* net;
for( net = m_Parent->GetBoard()->m_Equipots; net; net = net->Next() )
{
if( net->GetNetname() == net_name )
......@@ -346,6 +364,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
break;
}
}
}
return true;
}
......
......@@ -314,18 +314,21 @@ void DRC::testUnconnected()
}
}
/**********************************************/
void DRC::testZones(bool adoTestFillSegments)
/**********************************************/
{
// Test copper areas for valide netcodes
// if a netcode is < 0 the netname was not found when reading a netlist
// if a netcode is == 0 the netname is void, and the zone is not connected.
// This is allowed, but i am not sure this is a good idea
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii );
if( ! Area_To_Test->IsOnCopperLayer() )
continue;
if( Area_To_Test->GetNet() <= 0 )
if( Area_To_Test->GetNet() < 0 )
{
m_currentMarker = fillMarker( Area_To_Test,
DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker );
......
......@@ -971,6 +971,8 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
continue;
}
if ( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
{
const EQUIPOT* net = FindNet( GetArea( ii )->m_Netname );
if( net )
{
......@@ -982,6 +984,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
GetArea( ii )->SetNet( -1 ); //keep Net Name ane set m_NetCode to -1 : error flag
}
}
}
return error_count;
}
......@@ -306,24 +306,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
#define REMOVE_UNUSED_THERMAL_STUBS // Can be commented to skip unused thermal stubs calculations
#ifdef REMOVE_UNUSED_THERMAL_STUBS
/* First, Create the list of filled areas begin and end indexes.
* Because a zone creates more than one filled sub area,
* we must handle all start and end points of all sub areas
* for TestPointInsidePolygon, to search if a point is in a filled area in zone
*/
std::vector <int> filled_areas_begin_end_index_list;
unsigned int indexstart = 0, indexend;
for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ )
{
if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found
{
filled_areas_begin_end_index_list.push_back( indexstart );
filled_areas_begin_end_index_list.push_back( indexend );
indexstart = indexend + 1;
}
}
/* Second, Add the main (corrected) polygon (i.e. the filled area using only one outline)
/* Add the main (corrected) polygon (i.e. the filled area using only one outline)
* in GroupA in Bool_Engine to do a BOOL_A_SUB_B operation
* All areas to remove will be put in GroupB in Bool_Engine
*/
......@@ -385,16 +368,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// translate point
ptTest[i] += pad->ReturnShapePos();
bool inside = false;
for( unsigned idx = 0;
idx < filled_areas_begin_end_index_list.size() && inside == false;
idx += 2 )
{
indexstart = filled_areas_begin_end_index_list[idx];
indexend = filled_areas_begin_end_index_list[idx + 1];
inside = TestPointInsidePolygon( m_FilledPolysList, indexstart,
indexend, ptTest[i].x, ptTest[i].y );
}
bool inside = HitTestFilledArea( ptTest[i] );
if( inside == false )
{
......
......@@ -825,7 +825,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
continue;
// Test for same net
if( Area_Ref->GetNet() == Area_To_Test->GetNet() && Area_Ref->GetNet() > 0 )
if( Area_Ref->GetNet() == Area_To_Test->GetNet() && Area_Ref->GetNet() >= 0 )
continue;
// test for some corners of Area_Ref inside Area_To_Test
......@@ -998,7 +998,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
continue;
// Test for same net
if( ( aArea->GetNet() == Area_To_Test->GetNet() ) && (aArea->GetNet() > 0) )
if( ( aArea->GetNet() == Area_To_Test->GetNet() ) && (aArea->GetNet() >= 0) )
continue;
// test for ending line inside Area_To_Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment