7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 08:21:39 +00:00

Eeschema: fix incorrect 180 deg arcs of some old symbol libraries

Some libs (2021 versions) encoded an arc with start, end, center points,
start, end angles. Since the Y axis was reversed in symbol editor,
180 deg arcs were not correctly converted.
This is now fixed.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19970
This commit is contained in:
jean-pierre charras 2025-02-18 11:59:57 +01:00
parent 6a0cd5cd22
commit cbccf6f027

View File

@ -1321,7 +1321,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolArc()
arc->CalcArcAngles( arc_start, arc_end );
arc_angle = arc_end - arc_start;
// The arc angle should be <= 180 deg.
// The arc angle should be <= 180 deg in old libraries.
// If > 180 we need to swap arc ends (the first choice was not good)
if( arc_angle > ANGLE_180 )
{
@ -1330,11 +1330,17 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolArc()
}
else if( arc_angle == ANGLE_180 )
{
arc->SetStart( startPoint );
arc->SetEnd( endPoint );
// Disabled (since the Y axis was reversed in library editor
// and arcs having a 180 deg arc do not create issues
// However keep it for info, just in case
#if 0
arc->SetStart( startPoint ); // not working with Y axis reversed
arc->SetEnd( endPoint ); // not working with Y axis reversed
// Useless now arcs >= 180 deg are well handled
VECTOR2I new_center = CalcArcCenter( arc->GetStart(), arc->GetEnd(),
EDA_ANGLE( 179.5, DEGREES_T ) );
arc->SetCenter( new_center );
#endif
}
}
else