Commit 42c2399a authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Try to find a better workaround for zone fiill bug (crash or bad fil...

Pcbnew: Try to find a better workaround for zone fiill bug (crash or bad fil areasl in very rare cases).
pcbnew+Eeschema: Fix a very minor bug: filename not displayed in frame reference.
parent 3af054c7
......@@ -1472,13 +1472,12 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
case WS_FILENAME:
{
wxString fname, fext;
wxFileName::SplitPath( aFlNm, (wxString*) NULL, &fname, &fext );
wxFileName fn( aFlNm );
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << fname << wxT( "." ) << fext;
msg << fn.GetFullName();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......
......@@ -61,7 +61,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() );
GetScreen()->GetFileName() );
#ifdef USE_WX_OVERLAY
if( IsShown() )
......
......@@ -852,7 +852,7 @@ void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() );
GetScreen()->GetFileName() );
}
......
......@@ -945,33 +945,34 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
text << wxT( " " );
text << wxString::Format( wxT( "(%08lX)" ), m_TimeStamp );
if ( !IsOnCopperLayer() )
// Display net name for copper zones
if( !GetIsKeepout() )
{
text << wxT( " [" ) << _( "Not on copper layer" ) << wxT( "]" );
}
else if( GetNet() >= 0 )
{
if( board )
if( GetNet() >= 0 )
{
net = board->FindNet( GetNet() );
if( board )
{
net = board->FindNet( GetNet() );
if( net )
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
}
else
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
text << _( "** NO BOARD DEFINED **" );
}
}
else
{
text << _( "** NO BOARD DEFINED **" );
{ // A netcode < 0 is an error:
// Netname not found or area not initialised
text << wxT( " [" ) << m_Netname << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
}
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
{
text << wxT( " [" ) << m_Netname << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
text << _( " on " ) << GetLayerName();
text << _( " on layer " ) << GetLayerName();
return text;
}
......@@ -109,7 +109,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
m_canvas->DrawBackGround( DC );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness,
IU_PER_MILS, wxEmptyString );
IU_PER_MILS, GetBoard()->GetFileName() );
GetBoard()->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST );
......
......@@ -453,14 +453,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{
KI_POLYGON_SET polyset_holes;
AddPolygonCornersToKiPolygonList( cornerBufferPolysToSubstract, polyset_holes );
// In very rare cases, the next calculation crashes when Pcbnew is in nanometers.
// the crash is inside boost::polygon (tested with version 1.49 and 1.53,
// so this crash is nearly impossible to fix
// and a workaround is here to combine the polygons to substract, to modify
// the geometry of the polygons to substract, because
// the 2 known cases are related to 2 rectangular overlapping rect to substract
// with a given geometry
KI_POLYGON_SET dummy; polyset_holes += dummy;
// Remove unconnected stubs
polyset_zone_solid_areas -= polyset_holes;
......
......@@ -76,10 +76,6 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
// Calculate thermal bridge half width
int thermalBridgeWidth = aZone->GetThermalReliefCopperBridge( pad ) / 2;
int thermalReliefGap = aZone->GetThermalReliefGap( pad );
// Rejects non-standard pads with tht-only thermal reliefs
if( aZone->GetPadConnection( pad ) == THT_THERMAL
&& pad->GetAttribute() != PAD_STANDARD )
......@@ -96,6 +92,19 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
if( pad->GetNet() != aZone->GetNet() )
continue;
// Calculate thermal bridge half width
int thermalBridgeWidth = aZone->GetThermalReliefCopperBridge( pad )
- aZone->m_ZoneMinThickness;
if( thermalBridgeWidth <= 0 )
continue;
// we need the thermal bridge half width
// with a small extra size to be sure we create a stub
// slightly larger than the actual stub
thermalBridgeWidth = ( thermalBridgeWidth + 4 ) / 2;
int thermalReliefGap = aZone->GetThermalReliefGap( pad );
item_boundingbox = pad->GetBoundingBox();
item_boundingbox.Inflate( thermalReliefGap );
if( !( item_boundingbox.Intersects( zone_boundingbox ) ) )
......@@ -103,16 +112,26 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
// Thermal bridges are like a segment from a starting point inside the pad
// to an ending point outside the pad
wxPoint startpoint, endpoint;
// calculate the ending point of the thermal pad, outside the pad
wxPoint endpoint;
endpoint.x = ( pad->GetSize().x / 2 ) + thermalReliefGap;
endpoint.y = ( pad->GetSize().y / 2 ) + thermalReliefGap;
int copperThickness = aZone->GetThermalReliefCopperBridge( pad ) - aZone->m_ZoneMinThickness;
// Calculate the starting point of the thermal stub
// inside the pad
wxPoint startpoint;
int copperThickness = aZone->GetThermalReliefCopperBridge( pad )
- aZone->m_ZoneMinThickness;
if( copperThickness < 0 )
copperThickness = 0;
// Leave a small extra size to the copper area inside to pad
copperThickness += (int)(IU_PER_MM * 0.04);
startpoint.x = std::min( pad->GetSize().x, copperThickness );
startpoint.y = std::min( pad->GetSize().y, copperThickness );
startpoint.x /= 2;
startpoint.y /= 2;
......@@ -143,6 +162,7 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
// translate point
ptTest[i] += pad->ReturnShapePos();
if( aZone->HitTestFilledArea( ptTest[i] ) )
continue;
......
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