From a91f255ccd1415c1ab0744f8cb5f4af70054720c Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Wed, 2 Apr 2008 16:58:56 +0000 Subject: [PATCH] instance specific zone container clearance and pad treatment --- pcbnew/class_zone.cpp | 53 +++++++++++++++++++++++++++++- pcbnew/dialog_zones_by_polygon.cpp | 47 ++++++++++++++++++-------- pcbnew/zones_by_polygon.cpp | 5 +-- 3 files changed, 89 insertions(+), 16 deletions(-) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index d72f278658..18e91bd481 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -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( "" ); } - else // a netcode <à is an error + else // a netcode < 0 is an error { msg = wxT( " [" ); msg << m_Netname + wxT( "]" ); diff --git a/pcbnew/dialog_zones_by_polygon.cpp b/pcbnew/dialog_zones_by_polygon.cpp index 1d802e16c5..25a98ecda1 100644 --- a/pcbnew/dialog_zones_by_polygon.cpp +++ b/pcbnew/dialog_zones_by_polygon.cpp @@ -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(); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index f4851b31d6..54e9ea3676 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -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 );