EasyEDA Std: import dimensions.
This commit is contained in:
parent
743e9d669a
commit
e636913178
|
@ -108,11 +108,8 @@ std::vector<SHAPE_LINE_CHAIN> EASYEDA_PARSER_BASE::ParseLineChains( const wxStri
|
|||
readNumber( xStr );
|
||||
readNumber( yStr );
|
||||
|
||||
if( chain.PointCount() > 2 )
|
||||
{
|
||||
chain.SetClosed( true );
|
||||
if( chain.PointCount() > 1 )
|
||||
result.emplace_back( chain );
|
||||
}
|
||||
|
||||
chain.Clear();
|
||||
|
||||
|
@ -130,8 +127,13 @@ std::vector<SHAPE_LINE_CHAIN> EASYEDA_PARSER_BASE::ParseLineChains( const wxStri
|
|||
}
|
||||
chain.Clear();
|
||||
}
|
||||
else if( sym == 'L' )
|
||||
else if( sym == 'L' || isdigit( sym ) || sym == '-' )
|
||||
{
|
||||
// We may not have a command, just coordinates:
|
||||
// M 4108.8 3364.1 3982.598 3295.6914
|
||||
if( isdigit( sym ) || sym == '-' )
|
||||
pos--;
|
||||
|
||||
while( true )
|
||||
{
|
||||
if( pos >= data.size() )
|
||||
|
@ -147,7 +149,7 @@ std::vector<SHAPE_LINE_CHAIN> EASYEDA_PARSER_BASE::ParseLineChains( const wxStri
|
|||
ch = data[pos];
|
||||
}
|
||||
|
||||
if( !isdigit( ch ) )
|
||||
if( !isdigit( ch ) && ch != '-' )
|
||||
break;
|
||||
|
||||
wxString xStr, yStr;
|
||||
|
@ -226,10 +228,8 @@ std::vector<SHAPE_LINE_CHAIN> EASYEDA_PARSER_BASE::ParseLineChains( const wxStri
|
|||
}
|
||||
} while( pos < data.size() );
|
||||
|
||||
if( chain.PointCount() > 2 )
|
||||
{
|
||||
if( chain.PointCount() > 1 )
|
||||
result.emplace_back( chain );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -430,6 +430,41 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
|
|||
|
||||
aContainer->Add( shape.release(), ADD_MODE::APPEND );
|
||||
}
|
||||
else if( elType == wxS( "DIMENSION" ) )
|
||||
{
|
||||
PCB_LAYER_ID layer = LayerToKi( arr[1] );
|
||||
double lineWidth = ConvertSize( arr[7] );
|
||||
wxString shapeData = arr[2].Trim();
|
||||
//double textHeight = !arr[4].IsEmpty() ? ConvertSize( arr[4] ) : 0;
|
||||
|
||||
std::vector<SHAPE_LINE_CHAIN> lineChains =
|
||||
ParseLineChains( shapeData, pcbIUScale.mmToIU( 0.01 ) );
|
||||
|
||||
std::unique_ptr<PCB_GROUP> group = std::make_unique<PCB_GROUP>( aContainer );
|
||||
group->SetName( wxS( "Dimension" ) );
|
||||
|
||||
for( const SHAPE_LINE_CHAIN& chain : lineChains )
|
||||
{
|
||||
for( int segId = 0; segId < chain.SegmentCount(); segId++ )
|
||||
{
|
||||
SEG seg = chain.CSegment( segId );
|
||||
|
||||
std::unique_ptr<PCB_SHAPE> shape =
|
||||
std::make_unique<PCB_SHAPE>( aContainer, SHAPE_T::SEGMENT );
|
||||
|
||||
shape->SetLayer( layer );
|
||||
shape->SetWidth( lineWidth );
|
||||
shape->SetStart( seg.A );
|
||||
shape->SetEnd( seg.B );
|
||||
|
||||
group->AddItem( shape.get() );
|
||||
|
||||
aContainer->Add( shape.release(), ADD_MODE::APPEND );
|
||||
}
|
||||
}
|
||||
|
||||
aContainer->Add( group.release(), ADD_MODE::APPEND );
|
||||
}
|
||||
else if( elType == wxS( "SOLIDREGION" ) )
|
||||
{
|
||||
wxString layer = arr[1];
|
||||
|
|
Loading…
Reference in New Issue