Altium PCB import: import holes in non-Cu polygons.
This commit is contained in:
parent
eb6cd4cc5d
commit
ef66fe88ac
|
@ -1059,6 +1059,9 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
||||||
|
|
||||||
uint32_t num_outline_vertices = aReader.Read<uint32_t>();
|
uint32_t num_outline_vertices = aReader.Read<uint32_t>();
|
||||||
|
|
||||||
|
if( aExtendedVertices )
|
||||||
|
num_outline_vertices++; // Has a closing vertex
|
||||||
|
|
||||||
for( uint32_t i = 0; i < num_outline_vertices; i++ )
|
for( uint32_t i = 0; i < num_outline_vertices; i++ )
|
||||||
{
|
{
|
||||||
if( aExtendedVertices )
|
if( aExtendedVertices )
|
||||||
|
@ -1080,21 +1083,17 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for now we only support holes in regions where there are stored as double
|
holes.resize( holecount );
|
||||||
if( !aExtendedVertices )
|
for( uint16_t k = 0; k < holecount; k++ )
|
||||||
{
|
{
|
||||||
holes.resize( holecount );
|
uint32_t num_hole_vertices = aReader.Read<uint32_t>();
|
||||||
for( uint16_t k = 0; k < holecount; k++ )
|
holes.at( k ).reserve( num_hole_vertices );
|
||||||
{
|
|
||||||
uint32_t num_hole_vertices = aReader.Read<uint32_t>();
|
|
||||||
holes.at( k ).reserve( num_hole_vertices );
|
|
||||||
|
|
||||||
for( uint32_t i = 0; i < num_hole_vertices; i++ )
|
for( uint32_t i = 0; i < num_hole_vertices; i++ )
|
||||||
{
|
{
|
||||||
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
||||||
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
||||||
holes.at( k ).emplace_back( VECTOR2I( x, y ) );
|
holes.at( k ).emplace_back( VECTOR2I( x, y ) );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1993,9 +1993,23 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItemOnLayer( const AREGION6& aE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHAPE_POLY_SET polySet;
|
||||||
|
polySet.AddOutline( linechain );
|
||||||
|
|
||||||
|
for( const std::vector<ALTIUM_VERTICE>& hole : aElem.holes )
|
||||||
|
{
|
||||||
|
SHAPE_LINE_CHAIN hole_linechain;
|
||||||
|
HelperShapeLineChainFromAltiumVertices( hole_linechain, hole );
|
||||||
|
|
||||||
|
if( hole_linechain.PointCount() < 3 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
polySet.AddHole( hole_linechain );
|
||||||
|
}
|
||||||
|
|
||||||
PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::POLY );
|
PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::POLY );
|
||||||
|
|
||||||
shape->SetPolyShape( linechain );
|
shape->SetPolyShape( polySet );
|
||||||
shape->SetFilled( true );
|
shape->SetFilled( true );
|
||||||
shape->SetLayer( aLayer );
|
shape->SetLayer( aLayer );
|
||||||
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
||||||
|
|
Loading…
Reference in New Issue