Fixes for rectangle segments in STEP plugin.

This commit is contained in:
Jeff Young 2020-08-17 18:30:35 +01:00 committed by Seth Hillbrand
parent 96f4e8f6f8
commit 3b9c47a1be
2 changed files with 42 additions and 0 deletions

View File

@ -226,6 +226,8 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data )
result = result && parseCurve( child, CURVE_ARC );
else if( symname == "gr_line" )
result = result && parseCurve( child, CURVE_LINE );
else if( symname == "gr_rect" )
result = result && parseRect( child );
else if( symname == "gr_circle" )
result = result && parseCurve( child, CURVE_CIRCLE );
}
@ -377,6 +379,45 @@ bool KICADPCB::parseModule( SEXPR::SEXPR* data )
}
bool KICADPCB::parseRect( SEXPR::SEXPR* data )
{
KICADCURVE* mp = new KICADCURVE();
if( !mp->Read( data, CURVE_LINE ) )
{
delete mp;
return false;
}
// reject any curves not on the Edge.Cuts layer
if( mp->GetLayer() != LAYER_EDGE )
{
delete mp;
return true;
}
KICADCURVE* top( mp );
KICADCURVE* right( mp );
KICADCURVE* bottom( mp );
KICADCURVE* left( mp );
delete mp;
top->m_end.y = top->m_start.y;
m_curves.push_back( top );
right->m_start.x = right->m_end.x;
m_curves.push_back( right );
bottom->m_start.y = bottom->m_end.y;
m_curves.push_back( bottom );
left->m_end.x = left->m_start.x;
m_curves.push_back( left );
return true;
}
bool KICADPCB::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType )
{
KICADCURVE* mp = new KICADCURVE();

View File

@ -80,6 +80,7 @@ private:
bool parseLayers( SEXPR::SEXPR* data );
bool parseModule( SEXPR::SEXPR* data );
bool parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType );
bool parseRect( SEXPR::SEXPR* data );
public:
KICADPCB();