← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] fix slot export in IDF

 

Sorry Jean-Pierre, my mistake. This "B" version was made against rev 5881
and should work.

- Cirilo


On Sat, Jul 4, 2015 at 10:24 PM, jp charras <jp.charras@xxxxxxxxxx> wrote:

> Le 04/07/2015 13:20, Cirilo Bernardo a écrit :
> > 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
> >
>
> Thanks.
> But looks like the patch is not built against the latest Kicad version.
>
>
> --
> Jean-Pierre CHARRAS
>
=== modified file 'pcbnew/exporters/export_idf.cpp'
--- pcbnew/exporters/export_idf.cpp	2015-07-03 08:42:47 +0000
+++ pcbnew/exporters/export_idf.cpp	2015-07-04 13:00:52 +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_PI_2;
+                }
+                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-07-03 08:42:47 +0000
+++ utils/idftools/idf_parser.cpp	2015-07-04 12:51:29 +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_PI_2;
     double d1 = aLength / 2.0;


Follow ups

References