altium: handle keepout tracks/arcs on multiple layers

This commit is contained in:
Thomas Pointhuber 2020-10-20 10:35:58 +02:00
parent 7642bbc090
commit f06f4e7a13
1 changed files with 53 additions and 17 deletions

View File

@ -1500,14 +1500,6 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Arc on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
if( elem.is_keepout || IsAltiumLayerAPlane( elem.layer ) )
{
PCB_SHAPE shape( nullptr ); // just a helper to get the graphic
@ -1533,7 +1525,6 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
m_board->Add( zone, ADD_MODE::APPEND );
zone->SetLayer( klayer );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
@ -1541,6 +1532,24 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
zone->SetDoNotAllowFootprints( false );
zone->SetDoNotAllowCopperPour( true );
if( elem.layer == ALTIUM_LAYER::MULTI_LAYER )
{
zone->SetLayer( F_Cu );
zone->SetLayerSet( LSET::AllCuMask() );
}
else
{
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Arc Keepout on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
zone->SetLayer( klayer );
}
shape.TransformShapeWithClearanceToPolygon( *zone->Outline(), klayer, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
zone->Outline()->Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); // the outline is not a single polygon!
@ -1550,6 +1559,14 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
continue;
}
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Arc on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
if( klayer >= F_Cu && klayer <= B_Cu )
{
double angle = -NormalizeAngleDegreesPos( elem.endangle - elem.startangle );
@ -2068,13 +2085,6 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
// continue;
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Track on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
if( elem.is_keepout || IsAltiumLayerAPlane( elem.layer ) )
{
@ -2086,7 +2096,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
m_board->Add( zone, ADD_MODE::APPEND );
zone->SetLayer( klayer );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
@ -2094,6 +2104,24 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
zone->SetDoNotAllowFootprints( false );
zone->SetDoNotAllowCopperPour( true );
if( elem.layer == ALTIUM_LAYER::MULTI_LAYER )
{
zone->SetLayer( F_Cu );
zone->SetLayerSet( LSET::AllCuMask() );
}
else
{
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Track Keepout on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
zone->SetLayer( klayer );
}
shape.TransformShapeWithClearanceToPolygon( *zone->Outline(), klayer, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
@ -2102,6 +2130,14 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
continue;
}
if( klayer == UNDEFINED_LAYER )
{
wxLogWarning( wxString::Format(
_( "Track on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ),
elem.layer ) );
klayer = Eco1_User;
}
if( klayer >= F_Cu && klayer <= B_Cu )
{
TRACK* track = new TRACK( m_board );