eagle: add support for tRestrict, bRestrict and vRestrict on rectangles
Fixes #2451 https://gitlab.com/kicad/code/kicad/-/issues/2451
This commit is contained in:
parent
33a840085d
commit
54decd8afb
|
@ -1739,7 +1739,48 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
|
void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
{
|
{
|
||||||
ERECT r( aTree );
|
ERECT r( aTree );
|
||||||
|
|
||||||
|
if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT
|
||||||
|
|| r.layer == EAGLE_LAYER::VRESTRICT )
|
||||||
|
{
|
||||||
|
MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule );
|
||||||
|
aModule->Add( zone, ADD_MODE::APPEND );
|
||||||
|
|
||||||
|
if( r.layer == EAGLE_LAYER::TRESTRICT ) // front layer keepout
|
||||||
|
zone->SetLayer( F_Cu );
|
||||||
|
else if( r.layer == EAGLE_LAYER::BRESTRICT ) // bottom layer keepout
|
||||||
|
zone->SetLayer( B_Cu );
|
||||||
|
else if( r.layer == EAGLE_LAYER::VRESTRICT ) // all layers
|
||||||
|
zone->SetLayerSet( LSET::AllCuMask() );
|
||||||
|
|
||||||
|
zone->SetIsKeepout( true );
|
||||||
|
zone->SetDoNotAllowVias( true );
|
||||||
|
if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT )
|
||||||
|
{
|
||||||
|
zone->SetDoNotAllowTracks( true );
|
||||||
|
zone->SetDoNotAllowCopperPour( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
const int outlineIdx = -1; // this is the id of the copper zone main outline
|
||||||
|
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
|
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
|
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
|
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
|
|
||||||
|
if( r.rot )
|
||||||
|
{
|
||||||
|
wxPoint center( ( kicad_x( r.x1 ) + kicad_x( r.x2 ) ) / 2,
|
||||||
|
( kicad_y( r.y1 ) + kicad_y( r.y2 ) ) / 2 );
|
||||||
|
zone->Rotate( center, r.rot->degrees * 10 );
|
||||||
|
}
|
||||||
|
|
||||||
|
zone->SetHatch(
|
||||||
|
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
PCB_LAYER_ID layer = kicad_layer( r.layer );
|
PCB_LAYER_ID layer = kicad_layer( r.layer );
|
||||||
|
|
||||||
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
|
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
|
||||||
|
|
||||||
aModule->Add( dwg );
|
aModule->Add( dwg );
|
||||||
|
@ -1765,6 +1806,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
if( r.rot )
|
if( r.rot )
|
||||||
dwg->Rotate( dwg->GetCenter(), r.rot->degrees * 10 );
|
dwg->Rotate( dwg->GetCenter(), r.rot->degrees * 10 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
|
void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
|
|
Loading…
Reference in New Issue