Fixup Altium import rectangle handling
Ensure we have positive sizes Keep rectangles when rotating by multiples of 90
This commit is contained in:
parent
234230801f
commit
d033f93d89
|
@ -4457,10 +4457,21 @@ void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
|
||||||
padLayers.set( aLayer );
|
padLayers.set( aLayer );
|
||||||
|
|
||||||
pad->SetAttribute( PAD_ATTRIB::SMD );
|
pad->SetAttribute( PAD_ATTRIB::SMD );
|
||||||
if( aElem.rotation == 0. )
|
EDA_ANGLE rotation( aElem.rotation, DEGREES_T );
|
||||||
|
|
||||||
|
// Handle rotation multiples of 90 degrees
|
||||||
|
if( rotation.IsCardinal() )
|
||||||
{
|
{
|
||||||
pad->SetShape( PAD_SHAPE::RECTANGLE );
|
pad->SetShape( PAD_SHAPE::RECTANGLE );
|
||||||
pad->SetSize( { aElem.pos2.x - aElem.pos1.x, aElem.pos2.y - aElem.pos1.y } );
|
|
||||||
|
int width = std::abs( aElem.pos2.x - aElem.pos1.x );
|
||||||
|
int height = std::abs( aElem.pos2.y - aElem.pos1.y );
|
||||||
|
|
||||||
|
// Swap width and height for 90 or 270 degree rotations
|
||||||
|
if( rotation.IsCardinal90() )
|
||||||
|
std::swap( width, height );
|
||||||
|
|
||||||
|
pad->SetSize( { width, height } );
|
||||||
pad->SetPosition( ( aElem.pos1 + aElem.pos2 ) / 2 );
|
pad->SetPosition( ( aElem.pos1 + aElem.pos2 ) / 2 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4508,7 +4519,6 @@ void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
|
||||||
|
|
||||||
if( aElem.rotation != 0. )
|
if( aElem.rotation != 0. )
|
||||||
{
|
{
|
||||||
// TODO: Do we need SHAPE_T::POLY for non 90° rotations?
|
|
||||||
VECTOR2I center( aElem.pos1.x / 2 + aElem.pos2.x / 2,
|
VECTOR2I center( aElem.pos1.x / 2 + aElem.pos2.x / 2,
|
||||||
aElem.pos1.y / 2 + aElem.pos2.y / 2 );
|
aElem.pos1.y / 2 + aElem.pos2.y / 2 );
|
||||||
fill->Rotate( center, EDA_ANGLE( aElem.rotation, DEGREES_T ) );
|
fill->Rotate( center, EDA_ANGLE( aElem.rotation, DEGREES_T ) );
|
||||||
|
|
Loading…
Reference in New Issue