pcbnew: Prevent degenerate values in Eagle import
Importing Eagle files allowed for invalid zone values for clearance and
minimum width that triggered asserts in the 3d-viewer.
Fixes: lp:1801188
* https://bugs.launchpad.net/kicad/+bug/1801188
(cherry picked from commit df562b7ec0
)
This commit is contained in:
parent
dd39599903
commit
78f7ba10ef
|
@ -752,8 +752,9 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
|
|||
PCB_LAYER_ID aLayerId,
|
||||
int aClearanceValue )
|
||||
{
|
||||
// The full width of the lines to create:
|
||||
const int linewidth = aDrawSegment->GetWidth() + (2 * aClearanceValue);
|
||||
// The full width of the lines to create
|
||||
// The extra 1 protects the inner/outer radius values from degeneracy
|
||||
const int linewidth = aDrawSegment->GetWidth() + (2 * aClearanceValue) + 1;
|
||||
|
||||
switch( aDrawSegment->GetShape() )
|
||||
{
|
||||
|
|
|
@ -1179,7 +1179,8 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
|
|||
|
||||
// clearances, etc.
|
||||
zone->SetArcSegmentCount( 32 ); // @todo: should be a constructor default?
|
||||
zone->SetMinThickness( p.width.ToPcbUnits() );
|
||||
zone->SetMinThickness( std::max<int>(
|
||||
ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS, p.width.ToPcbUnits() ) );
|
||||
|
||||
// FIXME: KiCad zones have very rounded corners compared to eagle.
|
||||
// This means that isolation amounts that work well in eagle
|
||||
|
@ -1187,7 +1188,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
|
|||
if( p.isolate )
|
||||
zone->SetZoneClearance( p.isolate->ToPcbUnits() );
|
||||
else
|
||||
zone->SetZoneClearance( 0 );
|
||||
zone->SetZoneClearance( 1 ); // @todo: set minimum clearance value based on board settings
|
||||
|
||||
// missing == yes per DTD.
|
||||
bool thermals = !p.thermals || *p.thermals;
|
||||
|
|
Loading…
Reference in New Issue