Eeschema, legacy *lib files: fix issues with 180 deg arcs.

180 deg arcs are a limit, so when importing them convert them to slightly
smaller arc (arc angle = 179.5 deg)
Fixes #10455
https://gitlab.com/kicad/code/kicad/issues/10455
This commit is contained in:
jean-pierre charras 2022-02-10 12:43:14 +01:00
parent 261b1df47f
commit b9843a23eb
1 changed files with 18 additions and 0 deletions

View File

@ -808,6 +808,24 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
arc->SetEnd( temp ); arc->SetEnd( temp );
} }
/*
* Current file format stores start-mid-end and so doesn't care about winding. We
* store start-end with an implied winding internally though.
* This issue is only for 180 deg arcs, because 180 deg are a limit to handle arcs in
* legacy libs.
*
* So a workaround is to slightly change the arc angle to
* avoid 180 deg arc after correction
*/
EDA_ANGLE arc_angle = arc->GetArcAngle();
if( arc_angle == ANGLE_180 )
{
VECTOR2I new_center = CalcArcCenter( arc->GetStart(), arc->GetEnd(),
EDA_ANGLE( 179.5, DEGREES_T ) );
arc->SetCenter( new_center );
}
return arc; return arc;
} }