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,18 +69,18 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -69,18 +69,18 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
if( g_Zone_45_Only ) if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 ); 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 ); AddUnitSymbol( *m_ClearanceValueTitle, g_UnitMetric );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UnitMetric,
m_Zone_Setting->m_ZoneClearance, m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( msg ); m_ZoneClearanceCtrl->SetValue( msg );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UnitMetric ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UnitMetric );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UnitMetric,
m_Zone_Setting->m_ZoneMinThickness, m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
switch( m_Zone_Setting->m_Zone_Pad_Options ) switch( m_Zone_Setting->m_Zone_Pad_Options )
...@@ -113,11 +113,11 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -113,11 +113,11 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
AddUnitSymbol( *m_AntipadSizeText, g_UnitMetric ); AddUnitSymbol( *m_AntipadSizeText, g_UnitMetric );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UnitMetric ); AddUnitSymbol( *m_CopperBridgeWidthText, g_UnitMetric );
PutValueInLocalUnits( *m_AntipadSizeValue, PutValueInLocalUnits( *m_AntipadSizeValue,
m_Zone_Setting->m_ThermalReliefGapValue, m_Zone_Setting->m_ThermalReliefGapValue,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
PutValueInLocalUnits( *m_CopperWidthValue, PutValueInLocalUnits( *m_CopperWidthValue,
m_Zone_Setting->m_ThermalReliefCopperBridgeValue, m_Zone_Setting->m_ThermalReliefCopperBridgeValue,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
switch( m_Zone_Setting->m_Zone_HatchingStyle ) switch( m_Zone_Setting->m_Zone_HatchingStyle )
{ {
...@@ -158,17 +158,20 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -158,17 +158,20 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_NetSortingOption->SetSelection( m_NetSorting ); m_NetSortingOption->SetSelection( m_NetSorting );
wxString NetNameFilter = wxT( "N_0*" ); wxString NetNameFilter = wxT( "N_0*" );
if( m_Config ) if( m_Config )
{ {
NetNameFilter = NetNameFilter =
m_Config->Read( ZONE_NET_FILTER_STRING_KEY ); m_Config->Read( ZONE_NET_FILTER_STRING_KEY );
} }
// Build list of nets:
m_NetNameFilter->SetValue( NetNameFilter ); m_NetNameFilter->SetValue( NetNameFilter );
wxArrayString ListNetName; wxArrayString ListNetName;
m_Parent->GetBoard()->ReturnSortedNetnamesList( ListNetName, m_Parent->GetBoard()->ReturnSortedNetnamesList(
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT ); ListNetName,
m_NetSorting ==
0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if( m_NetSorting != 0 ) if( m_NetSorting != 0 )
{ {
...@@ -183,6 +186,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -183,6 +186,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
} }
} }
ListNetName.Insert( wxT( "<no net>" ), 0 );
m_ListNetNameSelection->InsertItems( ListNetName, 0 ); m_ListNetNameSelection->InsertItems( ListNetName, 0 );
// Select net: // Select net:
...@@ -265,7 +269,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -265,7 +269,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
if( m_Config ) if( m_Config )
{ {
m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) m_Zone_Setting->m_Zone_HatchingStyle ); (long) m_Zone_Setting->m_Zone_HatchingStyle );
wxString Filter = m_NetNameFilter->GetValue(); wxString Filter = m_NetNameFilter->GetValue();
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter ); m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter );
} }
...@@ -279,10 +283,11 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -279,10 +283,11 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
txtvalue = m_ZoneMinThicknessCtrl->GetValue(); txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits ); ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits );
if ( m_Zone_Setting->m_ZoneMinThickness < 10 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {
DisplayError( this, 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; return false;
} }
...@@ -292,20 +297,22 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -292,20 +297,22 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
g_Zone_45_Only = TRUE; g_Zone_45_Only = TRUE;
m_Zone_Setting->m_ThermalReliefGapValue = ReturnValueFromTextCtrl( *m_AntipadSizeValue, m_Zone_Setting->m_ThermalReliefGapValue = ReturnValueFromTextCtrl( *m_AntipadSizeValue,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
m_Zone_Setting->m_ThermalReliefCopperBridgeValue = ReturnValueFromTextCtrl( m_Zone_Setting->m_ThermalReliefCopperBridgeValue = ReturnValueFromTextCtrl(
*m_CopperWidthValue, *m_CopperWidthValue,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefGapValue ); (long) m_Zone_Setting->m_ThermalReliefGapValue );
m_Config->Write( m_Config->Write(
ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefCopperBridgeValue ); (long) m_Zone_Setting->m_ThermalReliefCopperBridgeValue );
if( m_Zone_Setting->m_ThermalReliefCopperBridgeValue <= m_Zone_Setting->m_ZoneMinThickness ) 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; return false;
} }
...@@ -333,17 +340,29 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -333,17 +340,29 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return false; 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 ); wxString net_name = m_ListNetNameSelection->GetString( ii );
/* Search net_code for this net */
EQUIPOT* net;
g_Zone_Default_Setting.m_NetcodeSelection = 0; g_Zone_Default_Setting.m_NetcodeSelection = 0;
for( net = m_Parent->GetBoard()->m_Equipots; net; net = net->Next() )
/* Search net_code for this net, if a net was selected */
if( m_ListNetNameSelection->GetSelection() > 0 )
{ {
if( net->GetNetname() == net_name ) EQUIPOT* net;
for( net = m_Parent->GetBoard()->m_Equipots; net; net = net->Next() )
{ {
g_Zone_Default_Setting.m_NetcodeSelection = net->GetNet(); if( net->GetNetname() == net_name )
break; {
g_Zone_Default_Setting.m_NetcodeSelection = net->GetNet();
break;
}
} }
} }
......
...@@ -314,18 +314,21 @@ void DRC::testUnconnected() ...@@ -314,18 +314,21 @@ void DRC::testUnconnected()
} }
} }
/**********************************************/
void DRC::testZones(bool adoTestFillSegments) void DRC::testZones(bool adoTestFillSegments)
/**********************************************/
{ {
// Test copper areas for valide netcodes // 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 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++ ) for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii ); ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii );
if( ! Area_To_Test->IsOnCopperLayer() ) if( ! Area_To_Test->IsOnCopperLayer() )
continue; continue;
if( Area_To_Test->GetNet() <= 0 ) if( Area_To_Test->GetNet() < 0 )
{ {
m_currentMarker = fillMarker( Area_To_Test, m_currentMarker = fillMarker( Area_To_Test,
DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker ); DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker );
......
...@@ -971,15 +971,18 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) ...@@ -971,15 +971,18 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
continue; continue;
} }
const EQUIPOT* net = FindNet( GetArea( ii )->m_Netname ); if ( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
if( net )
{ {
GetArea( ii )->SetNet( net->GetNet() ); const EQUIPOT* net = FindNet( GetArea( ii )->m_Netname );
} if( net )
else {
{ GetArea( ii )->SetNet( net->GetNet() );
error_count++; }
GetArea( ii )->SetNet( -1 ); //keep Net Name ane set m_NetCode to -1 : error flag else
{
error_count++;
GetArea( ii )->SetNet( -1 ); //keep Net Name ane set m_NetCode to -1 : error flag
}
} }
} }
......
...@@ -306,24 +306,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -306,24 +306,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
#define REMOVE_UNUSED_THERMAL_STUBS // Can be commented to skip unused thermal stubs calculations #define REMOVE_UNUSED_THERMAL_STUBS // Can be commented to skip unused thermal stubs calculations
#ifdef REMOVE_UNUSED_THERMAL_STUBS #ifdef REMOVE_UNUSED_THERMAL_STUBS
/* First, Create the list of filled areas begin and end indexes. /* Add the main (corrected) polygon (i.e. the filled area using only one outline)
* 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)
* in GroupA in Bool_Engine to do a BOOL_A_SUB_B operation * 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 * All areas to remove will be put in GroupB in Bool_Engine
*/ */
...@@ -385,16 +368,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -385,16 +368,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// translate point // translate point
ptTest[i] += pad->ReturnShapePos(); ptTest[i] += pad->ReturnShapePos();
bool inside = false; bool inside = HitTestFilledArea( ptTest[i] );
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 );
}
if( inside == false ) if( inside == false )
{ {
......
...@@ -825,7 +825,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -825,7 +825,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
continue; continue;
// Test for same net // 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; continue;
// test for some corners of Area_Ref inside Area_To_Test // test for some corners of Area_Ref inside Area_To_Test
...@@ -998,7 +998,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) ...@@ -998,7 +998,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
continue; continue;
// Test for same net // 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; continue;
// test for ending line inside Area_To_Test // 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