diff --git a/utils/kicad2step/pcb/kicadpcb.cpp b/utils/kicad2step/pcb/kicadpcb.cpp index 5df924dd01..de0144d66f 100644 --- a/utils/kicad2step/pcb/kicadpcb.cpp +++ b/utils/kicad2step/pcb/kicadpcb.cpp @@ -480,11 +480,18 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual ) continue; // adjust the coordinate system + // Note: we negate the Y coordinates due to the fact in Pcbnew the Y axis + // is from top to bottom. KICADCURVE lcurve = *i; lcurve.m_start.y = -( lcurve.m_start.y - origin.y ); lcurve.m_end.y = -( lcurve.m_end.y - origin.y ); lcurve.m_start.x -= origin.x; lcurve.m_end.x -= origin.x; + // used in bezier curves: + lcurve.m_bezierctrl1.y = -( lcurve.m_bezierctrl1.y - origin.y ); + lcurve.m_bezierctrl1.x -= origin.x; + lcurve.m_bezierctrl2.y = -( lcurve.m_bezierctrl2.y - origin.y ); + lcurve.m_bezierctrl2.x -= origin.x; if( CURVE_ARC == lcurve.m_form ) lcurve.m_angle = -lcurve.m_angle; diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 4b0c2411b9..8ffc6f3617 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -80,6 +80,7 @@ #include #include #include +#include static constexpr double USER_PREC = 1e-4; static constexpr double USER_ANGLE_PREC = 1e-6; @@ -1550,7 +1551,6 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness ) return true; } -#include bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBLET& aLastPoint ) { @@ -1587,23 +1587,18 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL case CURVE_BEZIER: { -#if 0 // TODO: this code is not working. so fix it or replace the curve by a set of segments TColgp_Array1OfPnt poles(0, 3); gp_Pnt pt = gp_Pnt( aCurve.m_start.x, aCurve.m_start.y, 0.0 ); poles(0) = pt; - pt = gp_Pnt( aCurve.m_bezierctrl1.x, -aCurve.m_bezierctrl1.y, 0.0 ); + pt = gp_Pnt( aCurve.m_bezierctrl1.x, aCurve.m_bezierctrl1.y, 0.0 ); poles(1) = pt; - pt = gp_Pnt( aCurve.m_bezierctrl2.x, -aCurve.m_bezierctrl2.y, 0.0 ); + pt = gp_Pnt( aCurve.m_bezierctrl2.x, aCurve.m_bezierctrl2.y, 0.0 ); poles(2) = pt; pt = gp_Pnt( endPoint.x, endPoint.y, 0.0 ); poles(3) = pt; Geom_BezierCurve* bezier_curve = new Geom_BezierCurve( poles ); edge = BRepBuilderAPI_MakeEdge( bezier_curve ); -#else // Generate a segment between ends - edge = BRepBuilderAPI_MakeEdge( gp_Pnt( aLastPoint.x, aLastPoint.y, 0.0 ), - gp_Pnt( endPoint.x, endPoint.y, 0.0 ) ); -#endif } break;