Commit a91f255c authored by dickelbeck's avatar dickelbeck

instance specific zone container clearance and pad treatment

parent 9d395aa0
......@@ -78,6 +78,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
int ret;
unsigned corners_count = m_Poly->corner.size();
int outline_hatch;
char padoption;
fprintf( aFile, "$CZONE_OUTLINE\n" );
......@@ -114,6 +115,25 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
if( ret < 2 )
return false;
// Save pad option and clearance
switch( m_PadOption )
{
default:
case PAD_IN_ZONE:
padoption = 'I';
break;
case THERMAL_PAD:
padoption = 'T';
break;
case PAD_NOT_IN_ZONE:
padoption = 'X';
break;
}
ret = fprintf( aFile, "ZClearance %d %c\n", m_ZoneClearance, padoption );
if( ret < 2 )
return false;
// Save the corner list
for( item_pos = 0; item_pos < corners_count; item_pos++ )
{
......@@ -224,6 +244,37 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
}
}
}
if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // aux info found
{
int clearance = 200;
char padoption;
text = Line + 10;
ret = sscanf( text, "%d %1c", &clearance, &padoption );
if( ret < 2 )
error = true;
else
{
m_ZoneClearance = clearance;
switch( padoption )
{
case 'i':
case 'I':
m_PadOption = PAD_IN_ZONE;
break;
case 't':
case 'T':
m_PadOption = THERMAL_PAD;
break;
case 'x':
case 'X':
m_PadOption = PAD_NOT_IN_ZONE;
break;
}
}
}
if( strnicmp( Line, "$end", 4 ) == 0 ) // end of description
{
break;
......@@ -540,7 +591,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
else
msg = wxT( "<noname>" );
}
else // a netcode < is an error
else // a netcode < 0 is an error
{
msg = wxT( " [" );
msg << m_Netname + wxT( "]" );
......
......@@ -278,8 +278,15 @@ void WinEDA_ZoneFrame::CreateControls()
m_GridCtrl->SetSelection( selection );
switch( s_Zone_Pad_Options )
if( m_Zone_Container )
{
title = ReturnStringFromValue( g_UnitMetric,
m_Zone_Container->m_ZoneClearance,
m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( title );
switch( m_Zone_Container->m_PadOption )
{
case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered
m_FillOpt->SetSelection( 2 );
break;
......@@ -289,27 +296,41 @@ void WinEDA_ZoneFrame::CreateControls()
case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper
m_FillOpt->SetSelection( 0 );
break;
}
if ( m_Zone_Container )
}
s_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
}
else
{
switch( s_Zone_Pad_Options )
{
case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered
m_FillOpt->SetSelection( 2 );
break;
case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads
m_FillOpt->SetSelection( 1 );
break;
case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper
m_FillOpt->SetSelection( 0 );
break;
}
s_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) CPolyLine::DIAGONAL_EDGE );
}
switch( s_Zone_Hatching )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection(0);
break;
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection(0);
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection(1);
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection(1);
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection(2);
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection(2);
break;
}
int layer_cnt = board->GetCopperLayerCount();
......
......@@ -491,7 +491,9 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
s_CurrentZone = NULL;
}
ZONE_CONTAINER* zone;
if( m_Pcb->m_CurrentZoneContour == NULL )
m_Pcb->m_CurrentZoneContour = new ZONE_CONTAINER( m_Pcb );
......@@ -850,8 +852,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
Affiche_1_Parametre( this, 22, _( "NetName" ), msg, RED );
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
zone_container->m_PadOption = s_Zone_Pad_Options;
zone_container->m_ZoneClearance = g_DesignSettings.m_ZoneClearence;
zone_container->m_GridFillValue = g_GridRoutingSize;
int error_level = zone_container->Fill_Zone( this, DC, verbose );
......
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