Commit 55eefbbe authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fixed a bug about Aperture Definition having parameters for an aperture macro....

Fixed a bug about Aperture Definition having parameters for an aperture macro. See Changlog for not yet supported RX274X commands. Having still problems with arcs in some gereber files.
parent 9ff8fd27
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -4,6 +4,22 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.

2010-oct-09, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++gerbview:
    Fixed some issues:
        Now aperture macro with parameters works.
        Note: complex parameters (like $1 + 4) are not supported

        other commands not yet supported:
        SF (scale factors)
        Offsets (image and layer)
        Rotations (image and layer)
        Axis definition
        Mirroring
        SR (Step and repeat)
        KO

2010-Oct-5 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++richio:
+21 −22
Original line number Diff line number Diff line
@@ -121,26 +121,25 @@ void GERBER::ResetDefaultValues()
    m_FileName.Empty();
    m_ImageName     = wxT( "no image name" );       // Image name from the IN command
    m_LayerName     = wxT( "no layer name" );       // Layer name from the LN command
    m_LayerNegative = FALSE;                    // TRUE = Negative Layer
    m_ImageNegative = FALSE;                    // TRUE = Negative image
    m_GerbMetric    = FALSE;                    // FALSE = Inches, TRUE = metric
    m_Relative = FALSE;                         // FALSE = absolute Coord, RUE =
                                                // relative Coord
    m_NoTrailingZeros = FALSE;                  // True: trailing zeros deleted
    m_MirorA    = FALSE;                        // True: miror / axe A (X)
    m_MirorB    = FALSE;                        // True: miror / axe B (Y)
    m_Has_DCode = FALSE;                        // TRUE = DCodes in file
                                                // FALSE = no DCode->
    m_LayerNegative = false;                        // true = Negative Layer
    m_ImageNegative = false;                        // true = Negative image
    m_GerbMetric    = false;                        // false = Inches, true = metric
    m_Relative = false;                             // false = absolute Coord,
                                                    // true = relative Coord
    m_NoTrailingZeros = false;                      // true: trailing zeros deleted
    m_MirorA    = false;                            // true: miror / axe A (default = X)
    m_MirorB    = false;                            // true: miror / axe B (default = Y)
    m_Has_DCode = false;                            // true = DCodes in file
                                                    // false = no DCode->
                                                    // search for separate DCode file

    m_FmtScale.x = m_FmtScale.y = g_Default_GERBER_Format % 10;
    m_FmtLen.x   = m_FmtLen.y = m_FmtScale.x + (g_Default_GERBER_Format / 10);
    m_FmtScale.x = m_FmtScale.y = 4;                // Initialize default format to 3.4 => 4
    m_FmtLen.x   = m_FmtLen.y = 3+4;                // Initialize default format len = 3+4

    m_LayerScale.x = m_LayerScale.y = 1.0;          // scale (X and Y) this
                                                    // layer
    m_Rotation     = 0;
    m_LayerScale.x = m_LayerScale.y = 1.0;          // scale (A and B) this layer
    m_Rotation     = 0;                             // Allowed 0, 90, 180, 270
    m_Iterpolation = GERB_INTERPOL_LINEAR_1X;       // Linear, 90 arc, Circ.
    m_360Arc_enbl  = FALSE;                         // 360 deg circular
    m_360Arc_enbl  = false;                         // 360 deg circular
                                                    // interpolation disable
    m_Current_Tool = 0;                             // Current Tool (Dcode)
                                                    // number selected
@@ -154,7 +153,7 @@ void GERBER::ResetDefaultValues()
                                                    // plot arcs & circles
    m_Current_File    = NULL;                       // File to read
    m_FilesPtr        = 0;
    m_PolygonFillMode = FALSE;
    m_PolygonFillMode = false;
    m_PolygonFillModeState = 0;
}

+46 −33
Original line number Diff line number Diff line
@@ -34,21 +34,21 @@ public:
    wxString           m_ImageName;                                     // Image name, from IN <name>* command
    wxString           m_LayerName;                                     // Layer name, from LN <name>* command
    int                m_Layer;                                         // Layer Number
    bool               m_LayerNegative;         // TRUE = Negative Layer
    bool               m_GerbMetric;            // FALSE = Inches, TRUE = metric
    bool               m_Relative;              // FALSE = absolute Coord, RUE = relative Coord
    bool               m_NoTrailingZeros;       // True: remove tailing zeros.
    bool               m_MirorA;                // True: miror / axe A (X)
    bool               m_MirorB;                // True: miror / axe B (Y)
    bool               m_Has_DCode;             // TRUE = DCodes in file
                                                // (FALSE = no DCode -> separate DCode file
    bool               m_LayerNegative;                                 // true = Negative Layer
    bool               m_GerbMetric;                                    // false = Inches, true = metric
    bool               m_Relative;                                      // false = absolute Coord, true = relative Coord
    bool               m_NoTrailingZeros;                               // true: remove tailing zeros.
    bool               m_MirorA;                                        // true: miror / axe A (X)
    bool               m_MirorB;                                        // true: miror / axe B (Y)
    bool               m_Has_DCode;                                     // true = DCodes in file
                                                                        // (false = no DCode -> separate DCode file
    wxPoint            m_Offset;                                        // Coord Offset
    wxSize             m_FmtScale;                                      // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4
    wxSize             m_FmtLen;                                        // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5
    wxRealPoint        m_LayerScale;                                    // scale (X and Y) of layer.
    int                m_Rotation;
    int                m_Iterpolation;                                  // Linear, 90 arc, Circ.
    bool               m_ImageNegative;         // TRUE = Negative image
    bool               m_ImageNegative;                                 // true = Negative image
    int                m_Current_Tool;                                  // Current Tool (Dcode) number selected
    int                m_Last_Pen_Command;                              // Current or last pen state (0..9, set by Dn option with n <10
    int                m_CommandState;                                  // state of gerber analysis command.
@@ -57,14 +57,14 @@ public:
    wxPoint            m_IJPos;                                         // IJ coord (for arcs & circles )

    FILE*              m_Current_File;                                  // Current file to read
    #define            INCLUDE_FILES_COUNT_MAX 10
    FILE*              m_FilesList[INCLUDE_FILES_COUNT_MAX+2];         // Included files list
    #define            INCLUDE_FILES_CNT_MAX 10
    FILE*              m_FilesList[INCLUDE_FILES_CNT_MAX + 2];          // Included files list
    int                m_FilesPtr;                                      // Stack pointer for files list

    int                m_Selected_Tool;         // Pour editions: Tool (Dcode) selectionn�
    int                m_Selected_Tool;                                 // For hightlight: current selected Dcode

    bool               m_360Arc_enbl;                                   // Enbl 360 deg circular interpolation
    bool               m_PolygonFillMode;       // Enbl polygon mode (read coord as a polygon descr)
    bool               m_PolygonFillMode;                               // Enable polygon mode (read coord as a polygon descr)
    int                m_PolygonFillModeState;                          // In polygon mode: 0 = first segm, 1 = next segm

    APERTURE_MACRO_SET m_aperture_macros;                               ///< a collection of APERTURE_MACROS, sorted by name
@@ -94,10 +94,23 @@ public:
     */
    void    InitToolTable();

    /** function ReadXYCoord
     * Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)
     */
    wxPoint ReadXYCoord( char*& Text );

    /** function ReadIJCoord
     * Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
     * These coordinates are relative, so if coordinate is absent, it's value
     * defaults to 0
     */
    wxPoint ReadIJCoord( char*& Text );

    // functions to read G commands or D commands:
    int     ReturnGCodeNumber( char*& Text );
    int     ReturnDCodeNumber( char*& Text );

    // functions to execute G commands or D commands:
    bool    Execute_G_Command( char*& text, int G_commande );
    bool    Execute_DCODE_Command( WinEDA_GerberFrame* frame,
                                   char*& text, int D_commande );
+3 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ bool AM_PRIMITIVE::mapExposure( GERBER_DRAW_ITEM* aParent )
    case AMP_THERMAL:
    case AMP_POLYGON:
        // All have an exposure parameter and can return true or false
        switch( GetExposure() )
        switch( GetExposure(aParent) )
        {
        case 0:     // exposure always OFF
            exposure = false;
@@ -108,11 +108,11 @@ bool AM_PRIMITIVE::mapExposure( GERBER_DRAW_ITEM* aParent )
 * returns the first parameter in integer form.  Some but not all primitives
 * use the first parameter as an exposure control.
 */
int AM_PRIMITIVE::GetExposure() const
int AM_PRIMITIVE::GetExposure(GERBER_DRAW_ITEM* aParent) const
{
    // No D_CODE* for GetValue()
    wxASSERT( params.size() && params[0].IsImmediate() );
    return (int) params[0].GetValue( NULL );
    return (int) params[0].GetValue( aParent->GetDcodeDescr() );
}

/** function DrawBasicShape
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public:
     * returns the first parameter in integer form.  Some but not all primitives
     * use the first parameter as an exposure control.
     */
    int GetExposure() const;
    int GetExposure( GERBER_DRAW_ITEM* aParent ) const;

    /**
     * Function mapExposure
Loading