From a85964b8ad1ac8252d76f14483672a42a8d74208 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jul 2015 18:32:37 +0200 Subject: [PATCH] fix incorrect slot orientation and width in export IDF --- pcbnew/exporters/export_idf.cpp | 11 ++++++++++- utils/idftools/idf_parser.cpp | 14 -------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 591c732943..a05b224b93 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -328,10 +328,19 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, // screen with a LH coordinate system double angle = pad->GetOrientation() / 10.0; + // NOTE: Since this code assumes the scenario where + // GetDrillSize().y is the length but idf_parser.cpp + // assumes a length along the X axis, the orientation + // must be shifted +90 deg when GetDrillSize().y is + // the major axis. + if( dlength < drill ) { std::swap( drill, dlength ); - angle += M_PI_2; + } + else + { + angle += 90.0; } // NOTE: KiCad measures a slot's length from end to end diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp index 563c45624e..c4d3e4cf79 100644 --- a/utils/idftools/idf_parser.cpp +++ b/utils/idftools/idf_parser.cpp @@ -3507,20 +3507,6 @@ bool IDF3_BOARD::AddSlot( double aWidth, double aLength, double aOrientation, do IDF_POINT c[2]; // centers IDF_POINT pt[4]; - // make sure the user isn't giving us dud information - if( aLength < aWidth ) - std::swap( aLength, aWidth ); - - if( aLength == aWidth ) - { - ostringstream ostr; - ostr << __FILE__ << ":" << __LINE__ << ":" << __FUNCTION__ << "():\n"; - ostr << "* slot length must not equal width"; - errormsg = ostr.str(); - - return false; - } - double a1 = aOrientation / 180.0 * M_PI; double a2 = a1 + M_PI_2; double d1 = aLength / 2.0;