EasyEDA Std import: support multiple consecutive arc parameter sets.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21238

(cherry picked from commit 90f5cbf0034a1f08a40836259bd3e2f65a59e193)
This commit is contained in:
Alex Shvartzkop 2025-07-02 18:03:24 +03:00
parent adf8d6626f
commit be9ce460f8

View File

@ -211,6 +211,25 @@ EASYEDA_PARSER_BASE::ParseLineChains( const wxString& data, int aMaxError, bool
}
else if( sym == 'A' )
{
// Arc command can have multiple consecutive arc parameter sets
while( true )
{
if( pos >= data.size() )
break;
wxUniChar ch = data[pos];
while( ch == ' ' || ch == ',' )
{
if( ++pos >= data.size() )
break;
ch = data[pos];
}
if( !isdigit( ch ) && ch != '-' )
break;
wxString radX, radY, unknown, farFlag, cwFlag, endX, endY;
readNumber( radX );
@ -236,17 +255,16 @@ EASYEDA_PARSER_BASE::ParseLineChains( const wxString& data, int aMaxError, bool
//( far && cw ) => -h
//( !far && !cw ) => -h
//( far && !cw ) => h
VECTOR2D arcCenter =
start + delta / 2 + delta.Perpendicular().Resize( ( isFar ^ cw ) ? h : -h );
VECTOR2D arcCenter = start + delta / 2 + delta.Perpendicular().Resize( ( isFar ^ cw ) ? h : -h );
SHAPE_ARC arc;
arc.ConstructFromStartEndCenter( RelPos( start ), RelPos( end ), RelPos( arcCenter ),
!cw );
arc.ConstructFromStartEndCenter( RelPos( start ), RelPos( end ), RelPos( arcCenter ), !cw );
chain.Append( arc, aMaxError );
prevPt = end;
}
}
else if( sym == 'C' )
{
wxString p1_xStr, p1_yStr, p2_xStr, p2_yStr, p3_xStr, p3_yStr;