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

Add a new utility: pcb_calculator (need of course wore work)

Eeschema: optimize import of footprints names ( .stf files) that was time consumming with large designs.
parent 89ccc663
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -239,6 +239,7 @@ add_subdirectory(polygon)
add_subdirectory(polygon/kbool/src)
add_subdirectory(polygon/kbool/src)
add_subdirectory(potrace)
add_subdirectory(potrace)
add_subdirectory(bitmap2component)
add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator)
#add_subdirectory(new)
#add_subdirectory(new)


#############
#############
+39 −5
Original line number Original line Diff line number Diff line
@@ -15,18 +15,25 @@
#include "general.h"
#include "general.h"
#include "sch_sheet_path.h"
#include "sch_sheet_path.h"
#include "sch_component.h"
#include "sch_component.h"
#include "netlist.h"




const wxString BackAnnotateFileWildcard( wxT( "EESchema Back Annotation File (*.stf)|*.stf" ) );
const wxString BackAnnotateFileWildcard( wxT( "EESchema Back Annotation File (*.stf)|*.stf" ) );




bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFilename, bool aSetFieldAttributeToVisible  )
bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFile, bool aSetFieldAttributeToVisible  )
{
{
    int   LineNum = 0;
    int   LineNum = 0;
    char* cp, Ref[256], FootPrint[256], Line[1024];
    char* cp, Ref[256], FootPrint[256], Line[1024];
    SCH_SHEET_LIST SheetList;
    SCH_SHEET_LIST SheetList;
    wxString reference;
    wxString footprint;


    while( GetLine( aFilename, Line, &LineNum, sizeof(Line) ) )
    // Build a flat list of components in schematic:
    SCH_REFERENCE_LIST referencesList;
    SheetList.GetComponents( referencesList, false );

    while( GetLine( aFile, Line, &LineNum, sizeof(Line) ) )
    {
    {
        if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint ) == 2 )
        if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint ) == 2 )
        {
        {
@@ -38,12 +45,39 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFilename, bool aSetFieldAttributeT
                if( *cp == '"' )
                if( *cp == '"' )
                    *cp = 0;
                    *cp = 0;


            wxString reference = FROM_UTF8( Ref );
            reference = FROM_UTF8( Ref );
            wxString Footprint = FROM_UTF8( FootPrint );
            footprint = FROM_UTF8( FootPrint );
            SheetList.SetComponentFootprint( reference, Footprint, aSetFieldAttributeToVisible );

            // Search the component in the flat list
            for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
            {
                if( reference.CmpNoCase( referencesList[ii].GetRef() ) == 0 )
                {
                    // We have found a candidate.
                    // Note: it can be not unique (multiple parts per package)
                    // So we do not stop the search here
                    SCH_COMPONENT* component = referencesList[ii].GetComponent();
                    SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
                    if( fpfield->m_Text.IsEmpty()
                        && ( fpfield->m_Pos == wxPoint( 0, 0 ) ) )
                    {
                        fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
                        fpfield->m_Pos    = component->GetField( VALUE )->m_Pos;
                        fpfield->m_Pos.y -= 100;
                    }

                    fpfield->m_Text = footprint;

                    if( aSetFieldAttributeToVisible )
                        component->GetField( FOOTPRINT )->m_Attributs &= ~TEXT_NO_VISIBLE;
                    else
                        component->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
                }
            }
        }
        }
    }
    }


    fclose( aFile );
    return true;
    return true;
}
}


+4 −2
Original line number Original line Diff line number Diff line
@@ -43,11 +43,13 @@ public:
     * Function AppendToList
     * Function AppendToList
     * @param aItem The SCH_MARKER* to add to the current list which will be
     * @param aItem The SCH_MARKER* to add to the current list which will be
     *  displayed in the wxHtmlListBox
     *  displayed in the wxHtmlListBox
     * @param aRefresh = true to refresh the display
     */
     */
    void AppendToList( SCH_MARKER* aItem )
    void AppendToList( SCH_MARKER* aItem, bool aRefresh = true )
    {
    {
        m_MarkerList.push_back( aItem);
        m_MarkerList.push_back( aItem);
        SetItemCount( m_MarkerList.size() );
        SetItemCount( m_MarkerList.size() );
        if( aRefresh )
            Refresh();
            Refresh();
    }
    }


+3 −9
Original line number Original line Diff line number Diff line
@@ -325,17 +325,11 @@ void DIALOG_ERC::DisplayERC_MarkersList()
            SCH_MARKER* Marker = (SCH_MARKER*) DrawStruct;
            SCH_MARKER* Marker = (SCH_MARKER*) DrawStruct;
            if( Marker->GetMarkerType() != MARK_ERC )
            if( Marker->GetMarkerType() != MARK_ERC )
                continue;
                continue;

            // Add marker without refresh the displayed list:
            /* Display diag */
            m_MarkersList->AppendToList( Marker, false );

//            wxString msg;
//            msg.Printf( _( "<b>sheet %s</b><ul>\n" ),
// Sheet->PathHumanReadable().GetData() );
//            msg += Marker->GetReporter().ShowHtml();
//            m_MarkersList->Append( msg );
            m_MarkersList->AppendToList( Marker );
        }
        }
    }
    }
    m_MarkersList->Refresh();
}
}




+3 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ enum pseudokeys {
#define EESCHEMA_EXE        wxT( "eeschema.exe" )
#define EESCHEMA_EXE        wxT( "eeschema.exe" )
#define GERBVIEW_EXE        wxT( "gerbview.exe" )
#define GERBVIEW_EXE        wxT( "gerbview.exe" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.exe" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.exe" )
#define PCB_CALCULATOR_EXE  wxT( "pcb_calculator.exe" )
#else
#else
#ifndef __WXMAC__
#ifndef __WXMAC__
#define CVPCB_EXE           wxT( "cvpcb" )
#define CVPCB_EXE           wxT( "cvpcb" )
@@ -61,12 +62,14 @@ enum pseudokeys {
#define EESCHEMA_EXE        wxT( "eeschema" )
#define EESCHEMA_EXE        wxT( "eeschema" )
#define GERBVIEW_EXE        wxT( "gerbview" )
#define GERBVIEW_EXE        wxT( "gerbview" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component" )
#define PCB_CALCULATOR_EXE  wxT( "pcb_calculator" )
#else
#else
#define CVPCB_EXE           wxT( "cvpcb.app/Contents/MacOS/cvpcb" )
#define CVPCB_EXE           wxT( "cvpcb.app/Contents/MacOS/cvpcb" )
#define PCBNEW_EXE          wxT( "pcbnew.app/Contents/MacOS/pcbnew" )
#define PCBNEW_EXE          wxT( "pcbnew.app/Contents/MacOS/pcbnew" )
#define EESCHEMA_EXE        wxT( "eeschema.app/Contents/MacOS/eeschema" )
#define EESCHEMA_EXE        wxT( "eeschema.app/Contents/MacOS/eeschema" )
#define GERBVIEW_EXE        wxT( "gerbview.app/Contents/MacOS/gerbview" )
#define GERBVIEW_EXE        wxT( "gerbview.app/Contents/MacOS/gerbview" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" )
#define PCB_CALCULATOR_EXE  wxT( "pcb_calculator.app/Contents/MacOS/pcb_calculator" )
# endif
# endif
#endif
#endif


Loading