Beispiel #1
0
bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
{
    D_CODE*  tool;
    GERBER_DRAW_ITEM * gbritem;
    while( true )
    {
        switch( *text )
        {
            case 'X':
                ReadXYCoord( text );
                break;
            case 'Y':
                ReadXYCoord( text );
                break;
            case 'G':  // G85 is found here for oval holes
                m_PreviousPos = m_CurrentPos;
                Execute_EXCELLON_G_Command( text );
                break;
            case 0:     // E.O.L: execute command
                tool = GetDCODE( m_Current_Tool, false );
                if( !tool )
                {
                    wxString msg;
                    msg.Printf( _( "Tool <%d> not defined" ), m_Current_Tool );
                    ReportMessage( msg );
                    return false;
                }
                gbritem = new GERBER_DRAW_ITEM( GetParent()->GetBoard(), this );
                GetParent()->GetBoard()->m_Drawings.Append( gbritem );
                if( m_SlotOn )  // Oval hole
                {
                    fillLineGBRITEM( gbritem,
                                    tool->m_Num_Dcode, GetParent()->getActiveLayer(),
                                    m_PreviousPos, m_CurrentPos,
                                    tool->m_Size, false );
                }
                else
                {
                    fillFlashedGBRITEM( gbritem, tool->m_Shape,
                                    tool->m_Num_Dcode, GetParent()->getActiveLayer(),
                                    m_CurrentPos,
                                    tool->m_Size, false );
                }
                StepAndRepeatItem( *gbritem );
                m_PreviousPos = m_CurrentPos;
                return true;
                break;

            default:
                text++;
                break;
        }
    }

    return true;
}
bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
{
    D_CODE*  tool;
    GERBER_DRAW_ITEM * gbritem;

    while( true )
    {
        switch( *text )
        {
            case 'X':
                ReadXYCoord( text );
                break;
            case 'Y':
                ReadXYCoord( text );
                break;
            case 'G':  // G85 is found here for oval holes
                m_PreviousPos = m_CurrentPos;
                Execute_EXCELLON_G_Command( text );
                break;
            case 0:     // E.O.L: execute command
                tool = GetDCODE( m_Current_Tool, false );

                if( !tool )
                {
                    wxString msg;
                    msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
                    AddMessageToList( msg );
                    return false;
                }

                gbritem = new GERBER_DRAW_ITEM( this );
                m_Drawings.Append( gbritem );

                if( m_SlotOn )  // Oblong hole
                {
                    fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
                                    m_PreviousPos, m_CurrentPos,
                                    tool->m_Size, false );
                    // the hole is made: reset the slot on command (G85)
                    // (it is needed for each oblong hole)
                    m_SlotOn = false;
                }
                else
                {
                    fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
                                    m_CurrentPos, tool->m_Size, false );
                }

                StepAndRepeatItem( *gbritem );
                m_PreviousPos = m_CurrentPos;
                return true;
                break;

            default:
                text++;
                break;
        }
    }

    return true;
}
bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
{
    D_CODE*  tool;
    GERBER_DRAW_ITEM * gbritem;

    while( true )
    {
        switch( *text )
        {
            case 'X':
            case 'Y':
                // Decode the coordinate format
                if( !m_format_known )
                {
                    int nbdigits = 0;
                    int integer = m_GerbMetric ? fmtIntegerMM : fmtIntegerInch;
                    int mantissa;
                    char* read = text + 1;

                    while( IsNumber( *read ) )
                    {
                        if( *read == '.' )
                        {
                            integer = nbdigits;
                            read++;
                            continue;
                        }

                        if( ( *read >= '0' ) && ( *read <='9' ) )
                            nbdigits++;

                        read++;
                    }

                    mantissa = nbdigits - integer;

                    // Enforce minimum mantissa of 3 for metric
                    if( m_GerbMetric && mantissa < 3 )
                        mantissa = 3;

                    m_FmtScale.x = m_FmtScale.y = mantissa;
                    m_FmtLen.x = m_FmtLen.y = integer + mantissa;

                    m_format_known = true;
                }

                ReadXYCoord( text );
                break;

            case 'G':  // G85 is found here for oval holes
                m_PreviousPos = m_CurrentPos;
                Execute_EXCELLON_G_Command( text );
                break;

            case 0:     // E.O.L: execute command
                tool = GetDCODE( m_Current_Tool );

                if( !tool )
                {
                    wxString msg;
                    msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
                    AddMessageToList( msg );
                    return false;
                }

                gbritem = new GERBER_DRAW_ITEM( this );
                m_Drawings.Append( gbritem );

                if( m_SlotOn )  // Oblong hole
                {
                    fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
                                    m_PreviousPos, m_CurrentPos,
                                    tool->m_Size, false );
                    // the hole is made: reset the slot on command (G85)
                    // (it is needed for each oblong hole)
                    m_SlotOn = false;
                }
                else
                {
                    fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
                                    m_CurrentPos, tool->m_Size, false );
                }

                StepAndRepeatItem( *gbritem );
                m_PreviousPos = m_CurrentPos;
                return true;
                break;

            default:
                text++;
                break;
        }
    }

    return true;
}