Fix previous fix for honouring pad offset.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15494
(cherry picked from commit e0cf49e73c
)
This commit is contained in:
parent
12e0427038
commit
d11cd173dc
|
@ -719,8 +719,13 @@ PCB_LAYER_ID PAD_TOOL::explodePad( PAD* aPad )
|
||||||
}
|
}
|
||||||
|
|
||||||
shape->SetLocalCoord();
|
shape->SetLocalCoord();
|
||||||
|
|
||||||
|
if( shape->GetShape() != SHAPE_T::POLY ) // Poly's are board-relative
|
||||||
|
{
|
||||||
shape->Move( aPad->GetPosition() );
|
shape->Move( aPad->GetPosition() );
|
||||||
shape->Rotate( aPad->GetPosition(), aPad->GetOrientation() );
|
shape->Rotate( aPad->GetPosition(), aPad->GetOrientation() );
|
||||||
|
}
|
||||||
|
|
||||||
shape->SetLayer( layer );
|
shape->SetLayer( layer );
|
||||||
|
|
||||||
commit.Add( shape );
|
commit.Add( shape );
|
||||||
|
@ -812,33 +817,21 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
else
|
else
|
||||||
layer = *aPad->GetLayerSet().UIOrder();
|
layer = *aPad->GetLayerSet().UIOrder();
|
||||||
|
|
||||||
while( FP_SHAPE* fpShape = findNext( layer ) )
|
// If there are intersecting items to combine, we need to first make sure the pad is a
|
||||||
{
|
// custom-shape pad.
|
||||||
// We've found an intersecting item to combine.
|
if( !aIsDryRun && findNext( layer ) && aPad->GetShape() != PAD_SHAPE::CUSTOM )
|
||||||
//
|
|
||||||
fpShape->SetFlags( SKIP_STRUCT );
|
|
||||||
|
|
||||||
// First convert the pad to a custom-shape pad (if it isn't already)
|
|
||||||
//
|
|
||||||
if( !aIsDryRun )
|
|
||||||
{
|
{
|
||||||
aCommit.Modify( aPad );
|
aCommit.Modify( aPad );
|
||||||
|
|
||||||
if( aPad->GetShape() == PAD_SHAPE::RECT || aPad->GetShape() == PAD_SHAPE::CIRCLE )
|
|
||||||
{
|
|
||||||
aPad->SetAnchorPadShape( aPad->GetShape() );
|
|
||||||
}
|
|
||||||
else if( aPad->GetShape() != PAD_SHAPE::CUSTOM )
|
|
||||||
{
|
|
||||||
// Create a new minimally-sized circular anchor and convert existing pad
|
// Create a new minimally-sized circular anchor and convert existing pad
|
||||||
// to a polygon primitive
|
// to a polygon primitive
|
||||||
SHAPE_POLY_SET existingOutline;
|
SHAPE_POLY_SET existingOutline;
|
||||||
aPad->TransformShapeToPolygon( existingOutline, layer, 0, maxError, ERROR_INSIDE );
|
aPad->TransformShapeToPolygon( existingOutline, layer, 0, maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
|
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
|
||||||
|
// We're going to remove the offset, so shrink the anchor pad so that it's
|
||||||
if( aPad->GetSizeX() > aPad->GetSizeY() )
|
// entirely inside the hole (since it won't be offset anymore)
|
||||||
aPad->SetSizeX( aPad->GetSizeY() );
|
aPad->SetSize( aPad->GetDrillSize() );
|
||||||
|
|
||||||
PCB_SHAPE* shape = new PCB_SHAPE( nullptr, SHAPE_T::POLY );
|
PCB_SHAPE* shape = new PCB_SHAPE( nullptr, SHAPE_T::POLY );
|
||||||
shape->SetFilled( true );
|
shape->SetFilled( true );
|
||||||
|
@ -848,13 +841,14 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
shape->Rotate( VECTOR2I( 0, 0 ), - aPad->GetOrientation() );
|
shape->Rotate( VECTOR2I( 0, 0 ), - aPad->GetOrientation() );
|
||||||
|
|
||||||
aPad->AddPrimitive( shape );
|
aPad->AddPrimitive( shape );
|
||||||
}
|
|
||||||
|
|
||||||
aPad->SetShape( PAD_SHAPE::CUSTOM );
|
aPad->SetShape( PAD_SHAPE::CUSTOM );
|
||||||
|
aPad->SetOffset( VECTOR2I( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now add the new shape to the primitives list
|
while( FP_SHAPE* fpShape = findNext( layer ) )
|
||||||
//
|
{
|
||||||
|
fpShape->SetFlags( SKIP_STRUCT );
|
||||||
|
|
||||||
mergedShapes.push_back( fpShape );
|
mergedShapes.push_back( fpShape );
|
||||||
|
|
||||||
if( !aIsDryRun )
|
if( !aIsDryRun )
|
||||||
|
@ -889,15 +883,18 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
pcbShape->SetPolyShape( fpShape->GetPolyShape() );
|
pcbShape->SetPolyShape( fpShape->GetPolyShape() );
|
||||||
pcbShape->Move( VECTOR2I( 0, 0 ) - aPad->GetOffset() );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_FOR( pcbShape->SHAPE_T_asString() );
|
UNIMPLEMENTED_FOR( pcbShape->SHAPE_T_asString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( pcbShape->GetShape() != SHAPE_T::POLY ) // Poly's are board-relative
|
||||||
|
{
|
||||||
pcbShape->Move( - aPad->GetPosition() );
|
pcbShape->Move( - aPad->GetPosition() );
|
||||||
pcbShape->Rotate( VECTOR2I( 0, 0 ), - aPad->GetOrientation() );
|
pcbShape->Rotate( VECTOR2I( 0, 0 ), - aPad->GetOrientation() );
|
||||||
|
}
|
||||||
|
|
||||||
pcbShape->SetIsAnnotationProxy( fpShape->IsAnnotationProxy());
|
pcbShape->SetIsAnnotationProxy( fpShape->IsAnnotationProxy());
|
||||||
aPad->AddPrimitive( pcbShape );
|
aPad->AddPrimitive( pcbShape );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue