mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Prefer board's errorMax to a constant.
This commit is contained in:
parent
98e0a79f05
commit
044ac6e8e5
@ -318,7 +318,7 @@ unsigned int BOARD_ADAPTER::GetCircleSegmentCount( int aDiameterBIU ) const
|
||||
{
|
||||
wxASSERT( aDiameterBIU > 0 );
|
||||
|
||||
return GetArcToSegmentCount( aDiameterBIU / 2, ARC_HIGH_DEF, FULL_CIRCLE );
|
||||
return GetArcToSegmentCount( aDiameterBIU / 2, m_board->GetDesignSettings().m_MaxError, FULL_CIRCLE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_table.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_painter.h> // for PCB_RENDER_SETTINGS
|
||||
#include <zone.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
@ -96,7 +95,6 @@ void addROUND_SEGMENT_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aStart,
|
||||
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
float penWidth_3DU = TO_3DU( aText->GetEffectiveTextPenWidth() );
|
||||
@ -111,7 +109,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
const PCB_TEXT* pcbText = static_cast<const PCB_TEXT*>( aOwner );
|
||||
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, maxError, ERROR_INSIDE );
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, aOwner->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
|
||||
// if needed, and Fracture() called twice can create bad results and is useless
|
||||
@ -318,8 +316,7 @@ void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D
|
||||
VECTOR2I center( arc->GetCenter() );
|
||||
EDA_ANGLE arc_angle = arc->GetAngle();
|
||||
double radius = arc->GetRadius();
|
||||
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), m_board->GetDesignSettings().m_MaxError,
|
||||
arc_angle );
|
||||
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), arc->GetMaxError(), arc_angle );
|
||||
int circlesegcount;
|
||||
|
||||
// Avoid arcs that cannot be drawn
|
||||
@ -360,7 +357,6 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
PCB_LAYER_ID aLayer, const VECTOR2I& aMargin ) const
|
||||
{
|
||||
SHAPE_POLY_SET poly;
|
||||
int maxError = GetBoard()->GetDesignSettings().m_MaxError;
|
||||
VECTOR2I clearance = aMargin;
|
||||
|
||||
// Our shape-based builder can't handle negative or differing x:y clearance values (the
|
||||
@ -379,7 +375,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
|
||||
PAD dummy( *aPad );
|
||||
dummy.SetSize( aLayer, VECTOR2I( dummySize.x, dummySize.y ) );
|
||||
dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
dummy.TransformShapeToPolygon( poly, aLayer, 0, aPad->GetMaxError(), ERROR_INSIDE );
|
||||
clearance = { 0, 0 };
|
||||
}
|
||||
else if( aPad->GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
|
||||
@ -387,7 +383,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
// A custom pad can have many complex subshape items. To avoid issues, use its
|
||||
// final polygon shape, not its basic shape set. One cannot apply the clearance
|
||||
// to each subshape: it does no work
|
||||
aPad->TransformShapeToPolygon( poly, aLayer, 0, maxError );
|
||||
aPad->TransformShapeToPolygon( poly, aLayer, 0, aPad->GetMaxError() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -443,7 +439,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
case SH_ARC:
|
||||
{
|
||||
const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( shape );
|
||||
SHAPE_LINE_CHAIN l = arc->ConvertToPolyline( maxError );
|
||||
SHAPE_LINE_CHAIN l = arc->ConvertToPolyline( aPad->GetMaxError() );
|
||||
|
||||
for( int i = 0; i < l.SegmentCount(); i++ )
|
||||
{
|
||||
@ -469,7 +465,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
if( !poly.IsEmpty() )
|
||||
{
|
||||
if( clearance.x )
|
||||
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, aPad->GetMaxError() );
|
||||
|
||||
// Add the PAD polygon
|
||||
ConvertPolygonToTriangles( poly, *aContainer, m_biuTo3Dunits, *aPad );
|
||||
@ -639,15 +635,14 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0,
|
||||
m_board->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
polyList.Simplify();
|
||||
|
||||
if( margin != 0 )
|
||||
{
|
||||
polyList.Inflate( margin, CORNER_STRATEGY::ROUND_ALL_CORNERS,
|
||||
GetBoard()->GetDesignSettings().m_MaxError );
|
||||
polyList.Inflate( margin, CORNER_STRATEGY::ROUND_ALL_CORNERS, aShape->GetMaxError() );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
@ -685,8 +680,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
|
||||
m_board->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
// picture of a text converted to a polygon
|
||||
@ -701,7 +696,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
|
||||
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
|
||||
|
||||
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
|
||||
polyList.Inflate( margin, cornerStr, aShape->GetMaxError() );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
@ -714,8 +709,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
|
||||
m_board->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
// picture of a text converted to a polygon
|
||||
@ -730,7 +725,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
|
||||
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
|
||||
|
||||
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
|
||||
polyList.Inflate( margin, cornerStr, aShape->GetMaxError() );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
@ -808,8 +803,8 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
|
||||
m_board->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aTextBox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
}
|
||||
|
@ -219,13 +219,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
trackList.clear();
|
||||
trackList.reserve( m_board->Tracks().size() );
|
||||
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
// Skip tracks (not vias theyt are on more than one layer ) on disabled layers
|
||||
if( track->Type() != PCB_VIA_T
|
||||
&& !Is3dLayerEnabled( track->GetLayer(), visibilityFlags ) )
|
||||
if( track->Type() != PCB_VIA_T && !Is3dLayerEnabled( track->GetLayer(), visibilityFlags ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -382,9 +379,15 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE );
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE );
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,10 +444,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
||||
|
||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(), hole_outer_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(), holediameter / 2,
|
||||
maxError, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||
{
|
||||
@ -454,16 +457,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
// Add through hole contours
|
||||
TransformCircleToPolygon( m_TH_ODPolys, via->GetStart(), hole_outer_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
// Add same thing for vias only
|
||||
TransformCircleToPolygon( m_viaTH_ODPolys, via->GetStart(), hole_outer_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
{
|
||||
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(), hole_outer_ring_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -490,14 +493,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
continue;
|
||||
|
||||
// Skip vias annulus when not flashed on this layer
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T && !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the track/via contour
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, 0, track->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -550,17 +550,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
{
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, inflate, maxError, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, inflate, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, maxError, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, pad->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not plated, no copper.
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, 0, maxError, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, maxError, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -582,9 +582,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
SHAPE_POLY_SET* layerPoly = layer == F_Cu ? m_frontPlatedCopperPolys : m_backPlatedCopperPolys;
|
||||
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
|
||||
// Add copper item to poly contours (vertical outlines) if required
|
||||
@ -594,9 +594,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
SHAPE_POLY_SET* layerPoly = m_layers_poly[layer];
|
||||
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -655,18 +655,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* text_box = static_cast<PCB_TEXTBOX*>( item );
|
||||
text_box->TransformTextToPolySet( *copperPolys, 0, maxError, ERROR_INSIDE );
|
||||
text_box->TransformTextToPolySet( *copperPolys, 0, text_box->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
// Add box outlines
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, maxError, ERROR_INSIDE );
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, text_box->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
text->TransformTextToPolySet( *copperPolys, 0, maxError, ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( *copperPolys, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
{
|
||||
item->TransformShapeToPolySet( *copperPolys, layer, 0, maxError, ERROR_INSIDE );
|
||||
item->TransformShapeToPolySet( *copperPolys, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,14 +682,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( *layerPoly, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -696,9 +698,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, textbox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, textbox->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -707,14 +712,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, cell->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, maxError, ERROR_INSIDE );
|
||||
seg.TransformToPolygon( *layerPoly, table->GetMaxError(), ERROR_INSIDE );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
@ -727,10 +732,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
dimension->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
dimension->TransformTextToPolySet( *layerPoly, 0, dimension->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
for( const std::shared_ptr<SHAPE>& shape : dimension->GetShapes() )
|
||||
shape->TransformToPolygon( *layerPoly, maxError, ERROR_INSIDE );
|
||||
shape->TransformToPolygon( *layerPoly, dimension->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
break;
|
||||
}
|
||||
@ -762,7 +767,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
SHAPE_POLY_SET* copperPolys = layer == F_Cu ? m_frontPlatedCopperPolys : m_backPlatedCopperPolys;
|
||||
|
||||
zone->TransformShapeToPolygon( *copperPolys, layer, 0, maxError, ERROR_INSIDE );
|
||||
zone->TransformShapeToPolygon( *copperPolys, layer, 0, zone->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1025,14 +1030,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( *layerPoly, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1041,9 +1046,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, textbox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, textbox->GetMaxError(), ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1052,14 +1060,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, cell->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, maxError, ERROR_INSIDE );
|
||||
seg.TransformToPolygon( *layerPoly, table->GetMaxError(), ERROR_INSIDE );
|
||||
} );
|
||||
|
||||
break;
|
||||
@ -1083,7 +1091,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( via->FlashLayer( layer ) && !via->IsTented( layer ) )
|
||||
{
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError,
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
@ -1091,7 +1099,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
if( track->HasSolderMask() )
|
||||
{
|
||||
track->TransformShapeToPolySet( *layerPoly, layer, maskExpansion, maxError,
|
||||
track->TransformShapeToPolySet( *layerPoly, layer, maskExpansion, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
@ -1108,16 +1116,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
{
|
||||
if( pad->IsOnLayer( layer ) )
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError, ERROR_INSIDE );
|
||||
{
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, pad->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, footprint->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, footprint->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, footprint->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( cfg.show_zones || layer == F_Mask || layer == B_Mask )
|
||||
|
@ -771,8 +771,7 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
|
||||
wxASSERT( zbot < ztop );
|
||||
|
||||
generateCylinder( via_center, hole_inner_radius,
|
||||
hole_inner_radius + platingThickness3d,
|
||||
generateCylinder( via_center, hole_inner_radius, hole_inner_radius + platingThickness3d,
|
||||
ztop, zbot, nrSegments, layerTriangleVIA );
|
||||
}
|
||||
}
|
||||
@ -802,10 +801,10 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
{
|
||||
TransformCircleToPolygon( tht_outer_holes_poly, via->GetPosition(),
|
||||
via->GetDrill() / 2 + platingThickness,
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(),
|
||||
via->GetDrill() / 2, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(), via->GetDrill() / 2,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -824,9 +823,9 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
continue;
|
||||
|
||||
pad->TransformHoleToPolygon( tht_outer_holes_poly, platingThickness,
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0,
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,6 +325,8 @@ public:
|
||||
bool IsLocked() const override;
|
||||
void SetLocked( bool aLocked ) override { m_isLocked = aLocked; }
|
||||
|
||||
int GetMaxError() const;
|
||||
|
||||
virtual void StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) { }
|
||||
|
||||
/**
|
||||
|
@ -1103,7 +1103,7 @@ HANDLER_RESULT<PadShapeAsPolygonResponse> API_HANDLER_PCB::handleGetPadShapeAsPo
|
||||
PAD* pad = static_cast<PAD*>( *optPad );
|
||||
SHAPE_POLY_SET poly;
|
||||
pad->TransformShapeToPolygon( poly, pad->Padstack().EffectiveLayerFor( layer ), 0,
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
types::PolygonWithHoles* polyMsg = response.mutable_polygons()->Add();
|
||||
PackPolyLine( *polyMsg->mutable_outline(), poly.COutline( 0 ) );
|
||||
|
@ -2597,7 +2597,7 @@ bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
|
||||
continue;
|
||||
|
||||
SHAPE_POLY_SET hole;
|
||||
pad->TransformHoleToPolygon( hole, 0, GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( hole, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
if( hole.OutlineCount() > 0 ) // can be not the case for malformed NPTH holes
|
||||
{
|
||||
|
@ -135,6 +135,15 @@ const KIFONT::METRICS& BOARD_ITEM::GetFontMetrics() const
|
||||
}
|
||||
|
||||
|
||||
int BOARD_ITEM::GetMaxError() const
|
||||
{
|
||||
if( const BOARD* board = GetBoard() )
|
||||
return board->GetDesignSettings().m_MaxError;
|
||||
|
||||
return ARC_HIGH_DEF;
|
||||
}
|
||||
|
||||
|
||||
int BOARD_ITEM::BoardLayerCount() const
|
||||
{
|
||||
const BOARD* board = GetBoard();
|
||||
|
@ -1161,7 +1161,7 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
|
||||
else
|
||||
m_item->SetLocalSolderMaskMargin( m_solderMaskMargin.GetIntValue() );
|
||||
|
||||
m_item->RebuildBezierToSegmentsPointsList( m_parent->GetDesignSettings().m_MaxError );
|
||||
m_item->RebuildBezierToSegmentsPointsList( m_item->GetMaxError() );
|
||||
|
||||
if( m_item->IsOnCopperLayer() )
|
||||
m_item->SetNetCode( m_netSelector->GetSelectedNetcode() );
|
||||
|
@ -178,12 +178,11 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
||||
if( !handled )
|
||||
{
|
||||
// Slow (but general purpose) method.
|
||||
int maxError = pad->GetBoard()->GetDesignSettings().m_MaxError;
|
||||
SEG::ecoord dist_sq;
|
||||
SHAPE_POLY_SET padOutline;
|
||||
std::shared_ptr<SHAPE_SEGMENT> slot = pad->GetEffectiveHoleShape();
|
||||
|
||||
pad->TransformShapeToPolygon( padOutline, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
pad->TransformShapeToPolygon( padOutline, aLayer, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
if( sameNumPads.empty() )
|
||||
{
|
||||
@ -213,11 +212,10 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
||||
for( const PAD* sameNumPad : sameNumPads )
|
||||
{
|
||||
// Construct the full pad with outline and hole.
|
||||
sameNumPad->TransformShapeToPolygon( aggregatePadOutline,
|
||||
PADSTACK::ALL_LAYERS, 0,
|
||||
maxError, ERROR_OUTSIDE );
|
||||
sameNumPad->TransformShapeToPolygon( aggregatePadOutline, PADSTACK::ALL_LAYERS,
|
||||
0, pad->GetMaxError(), ERROR_OUTSIDE );
|
||||
|
||||
sameNumPad->TransformHoleToPolygon( otherPadHoles, 0, maxError,
|
||||
sameNumPad->TransformHoleToPolygon( otherPadHoles, 0, pad->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,6 @@ void GENCAD_EXPORTER::createPadsShapesSection()
|
||||
fprintf( m_file, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
|
||||
SHAPE_POLY_SET outline;
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
VECTOR2I padOffset( 0, 0 );
|
||||
|
||||
TransformRoundChamferedRectToPolygon( outline, padOffset,
|
||||
@ -490,7 +489,7 @@ void GENCAD_EXPORTER::createPadsShapesSection()
|
||||
pad->GetRoundRectCornerRadius( PADSTACK::ALL_LAYERS ),
|
||||
pad->GetChamferRectRatio( PADSTACK::ALL_LAYERS ),
|
||||
pad->GetChamferPositions( PADSTACK::ALL_LAYERS ),
|
||||
0, maxError, ERROR_INSIDE );
|
||||
0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
for( int jj = 0; jj < outline.OutlineCount(); ++jj )
|
||||
{
|
||||
|
@ -164,7 +164,6 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
{
|
||||
bool hasdata = false;
|
||||
std::vector<PAD*> padsMatchingNetFilter;
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
// Dump the pad holes into the PCB
|
||||
for( PAD* pad : aFootprint->Pads() )
|
||||
@ -173,10 +172,10 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
std::shared_ptr<SHAPE_SEGMENT> holeShape = pad->GetEffectiveHoleShape();
|
||||
|
||||
SHAPE_POLY_SET holePoly;
|
||||
holeShape->TransformToPolygon( holePoly, maxError, ERROR_INSIDE );
|
||||
holeShape->TransformToPolygon( holePoly, pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
// This helps with fusing
|
||||
holePoly.Deflate( m_platingThickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
holePoly.Deflate( m_platingThickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, pad->GetMaxError() );
|
||||
|
||||
for( PCB_LAYER_ID pcblayer : pad->GetLayerSet().Seq() )
|
||||
{
|
||||
@ -188,11 +187,8 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
{
|
||||
int platingThickness = pad->GetAttribute() == PAD_ATTRIB::PTH ? m_platingThickness : 0;
|
||||
|
||||
if( m_pcbModel->AddHole( *holeShape, platingThickness, F_Cu, B_Cu, false, aOrigin, true,
|
||||
true ) )
|
||||
{
|
||||
if( m_pcbModel->AddHole( *holeShape, platingThickness, F_Cu, B_Cu, false, aOrigin, true, true ) )
|
||||
hasdata = true;
|
||||
}
|
||||
|
||||
//// Cut holes in silkscreen (buggy: insufficient polyset self-intersection checking)
|
||||
//if( m_layersToExport.Contains( F_SilkS ) || m_layersToExport.Contains( B_SilkS ) )
|
||||
@ -207,8 +203,7 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
|
||||
if( m_params.m_ExportPads )
|
||||
{
|
||||
if( m_pcbModel->AddPadShape( pad, aOrigin, false,
|
||||
castellated ? aClipPolygon : nullptr) )
|
||||
if( m_pcbModel->AddPadShape( pad, aOrigin, false, castellated ? aClipPolygon : nullptr) )
|
||||
hasdata = true;
|
||||
|
||||
if( m_params.m_ExportSoldermask )
|
||||
@ -220,9 +215,8 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
|
||||
SHAPE_POLY_SET poly;
|
||||
PCB_LAYER_ID cuLayer = ( pcblayer == F_Mask ) ? F_Cu : B_Cu;
|
||||
pad->TransformShapeToPolygon( poly, cuLayer,
|
||||
pad->GetSolderMaskExpansion( cuLayer ), maxError,
|
||||
ERROR_INSIDE );
|
||||
pad->TransformShapeToPolygon( poly, cuLayer, pad->GetSolderMaskExpansion( cuLayer ),
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
m_poly_shapes[pcblayer][wxEmptyString].Append( poly );
|
||||
}
|
||||
@ -240,7 +234,7 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
|
||||
|
||||
SHAPE_POLY_SET buffer;
|
||||
|
||||
aFootprint->TransformFPShapesToPolySet( buffer, pcblayer, 0, maxError, ERROR_INSIDE,
|
||||
aFootprint->TransformFPShapesToPolySet( buffer, pcblayer, 0, aFootprint->GetMaxError(), ERROR_INSIDE,
|
||||
true, /* include text */
|
||||
true, /* include shapes */
|
||||
false /* include private items */ );
|
||||
@ -422,18 +416,18 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||
|| ( !m_params.m_NetFilter.IsEmpty()
|
||||
&& !aTrack->GetNetname().Matches( m_params.m_NetFilter ) );
|
||||
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
if( m_params.m_ExportSoldermask && aTrack->IsOnLayer( F_Mask ) )
|
||||
{
|
||||
aTrack->TransformShapeToPolygon( m_poly_shapes[F_Mask][wxEmptyString], F_Mask,
|
||||
aTrack->GetSolderMaskExpansion(), maxError, ERROR_INSIDE );
|
||||
aTrack->GetSolderMaskExpansion(), aTrack->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( m_params.m_ExportSoldermask && aTrack->IsOnLayer( B_Mask ) )
|
||||
{
|
||||
aTrack->TransformShapeToPolygon( m_poly_shapes[B_Mask][wxEmptyString], B_Mask,
|
||||
aTrack->GetSolderMaskExpansion(), maxError, ERROR_INSIDE );
|
||||
aTrack->GetSolderMaskExpansion(), aTrack->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( aTrack->Type() == PCB_VIA_T )
|
||||
@ -442,10 +436,10 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||
|
||||
std::shared_ptr<SHAPE_SEGMENT> holeShape = via->GetEffectiveHoleShape();
|
||||
SHAPE_POLY_SET holePoly;
|
||||
holeShape->TransformToPolygon( holePoly, maxError, ERROR_INSIDE );
|
||||
holeShape->TransformToPolygon( holePoly, via->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
// This helps with fusing
|
||||
holePoly.Deflate( m_platingThickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
holePoly.Deflate( m_platingThickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, via->GetMaxError() );
|
||||
|
||||
LSET layers( via->GetLayerSet() & m_layersToExport );
|
||||
|
||||
@ -459,7 +453,7 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||
const std::shared_ptr<SHAPE>& shape = via->GetEffectiveShape( pcblayer );
|
||||
|
||||
SHAPE_POLY_SET poly;
|
||||
shape->TransformToPolygon( poly, maxError, ERROR_INSIDE );
|
||||
shape->TransformToPolygon( poly, via->GetMaxError(), ERROR_INSIDE );
|
||||
m_poly_shapes[pcblayer][via->GetNetname()].Append( poly );
|
||||
m_poly_holes[pcblayer].Append( holePoly );
|
||||
}
|
||||
@ -489,7 +483,7 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||
return false;
|
||||
|
||||
aTrack->TransformShapeToPolygon( m_poly_shapes[pcblayer][aTrack->GetNetname()], pcblayer, 0,
|
||||
maxError, ERROR_INSIDE );
|
||||
aTrack->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -534,8 +528,6 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
if( IsInnerCopperLayer( pcblayer ) && !m_params.m_ExportInnerCopper )
|
||||
return false;
|
||||
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
@ -553,7 +545,7 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
if( lineStyle == LINE_STYLE::SOLID )
|
||||
{
|
||||
graphic->TransformShapeToPolySet( m_poly_shapes[pcblayer][graphic->GetNetname()],
|
||||
pcblayer, 0, maxError, ERROR_INSIDE );
|
||||
pcblayer, 0, graphic->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -571,7 +563,7 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
{
|
||||
SHAPE_SEGMENT seg( a, b, graphic->GetWidth() );
|
||||
seg.TransformToPolygon( m_poly_shapes[pcblayer][graphic->GetNetname()],
|
||||
maxError, ERROR_INSIDE );
|
||||
graphic->GetMaxError(), ERROR_INSIDE );
|
||||
} );
|
||||
}
|
||||
|
||||
@ -585,13 +577,15 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
if( m_params.m_ExportSoldermask && graphic->IsOnLayer( F_Mask ) )
|
||||
{
|
||||
graphic->TransformShapeToPolygon( m_poly_shapes[F_Mask][wxEmptyString], F_Mask,
|
||||
graphic->GetSolderMaskExpansion(), maxError, ERROR_INSIDE );
|
||||
graphic->GetSolderMaskExpansion(), graphic->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( m_params.m_ExportSoldermask && graphic->IsOnLayer( B_Mask ) )
|
||||
{
|
||||
graphic->TransformShapeToPolygon( m_poly_shapes[B_Mask][wxEmptyString], B_Mask,
|
||||
graphic->GetSolderMaskExpansion(), maxError, ERROR_INSIDE );
|
||||
graphic->GetSolderMaskExpansion(), graphic->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
break;
|
||||
@ -601,7 +595,7 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( aItem );
|
||||
|
||||
text->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, maxError,
|
||||
text->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, text->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
@ -614,11 +608,11 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
if( textbox->IsBorderEnabled() )
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( m_poly_shapes[pcblayer][wxEmptyString],
|
||||
pcblayer, 0, maxError, ERROR_INSIDE );
|
||||
pcblayer, 0, textbox->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
|
||||
// text
|
||||
textbox->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, maxError,
|
||||
textbox->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, textbox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
@ -629,7 +623,7 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
{
|
||||
cell->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, maxError,
|
||||
cell->TransformTextToPolySet( m_poly_shapes[pcblayer][wxEmptyString], 0, cell->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
@ -637,7 +631,7 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( m_poly_shapes[pcblayer][wxEmptyString], maxError,
|
||||
seg.TransformToPolygon( m_poly_shapes[pcblayer][wxEmptyString], table->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
} );
|
||||
|
||||
@ -741,8 +735,6 @@ bool EXPORTER_STEP::buildBoard3DShapes()
|
||||
// min dist must be much smaller (we use 0.001 mm giving good results)
|
||||
m_pcbModel->OCCSetMergeMaxDistance( OCC_MAX_DISTANCE_TO_MERGE_POINTS );
|
||||
|
||||
m_pcbModel->SetMaxError( m_board->GetDesignSettings().m_MaxError );
|
||||
|
||||
// For copper layers, only pads and tracks are added, because adding everything on copper
|
||||
// generate unreasonable file sizes and take a unreasonable calculation time.
|
||||
for( FOOTPRINT* fp : m_board->Footprints() )
|
||||
@ -755,9 +747,7 @@ bool EXPORTER_STEP::buildBoard3DShapes()
|
||||
buildGraphic3DShape( item, origin );
|
||||
|
||||
if( m_params.m_ExportZones )
|
||||
{
|
||||
buildZones3DShape( origin );
|
||||
}
|
||||
|
||||
for( PCB_LAYER_ID pcblayer : m_layersToExport.Seq() )
|
||||
{
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include <decompress.hpp>
|
||||
|
||||
#include <thread_pool.h>
|
||||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_track.h>
|
||||
@ -783,7 +785,6 @@ STEP_PCB_MODEL::STEP_PCB_MODEL( const wxString& aPcbName, REPORTER* aReporter )
|
||||
m_mergeOCCMaxDist = OCC_MAX_DISTANCE_TO_MERGE_POINTS;
|
||||
m_minx = 1.0e10; // absurdly large number; any valid PCB X value will be smaller
|
||||
m_pcbName = aPcbName;
|
||||
m_maxError = pcbIUScale.mmToIU( ARC_TO_SEGMENT_MAX_ERROR_MM );
|
||||
m_fuseShapes = false;
|
||||
m_outFmt = OUTPUT_FORMAT::FMT_OUT_UNKNOWN;
|
||||
}
|
||||
@ -831,7 +832,7 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
|
||||
|
||||
// Make a shape on copper layers
|
||||
SHAPE_POLY_SET polySet;
|
||||
aPad->TransformShapeToPolygon( polySet, pcb_layer, 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
aPad->TransformShapeToPolygon( polySet, pcb_layer, 0, aPad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
if( castellated )
|
||||
{
|
||||
@ -920,14 +921,14 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
|
||||
|
||||
if( seg_hole->GetSeg().A == seg_hole->GetSeg().B ) // Hole is a circle
|
||||
{
|
||||
TransformCircleToPolygon( polyHole, seg_hole->GetSeg().A, width/2, ARC_HIGH_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
TransformCircleToPolygon( polyHole, seg_hole->GetSeg().A, width/2,
|
||||
aPad->GetMaxError(), ERROR_OUTSIDE );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
TransformOvalToPolygon( polyHole, seg_hole->GetSeg().A, seg_hole->GetSeg().B,
|
||||
width, ARC_HIGH_DEF, ERROR_OUTSIDE );
|
||||
width, aPad->GetMaxError(), ERROR_OUTSIDE );
|
||||
}
|
||||
|
||||
polyHole.ClearArcs();
|
||||
|
@ -133,8 +133,6 @@ public:
|
||||
// and can be merged
|
||||
void OCCSetMergeMaxDistance( double aDistance = OCC_MAX_DISTANCE_TO_MERGE_POINTS );
|
||||
|
||||
void SetMaxError( int aMaxError ) { m_maxError = aMaxError; }
|
||||
|
||||
// create the PCB model using the current outlines and drill holes
|
||||
bool CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin, bool aPushBoardBody );
|
||||
|
||||
@ -304,8 +302,6 @@ private:
|
||||
/// Name of the PCB, which will most likely be the file name of the path.
|
||||
wxString m_pcbName;
|
||||
|
||||
int m_maxError;
|
||||
|
||||
/// The current output format for created file
|
||||
OUTPUT_FORMAT m_outFmt;
|
||||
REPORTER* m_reporter;
|
||||
|
@ -3420,10 +3420,7 @@ void FOOTPRINT::CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
|
||||
for( BOARD_ITEM* item : copperItems )
|
||||
{
|
||||
if( item->IsOnLayer( layer ) )
|
||||
{
|
||||
item->TransformShapeToPolygon( copperOutlines, layer, 0, ARC_HIGH_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
}
|
||||
item->TransformShapeToPolygon( copperOutlines, layer, 0, GetMaxError(), ERROR_OUTSIDE );
|
||||
}
|
||||
|
||||
copperOutlines.Simplify();
|
||||
|
@ -646,9 +646,6 @@ void PAD::BuildEffectiveShapes() const
|
||||
|
||||
const SHAPE_COMPOUND& PAD::buildEffectiveShape( PCB_LAYER_ID aLayer ) const
|
||||
{
|
||||
const BOARD* board = GetBoard();
|
||||
int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
|
||||
|
||||
m_effectiveShapes[aLayer] = std::make_shared<SHAPE_COMPOUND>();
|
||||
|
||||
auto add = [this, aLayer]( SHAPE* aShape )
|
||||
@ -767,7 +764,7 @@ const SHAPE_COMPOUND& PAD::buildEffectiveShape( PCB_LAYER_ID aLayer ) const
|
||||
TransformRoundChamferedRectToPolygon( outline, shapePos, GetSize( aLayer ),
|
||||
GetOrientation(), GetRoundRectCornerRadius( aLayer ),
|
||||
GetChamferRectRatio( aLayer ),
|
||||
GetChamferPositions( aLayer ), 0, maxError,
|
||||
GetChamferPositions( aLayer ), 0, GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
add( new SHAPE_SIMPLE( outline.COutline( 0 ) ) );
|
||||
@ -809,9 +806,6 @@ void PAD::BuildEffectivePolygon( ERROR_LOC aErrorLoc ) const
|
||||
if( !m_polyDirty[ aErrorLoc ] )
|
||||
return;
|
||||
|
||||
const BOARD* board = GetBoard();
|
||||
int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
|
||||
|
||||
Padstack().ForEachUniqueLayer(
|
||||
[&]( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
@ -820,7 +814,7 @@ void PAD::BuildEffectivePolygon( ERROR_LOC aErrorLoc ) const
|
||||
m_effectivePolygons[ aLayer ][ aErrorLoc ];
|
||||
|
||||
effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
|
||||
TransformShapeToPolygon( *effectivePolygon, aLayer, 0, maxError, aErrorLoc );
|
||||
TransformShapeToPolygon( *effectivePolygon, aLayer, 0, GetMaxError(), aErrorLoc );
|
||||
|
||||
// Bounding radius
|
||||
|
||||
@ -2377,10 +2371,9 @@ void PAD::doCheckPad( PCB_LAYER_ID aLayer, UNITS_PROVIDER* aUnitsProvider, bool
|
||||
aErrorHandler( DRCE_PADSTACK_INVALID, msg );
|
||||
}
|
||||
|
||||
int maxError = GetBoard()->GetDesignSettings().m_MaxError;
|
||||
SHAPE_POLY_SET padOutline;
|
||||
|
||||
TransformShapeToPolygon( padOutline, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
TransformShapeToPolygon( padOutline, aLayer, 0, GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
if( GetAttribute() == PAD_ATTRIB::PTH )
|
||||
{
|
||||
@ -2388,8 +2381,8 @@ void PAD::doCheckPad( PCB_LAYER_ID aLayer, UNITS_PROVIDER* aUnitsProvider, bool
|
||||
std::shared_ptr<SHAPE_SEGMENT> hole = GetEffectiveHoleShape();
|
||||
SHAPE_POLY_SET holeOutline;
|
||||
|
||||
TransformOvalToPolygon( holeOutline, hole->GetSeg().A, hole->GetSeg().B,
|
||||
hole->GetWidth(), ARC_HIGH_DEF, ERROR_OUTSIDE );
|
||||
TransformOvalToPolygon( holeOutline, hole->GetSeg().A, hole->GetSeg().B, hole->GetWidth(),
|
||||
GetMaxError(), ERROR_OUTSIDE );
|
||||
|
||||
SHAPE_POLY_SET copper = padOutline;
|
||||
copper.BooleanSubtract( holeOutline );
|
||||
@ -2654,9 +2647,6 @@ void PAD::DeletePrimitivesList( PCB_LAYER_ID aLayer )
|
||||
void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon,
|
||||
ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
const BOARD* board = GetBoard();
|
||||
int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
|
||||
|
||||
aMergedPolygon->RemoveAllContours();
|
||||
|
||||
// Add the anchor pad shape in aMergedPolygon, others in aux_polyset:
|
||||
@ -2674,8 +2664,7 @@ void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMerged
|
||||
|
||||
default:
|
||||
case PAD_SHAPE::CIRCLE:
|
||||
TransformCircleToPolygon( *aMergedPolygon, VECTOR2I( 0, 0 ), padSize.x / 2, maxError,
|
||||
aErrorLoc );
|
||||
TransformCircleToPolygon( *aMergedPolygon, VECTOR2I( 0, 0 ), padSize.x / 2, GetMaxError(), aErrorLoc );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2684,7 +2673,7 @@ void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMerged
|
||||
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_padStack.Primitives( aLayer ) )
|
||||
{
|
||||
if( !primitive->IsProxyItem() )
|
||||
primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, maxError, aErrorLoc );
|
||||
primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, GetMaxError(), aErrorLoc );
|
||||
}
|
||||
|
||||
polyset.Simplify();
|
||||
|
@ -780,10 +780,7 @@ std::shared_ptr<SHAPE> PCB_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHI
|
||||
|
||||
int PCB_SHAPE::getMaxError() const
|
||||
{
|
||||
if( const BOARD* board = GetBoard() )
|
||||
return board->GetDesignSettings().m_MaxError;
|
||||
|
||||
return ARC_HIGH_DEF;
|
||||
return GetMaxError();
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,9 +476,9 @@ std::shared_ptr<SHAPE> PCB_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHIN
|
||||
{
|
||||
SHAPE_POLY_SET poly;
|
||||
|
||||
TransformTextToPolySet( poly, 0, GetBoard()->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
TransformTextToPolySet( poly, 0, GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
return std::make_shared<SHAPE_POLY_SET>( poly );
|
||||
return std::make_shared<SHAPE_POLY_SET>( std::move( poly ) );
|
||||
}
|
||||
|
||||
return GetEffectiveTextShape();
|
||||
|
@ -1057,10 +1057,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
|
||||
tmpPoly.Fracture();
|
||||
|
||||
if( margin < 0 )
|
||||
{
|
||||
tmpPoly.Inflate( margin / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
|
||||
m_board->GetDesignSettings().m_MaxError );
|
||||
}
|
||||
tmpPoly.Inflate( margin / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, aShape->GetMaxError() );
|
||||
|
||||
FILL_T fill = isSolidFill ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
|
||||
|
||||
@ -1105,10 +1102,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
|
||||
poly.Append( pt );
|
||||
|
||||
if( margin < 0 )
|
||||
{
|
||||
poly.Inflate( margin / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
|
||||
m_board->GetDesignSettings().m_MaxError );
|
||||
}
|
||||
poly.Inflate( margin / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, aShape->GetMaxError() );
|
||||
|
||||
FILL_T fill_mode = isSolidFill ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
|
||||
|
||||
|
@ -1459,8 +1459,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, BOARD_ITEM* aItem, P
|
||||
|
||||
SHAPE_POLY_SET cornerBuffer;
|
||||
|
||||
aItem->TransformShapeToPolygon( cornerBuffer, aItem->GetLayer(), 0,
|
||||
m_board->GetDesignSettings().m_MaxError, ERROR_OUTSIDE );
|
||||
aItem->TransformShapeToPolygon( cornerBuffer, aItem->GetLayer(), 0, aItem->GetMaxError(), ERROR_OUTSIDE );
|
||||
|
||||
cornerBuffer.Simplify();
|
||||
|
||||
|
@ -487,7 +487,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
||||
TransformRoundChamferedRectToPolygon( cornerBuffer, VECTOR2I( 0, 0 ), psize, ANGLE_0,
|
||||
rradius, aPad->GetChamferRectRatio( ::PADSTACK::ALL_LAYERS ),
|
||||
doChamfer ? aPad->GetChamferPositions( ::PADSTACK::ALL_LAYERS ) : 0,
|
||||
0, aBoard->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||
0, aPad->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
SHAPE_LINE_CHAIN& polygonal_shape = cornerBuffer.Outline( 0 );
|
||||
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include <macros.h>
|
||||
#include <zone.h>
|
||||
|
||||
#include <ranges>
|
||||
|
||||
#include "convert_tool.h"
|
||||
|
||||
|
||||
@ -598,8 +600,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
||||
// rouding errors in the conversion.
|
||||
int chainingEpsilon = 100; // max dist from one endPt to next startPt in IU
|
||||
|
||||
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
|
||||
SHAPE_POLY_SET poly;
|
||||
SHAPE_POLY_SET poly;
|
||||
|
||||
// Stores pairs of (anchor, item) where anchor == 0 -> SEG.A, anchor == 1 -> SEG.B
|
||||
std::map<VECTOR2I, std::vector<std::pair<int, EDA_ITEM*>>> connections;
|
||||
@ -680,27 +681,23 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
||||
|
||||
if( aAnchor == graphic->GetStart() )
|
||||
{
|
||||
for( auto it = graphic->GetBezierPoints().begin();
|
||||
it != graphic->GetBezierPoints().end();
|
||||
++it )
|
||||
for( const VECTOR2I& pt : graphic->GetBezierPoints() )
|
||||
{
|
||||
if( aDirection )
|
||||
outline.Append( *it );
|
||||
outline.Append( pt );
|
||||
else
|
||||
outline.Insert( 0, *it );
|
||||
outline.Insert( 0, pt );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for( auto it = graphic->GetBezierPoints().rbegin();
|
||||
it != graphic->GetBezierPoints().rend();
|
||||
++it )
|
||||
for( const VECTOR2I& pt : std::ranges::reverse_view( graphic->GetBezierPoints() ) )
|
||||
{
|
||||
if( aDirection )
|
||||
outline.Append( *it );
|
||||
outline.Append( pt );
|
||||
else
|
||||
outline.Insert( 0, *it );
|
||||
outline.Insert( 0, pt );
|
||||
}
|
||||
}
|
||||
|
||||
@ -787,10 +784,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
||||
if( aStrategy == BOUNDING_HULL )
|
||||
{
|
||||
for( BOARD_ITEM* item : insertedItems )
|
||||
{
|
||||
item->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE,
|
||||
false );
|
||||
}
|
||||
item->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
|
||||
insertedItems.clear();
|
||||
@ -802,8 +796,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
||||
|
||||
SHAPE_POLY_SET CONVERT_TOOL::makePolysFromOpenGraphics( const std::deque<EDA_ITEM*>& aItems, int aGap )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
|
||||
SHAPE_POLY_SET poly;
|
||||
SHAPE_POLY_SET poly;
|
||||
|
||||
for( EDA_ITEM* item : aItems )
|
||||
{
|
||||
@ -819,8 +812,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromOpenGraphics( const std::deque<EDA_ITE
|
||||
if( shape->IsClosed() )
|
||||
continue;
|
||||
|
||||
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, aGap, bds.m_MaxError, ERROR_INSIDE,
|
||||
false );
|
||||
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, aGap, shape->GetMaxError(), ERROR_INSIDE );
|
||||
shape->SetFlags( SKIP_STRUCT );
|
||||
|
||||
break;
|
||||
@ -832,8 +824,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromOpenGraphics( const std::deque<EDA_ITE
|
||||
{
|
||||
PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
|
||||
|
||||
track->TransformShapeToPolygon( poly, UNDEFINED_LAYER, aGap, bds.m_MaxError, ERROR_INSIDE,
|
||||
false );
|
||||
track->TransformShapeToPolygon( poly, UNDEFINED_LAYER, aGap, track->GetMaxError(), ERROR_INSIDE );
|
||||
track->SetFlags( SKIP_STRUCT );
|
||||
|
||||
break;
|
||||
@ -851,8 +842,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromOpenGraphics( const std::deque<EDA_ITE
|
||||
SHAPE_POLY_SET CONVERT_TOOL::makePolysFromClosedGraphics( const std::deque<EDA_ITEM*>& aItems,
|
||||
CONVERT_STRATEGY aStrategy )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
|
||||
SHAPE_POLY_SET poly;
|
||||
SHAPE_POLY_SET poly;
|
||||
|
||||
for( EDA_ITEM* item : aItems )
|
||||
{
|
||||
@ -883,7 +873,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromClosedGraphics( const std::deque<EDA_I
|
||||
if( aStrategy != BOUNDING_HULL )
|
||||
shape->SetFilled( true );
|
||||
|
||||
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE,
|
||||
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, shape->GetMaxError(), ERROR_INSIDE,
|
||||
aStrategy != BOUNDING_HULL );
|
||||
|
||||
if( aStrategy != BOUNDING_HULL )
|
||||
@ -903,7 +893,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromClosedGraphics( const std::deque<EDA_I
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
text->TransformTextToPolySet( poly, 0, bds.m_MaxError, ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( poly, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
text->SetFlags( SKIP_STRUCT );
|
||||
break;
|
||||
}
|
||||
@ -911,7 +901,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromClosedGraphics( const std::deque<EDA_I
|
||||
case PCB_PAD_T:
|
||||
{
|
||||
PAD* pad = static_cast<PAD*>( item );
|
||||
pad->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE, false );
|
||||
pad->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->SetFlags( SKIP_STRUCT );
|
||||
break;
|
||||
}
|
||||
@ -1023,8 +1013,7 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
||||
for( int i = 1; i < aPoly.VertexCount(); i++ )
|
||||
segs.emplace_back( SEG( aPoly.CVertex( i - 1 ), aPoly.CVertex( i ) ) );
|
||||
|
||||
segs.emplace_back( SEG( aPoly.CVertex( aPoly.VertexCount() - 1 ),
|
||||
aPoly.CVertex( 0 ) ) );
|
||||
segs.emplace_back( SEG( aPoly.CVertex( aPoly.VertexCount() - 1 ), aPoly.CVertex( 0 ) ) );
|
||||
|
||||
return segs;
|
||||
};
|
||||
@ -1185,12 +1174,8 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
BOARD_ITEM* item = aCollector[i];
|
||||
|
||||
if( !( item->Type() == PCB_SHAPE_T ||
|
||||
item->Type() == PCB_TRACE_T ||
|
||||
item->Type() == PCB_ARC_T ) )
|
||||
{
|
||||
if( !item->IsType( { PCB_SHAPE_T, PCB_TRACE_T, PCB_ARC_T } ) )
|
||||
aCollector.Remove( item );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
@ -1300,8 +1285,7 @@ std::optional<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem )
|
||||
if( shape->GetStart() == shape->GetEnd() )
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional<SEG>( VECTOR2I( shape->GetStart() ),
|
||||
VECTOR2I( shape->GetEnd() ) );
|
||||
return std::make_optional<SEG>( VECTOR2I( shape->GetStart() ), VECTOR2I( shape->GetEnd() ) );
|
||||
|
||||
default:
|
||||
return std::nullopt;
|
||||
|
@ -349,7 +349,7 @@ void TRACKS_CLEANER::deleteTracksInPads()
|
||||
if( pad->HitTest( track->GetStart() ) && pad->HitTest( track->GetEnd() ) )
|
||||
{
|
||||
SHAPE_POLY_SET poly;
|
||||
track->TransformShapeToPolygon( poly, track->GetLayer(), 0, ARC_HIGH_DEF,
|
||||
track->TransformShapeToPolygon( poly, track->GetLayer(), 0, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
poly.BooleanSubtract( *pad->GetEffectivePolygon( track->GetLayer(), ERROR_INSIDE ) );
|
||||
|
@ -1337,7 +1337,6 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
||||
}
|
||||
|
||||
const BOARD* board = GetBoard();
|
||||
int maxError = ARC_HIGH_DEF;
|
||||
bool keepExternalFillets = false;
|
||||
bool smooth_requested = m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_CHAMFER
|
||||
|| m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_FILLET;
|
||||
@ -1349,12 +1348,7 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
||||
}
|
||||
|
||||
if( board )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
|
||||
|
||||
maxError = bds.m_MaxError;
|
||||
keepExternalFillets = bds.m_ZoneKeepExternalFillets;
|
||||
}
|
||||
keepExternalFillets = board->GetDesignSettings().m_ZoneKeepExternalFillets;
|
||||
|
||||
auto smooth =
|
||||
[&]( SHAPE_POLY_SET& aPoly )
|
||||
@ -1369,7 +1363,7 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
||||
break;
|
||||
|
||||
case ZONE_SETTINGS::SMOOTHING_FILLET:
|
||||
aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
|
||||
aPoly = aPoly.Fillet( (int) m_cornerRadius, GetMaxError() );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1460,7 +1454,7 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
||||
// pre-inflate the contour by the min-thickness within the same-net-intersecting-zones
|
||||
// envelope.
|
||||
SHAPE_POLY_SET poly = maxExtents->CloneDropTriangulation();
|
||||
poly.Inflate( m_ZoneMinThickness, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
poly.Inflate( m_ZoneMinThickness, CORNER_STRATEGY::ROUND_ALL_CORNERS, GetMaxError() );
|
||||
|
||||
if( !keepExternalFillets )
|
||||
poly.BooleanIntersection( withSameNetIntersectingZones );
|
||||
@ -1507,16 +1501,10 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aBuffer, int aClea
|
||||
// holes are linked to the main outline, so only one polygon is created.
|
||||
if( aClearance )
|
||||
{
|
||||
const BOARD* board = GetBoard();
|
||||
int maxError = ARC_HIGH_DEF;
|
||||
|
||||
if( board )
|
||||
maxError = board->GetDesignSettings().m_MaxError;
|
||||
|
||||
if( aErrorLoc == ERROR_OUTSIDE )
|
||||
aClearance += maxError;
|
||||
aClearance += GetMaxError();
|
||||
|
||||
polybuffer.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
polybuffer.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, GetMaxError() );
|
||||
}
|
||||
|
||||
polybuffer.Fracture();
|
||||
|
@ -201,9 +201,10 @@ ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
|
||||
m_brdOutlinesValid( false ),
|
||||
m_commit( aCommit ),
|
||||
m_progressReporter( nullptr ),
|
||||
m_maxError( ARC_HIGH_DEF ),
|
||||
m_worstClearance( 0 )
|
||||
{
|
||||
m_maxError = aBoard->GetDesignSettings().m_MaxError;
|
||||
|
||||
// To enable add "DebugZoneFiller=1" to kicad_advanced settings file.
|
||||
m_debugZoneFiller = ADVANCED_CFG::GetCfg().m_DebugZoneFiller;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void process( const BOARD_CONNECTED_ITEM* item, int net )
|
||||
|
||||
SHAPE_POLY_SET pset;
|
||||
|
||||
item->TransformShapeToPolygon( pset, UNDEFINED_LAYER, 1, ARC_HIGH_DEF, ERROR_OUTSIDE );
|
||||
item->TransformShapeToPolygon( pset, UNDEFINED_LAYER, 1, item->GetMaxError(), ERROR_OUTSIDE );
|
||||
|
||||
SHAPE_FILE_IO shapeIo; // default = stdout
|
||||
shapeIo.Write( &pset );
|
||||
|
Loading…
x
Reference in New Issue
Block a user