Handle rect and bezier in footprint exports
Teach kicad2step about footprint edgecuts that use fp_curve and fp_rect Fixes https://gitlab.com/kicad/code/kicad/issues/65054
This commit is contained in:
parent
980a8cfb39
commit
d1f782717e
|
@ -133,6 +133,10 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
|
|||
result = result && parseCurve( child, CURVE_LINE );
|
||||
else if( symname == "fp_circle" )
|
||||
result = result && parseCurve( child, CURVE_CIRCLE );
|
||||
else if( symname == "fp_rect" )
|
||||
result = result && parseRect( child );
|
||||
else if( symname == "fp_curve" )
|
||||
result = result && parseCurve( child, CURVE_BEZIER );
|
||||
else if( symname == "pad" )
|
||||
result = result && parsePad( child );
|
||||
else if( symname == "model" )
|
||||
|
@ -150,6 +154,38 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
|
|||
}
|
||||
|
||||
|
||||
bool KICADFOOTPRINT::parseRect( SEXPR::SEXPR* data )
|
||||
{
|
||||
std::unique_ptr<KICADCURVE> rect;
|
||||
|
||||
if( !rect->Read( data, CURVE_LINE ) )
|
||||
return false;
|
||||
|
||||
// reject any curves not on the Edge.Cuts layer
|
||||
if( rect->GetLayer() != LAYER_EDGE )
|
||||
return true;
|
||||
|
||||
KICADCURVE* top = new KICADCURVE( *rect );
|
||||
KICADCURVE* right = new KICADCURVE( *rect );
|
||||
KICADCURVE* bottom = new KICADCURVE( *rect );
|
||||
KICADCURVE* left = new KICADCURVE( *rect );
|
||||
|
||||
top->m_end.y = right->m_start.y;
|
||||
m_curves.push_back( top );
|
||||
|
||||
right->m_start.x = bottom->m_end.x;
|
||||
m_curves.push_back( right );
|
||||
|
||||
bottom->m_start.y = left->m_end.y;
|
||||
m_curves.push_back( bottom );
|
||||
|
||||
left->m_end.x = top->m_start.x;
|
||||
m_curves.push_back( left );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool KICADFOOTPRINT::parseModel( SEXPR::SEXPR* data )
|
||||
{
|
||||
KICADMODEL* mp = new KICADMODEL();
|
||||
|
|
|
@ -51,6 +51,7 @@ private:
|
|||
bool parseAttribute( SEXPR::SEXPR* data );
|
||||
bool parseText( SEXPR::SEXPR* data );
|
||||
bool parsePad( SEXPR::SEXPR* data );
|
||||
bool parseRect( SEXPR::SEXPR* data );
|
||||
|
||||
KICADPCB* m_parent; // The parent KICADPCB, to know layer names
|
||||
|
||||
|
|
Loading…
Reference in New Issue