Altium PCB import: support dashed outlines (Region kind 2)
(cherry picked from commit 430da67222
)
This commit is contained in:
parent
4918ac6307
commit
2eb6ca75a8
|
@ -1050,7 +1050,7 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
|||
kind = ALTIUM_REGION_KIND::POLYGON_CUTOUT;
|
||||
break;
|
||||
case 2:
|
||||
kind = ALTIUM_REGION_KIND::UNKNOWN_2; // TODO: what kind is this?
|
||||
kind = ALTIUM_REGION_KIND::DASHED_OUTLINE;
|
||||
break;
|
||||
case 3:
|
||||
kind = ALTIUM_REGION_KIND::UNKNOWN_3; // TODO: what kind is this?
|
||||
|
|
|
@ -88,7 +88,7 @@ enum class ALTIUM_REGION_KIND
|
|||
|
||||
COPPER = 0, // KIND=0
|
||||
POLYGON_CUTOUT = 1, // KIND=1
|
||||
UNKNOWN_2 = 2, // KIND=2
|
||||
DASHED_OUTLINE = 2, // KIND=2
|
||||
UNKNOWN_3 = 3, // KIND=3
|
||||
CAVITY_DEFINITION = 4, // KIND=4
|
||||
BOARD_CUTOUT = 5, // KIND=0 AND ISBOARDCUTOUT=TRUE
|
||||
|
|
|
@ -2000,6 +2000,36 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
|
|||
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
|
||||
ZONE::GetDefaultHatchPitch(), true );
|
||||
}
|
||||
else if( aElem.kind == ALTIUM_REGION_KIND::DASHED_OUTLINE )
|
||||
{
|
||||
PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer );
|
||||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
SHAPE_LINE_CHAIN linechain;
|
||||
HelperShapeLineChainFromAltiumVertices( linechain, aElem.outline );
|
||||
|
||||
if( linechain.PointCount() < 3 )
|
||||
{
|
||||
// We have found multiple Altium files with polygon records containing nothing but
|
||||
// two coincident vertices. These polygons do not appear when opening the file in
|
||||
// Altium. https://gitlab.com/kicad/code/kicad/-/issues/8183
|
||||
// Also, polygons with less than 3 points are not supported in KiCad.
|
||||
return;
|
||||
}
|
||||
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::POLY );
|
||||
|
||||
shape->SetPolyShape( linechain );
|
||||
shape->SetFilled( false );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetStroke( STROKE_PARAMS( pcbIUScale.mmToIU( 0.1 ), PLOT_DASH_TYPE::DASH ) );
|
||||
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
}
|
||||
else if( aElem.kind == ALTIUM_REGION_KIND::COPPER )
|
||||
{
|
||||
if( aElem.subpolyindex == ALTIUM_POLYGON_NONE )
|
||||
|
@ -2059,6 +2089,37 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
|
|||
aPrimitiveIndex );
|
||||
}
|
||||
}
|
||||
else if( aElem.kind == ALTIUM_REGION_KIND::DASHED_OUTLINE )
|
||||
{
|
||||
PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer );
|
||||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
SHAPE_LINE_CHAIN linechain;
|
||||
HelperShapeLineChainFromAltiumVertices( linechain, aElem.outline );
|
||||
|
||||
if( linechain.PointCount() < 3 )
|
||||
{
|
||||
// We have found multiple Altium files with polygon records containing nothing but
|
||||
// two coincident vertices. These polygons do not appear when opening the file in
|
||||
// Altium. https://gitlab.com/kicad/code/kicad/-/issues/8183
|
||||
// Also, polygons with less than 3 points are not supported in KiCad.
|
||||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* shape = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
shape->SetPolyShape( linechain );
|
||||
shape->SetFilled( false );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetStroke( STROKE_PARAMS( pcbIUScale.mmToIU( 0.1 ), PLOT_DASH_TYPE::DASH ) );
|
||||
|
||||
HelperShapeSetLocalCoord( shape );
|
||||
aFootprint->Add( shape, ADD_MODE::APPEND );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Ignored polygon shape of kind %d (not yet supported)." ), aElem.kind );
|
||||
|
|
Loading…
Reference in New Issue