← Back to team overview

kicad-developers team mailing list archive

[PATCH] fix slot export in IDF

 

This patch fixes the problems reported by Maurice:
a. slot orientation incorrect (problem in export_idf.cpp)
b. slot width incorrect (problem due to bad logic in idf_parser.cpp)

- Cirilo
=== modified file 'pcbnew/exporters/export_idf.cpp'
--- pcbnew/exporters/export_idf.cpp	2015-05-15 12:49:11 +0000
+++ pcbnew/exporters/export_idf.cpp	2015-07-04 10:41:30 +0000
@@ -328,10 +328,19 @@
                 // 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_PI2;
+                }
+                else
+                {
+                    angle += 90.0;
                 }
 
                 // NOTE: KiCad measures a slot's length from end to end

=== modified file 'utils/idftools/idf_parser.cpp'
--- utils/idftools/idf_parser.cpp	2015-03-03 10:50:50 +0000
+++ utils/idftools/idf_parser.cpp	2015-07-04 10:27:50 +0000
@@ -3507,20 +3507,6 @@
     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_PI2;
     double d1 = aLength / 2.0;


Follow ups