diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 7a855f3453..99cb1b609f 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -1063,18 +1063,39 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map& aProper line->SetWidth( elem.lineWidth ); } + else if( i + 3 == elem.points.size() ) + { + // TODO: special case of a single line with an extra point? + // I haven't a clue what this is all about, but the sample document we have in + // https://gitlab.com/kicad/code/kicad/-/issues/8974 responds best by treating it + // as another single line special case. + LIB_POLYLINE* line = new LIB_POLYLINE( libSymbolIt->second ); + libSymbolIt->second->AddDrawItem( line ); + + line->SetUnit( elem.ownerpartid ); + + for( size_t j = i; j < elem.points.size() && j < i + 2; j++ ) + { + line->AddPoint( GetRelativePosition( elem.points.at( j ) + m_sheetOffset, + symbol ) ); + } + + line->SetWidth( elem.lineWidth ); + } else { - // Bezier always has maximum of 4 control points + // Bezier must have exactly 4 control points LIB_BEZIER* bezier = new LIB_BEZIER( libSymbolIt->second ); libSymbolIt->second->AddDrawItem( bezier ); bezier->SetUnit( elem.ownerpartid ); + std::vector pts; + for( size_t j = i; j < elem.points.size() && j < i + 4; j++ ) { - bezier->AddPoint( GetRelativePosition( elem.points.at( j ) + m_sheetOffset, - symbol ) ); + pts.push_back( GetRelativePosition( elem.points.at( j ) + m_sheetOffset, + symbol ) ); } bezier->SetWidth( elem.lineWidth );