specctra export support
This commit is contained in:
parent
06158c7cf7
commit
8d79a82b3d
|
@ -4,6 +4,23 @@ Started 2007-June-11
|
||||||
Please add newer entries at the top, list the date and your name with
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2008-Jan-21 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
================================================================================
|
||||||
|
+pcbnew:
|
||||||
|
Added specctra_export.cpp, specctra.cpp, specctra.h, dsn.cpp, and dsn.h to
|
||||||
|
pcbnew's link requirements. Updated CMakeLists.txt to reflect this. This
|
||||||
|
increased pcbnew's size by 175kb so far. Started the actual export (i.e.
|
||||||
|
BOARD to DSN::PCB copying logic) which is going into specctra_export.cpp's
|
||||||
|
void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event ) so that the
|
||||||
|
huge header file, specctra.h need only be included in one or two *.cpp
|
||||||
|
files. The specctra export menu support was added to id.h, wxPcbStruct.h,
|
||||||
|
menubarpcb.cpp, and pcbframe.cpp. After dsn export, I intend to add an
|
||||||
|
import, and a session file feedback merge. See the revised
|
||||||
|
how-to-build-kicad.txt for the new boost c++ libraries requirement.
|
||||||
|
|
||||||
|
|
||||||
2008-Jan-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
2008-Jan-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+eeschema:
|
+eeschema:
|
||||||
|
@ -39,7 +56,6 @@ email address.
|
||||||
drill file for layer3 to layer 4
|
drill file for layer3 to layer 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2008-Jan-18 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2008-Jan-18 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
how-to-build-kicad.txt: added the Boost C++ Libraries installation info
|
how-to-build-kicad.txt: added the Boost C++ Libraries installation info
|
||||||
|
|
|
@ -388,6 +388,14 @@ public:
|
||||||
|
|
||||||
void ExportToGenCAD( wxCommandEvent& event );
|
void ExportToGenCAD( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ExporttoSPECCTRA
|
||||||
|
* will export the current BOARD to a specctra dsn file. See
|
||||||
|
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
|
||||||
|
* specification.
|
||||||
|
*/
|
||||||
|
void ExportToSPECCTRA( wxCommandEvent& event );
|
||||||
|
|
||||||
/* Fonctions specifiques */
|
/* Fonctions specifiques */
|
||||||
MODULE* ListAndSelectModuleName();
|
MODULE* ListAndSelectModuleName();
|
||||||
void Liste_Equipot( wxCommandEvent& event );
|
void Liste_Equipot( wxCommandEvent& event );
|
||||||
|
|
|
@ -61,7 +61,7 @@ SET(PCBNEW_SRCS
|
||||||
# docedit.cpp <-- not used
|
# docedit.cpp <-- not used
|
||||||
dragsegm.cpp
|
dragsegm.cpp
|
||||||
drc.cpp
|
drc.cpp
|
||||||
# dsn.cpp
|
dsn.cpp
|
||||||
edgemod.cpp
|
edgemod.cpp
|
||||||
edit.cpp
|
edit.cpp
|
||||||
editedge.cpp
|
editedge.cpp
|
||||||
|
@ -121,7 +121,8 @@ SET(PCBNEW_SRCS
|
||||||
set_color.cpp
|
set_color.cpp
|
||||||
set_grid.cpp
|
set_grid.cpp
|
||||||
solve.cpp
|
solve.cpp
|
||||||
# specctra.cpp
|
specctra.cpp
|
||||||
|
specctra_export.cpp
|
||||||
surbrill.cpp
|
surbrill.cpp
|
||||||
swap_layers.cpp
|
swap_layers.cpp
|
||||||
tool_modedit.cpp
|
tool_modedit.cpp
|
||||||
|
|
|
@ -98,10 +98,17 @@ wxMenuBar * menuBar = GetMenuBar();
|
||||||
// Add Export menu
|
// Add Export menu
|
||||||
m_FilesMenu->AppendSeparator();
|
m_FilesMenu->AppendSeparator();
|
||||||
wxMenu * submenuexport = new wxMenu();
|
wxMenu * submenuexport = new wxMenu();
|
||||||
|
|
||||||
|
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA,
|
||||||
|
_("&Specctra DSN"), _("Export board to a \"Specctra DSN\" file") );
|
||||||
|
item->SetBitmap(export_xpm);
|
||||||
|
submenuexport->Append(item);
|
||||||
|
|
||||||
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
|
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
|
||||||
_("&GenCAD"), _("Export GenCAD Format") );
|
_("&GenCAD"), _("Export GenCAD Format") );
|
||||||
item->SetBitmap(export_xpm);
|
item->SetBitmap(export_xpm);
|
||||||
submenuexport->Append(item);
|
submenuexport->Append(item);
|
||||||
|
|
||||||
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
|
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
|
||||||
_("&Module report"), _("Create a pcb report (footprint report)") );
|
_("&Module report"), _("Create a pcb report (footprint report)") );
|
||||||
item->SetBitmap(tools_xpm);
|
item->SetBitmap(tools_xpm);
|
||||||
|
|
|
@ -55,9 +55,15 @@
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define STANDALONE 0 // set to 1 for "stand alone, i.e. unit testing"
|
||||||
|
// set to 0 for component of pcbnew
|
||||||
|
|
||||||
|
|
||||||
|
#if STANDALONE
|
||||||
#define EDA_BASE // build_version.h behavior
|
#define EDA_BASE // build_version.h behavior
|
||||||
#undef COMMON_GLOBL
|
#undef COMMON_GLOBL
|
||||||
#define COMMON_GLOBL // build_version.h behavior
|
#define COMMON_GLOBL // build_version.h behavior
|
||||||
|
#endif
|
||||||
#include "build_version.h"
|
#include "build_version.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -3320,7 +3326,7 @@ const char* SPECCTRA_DB::GetQuoteChar( const char* wrapee )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SPECCTRA_DB::ExportPCB( wxString filename, BOARD* aBoard )
|
void SPECCTRA_DB::ExportPCB( wxString filename ) throw( IOError )
|
||||||
{
|
{
|
||||||
fp = wxFopen( filename, wxT("w") );
|
fp = wxFopen( filename, wxT("w") );
|
||||||
|
|
||||||
|
@ -3329,8 +3335,6 @@ void SPECCTRA_DB::ExportPCB( wxString filename, BOARD* aBoard )
|
||||||
ThrowIOError( _("Unable to open file \"%s\""), filename.GetData() );
|
ThrowIOError( _("Unable to open file \"%s\""), filename.GetData() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the BOARD to an empty PCB here.
|
|
||||||
|
|
||||||
if( pcb )
|
if( pcb )
|
||||||
pcb->Format( this, 0 );
|
pcb->Format( this, 0 );
|
||||||
|
|
||||||
|
@ -3361,6 +3365,18 @@ PCB* SPECCTRA_DB::MakePCB()
|
||||||
PCB* pcb = new PCB();
|
PCB* pcb = new PCB();
|
||||||
|
|
||||||
pcb->parser = new PARSER( pcb );
|
pcb->parser = new PARSER( pcb );
|
||||||
|
pcb->resolution = new UNIT_RES( pcb, T_resolution );
|
||||||
|
pcb->unit = new UNIT_RES( pcb, T_unit );
|
||||||
|
|
||||||
|
pcb->structure = new STRUCTURE( pcb );
|
||||||
|
|
||||||
|
pcb->placement = new PLACEMENT( pcb );
|
||||||
|
|
||||||
|
pcb->library = new LIBRARY( pcb );
|
||||||
|
|
||||||
|
pcb->network = new NETWORK( pcb );
|
||||||
|
|
||||||
|
pcb->wiring = new WIRING( pcb );
|
||||||
|
|
||||||
return pcb;
|
return pcb;
|
||||||
}
|
}
|
||||||
|
@ -3556,7 +3572,7 @@ void PLACE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
|
||||||
|
|
||||||
// unit test this source file
|
// unit test this source file
|
||||||
|
|
||||||
#if 1
|
#if STANDALONE
|
||||||
|
|
||||||
using namespace DSN;
|
using namespace DSN;
|
||||||
|
|
||||||
|
@ -3589,7 +3605,7 @@ int main( int argc, char** argv )
|
||||||
|
|
||||||
// export what we read in, making this test program basically a beautifier
|
// export what we read in, making this test program basically a beautifier
|
||||||
db.ExportSESSION( wxT("/tmp/export.ses") );
|
db.ExportSESSION( wxT("/tmp/export.ses") );
|
||||||
// db.ExportPCB( wxT("/tmp/export.dsn"), 0 );
|
// db.ExportPCB( wxT("/tmp/export.dsn") );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#ifndef SPECCTRA_H_
|
|
||||||
#define SPECCTRA_H_
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
|
@ -25,8 +22,20 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef SPECCTRA_H_
|
||||||
|
#define SPECCTRA_H_
|
||||||
|
|
||||||
/* This source file implements export and import capabilities to the
|
|
||||||
|
// see http://www.boost.org/libs/ptr_container/doc/ptr_sequence_adapter.html
|
||||||
|
#include <boost/ptr_container/ptr_vector.hpp>
|
||||||
|
|
||||||
|
#include "fctsys.h"
|
||||||
|
#include "dsn.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This source file implements export and import capabilities to the
|
||||||
specctra dsn file format. The grammar for that file format is documented
|
specctra dsn file format. The grammar for that file format is documented
|
||||||
fairly well. There are classes for each major type of descriptor in the
|
fairly well. There are classes for each major type of descriptor in the
|
||||||
spec.
|
spec.
|
||||||
|
@ -47,21 +56,9 @@
|
||||||
an assignment operator() or copy constructore, then boost::ptr_vector
|
an assignment operator() or copy constructore, then boost::ptr_vector
|
||||||
cannot be beat.
|
cannot be beat.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <boost/ptr_container/ptr_vector.hpp>
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
|
||||||
#include "pcbstruct.h"
|
|
||||||
#include "dsn.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace DSN {
|
namespace DSN {
|
||||||
|
|
||||||
|
|
||||||
class SPECCTRA_DB;
|
class SPECCTRA_DB;
|
||||||
class PCB;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -579,9 +576,6 @@ public:
|
||||||
out->Print( nestLevel, ")\n" );
|
out->Print( nestLevel, ")\n" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// see http://www.boost.org/libs/ptr_container/doc/ptr_sequence_adapter.html
|
|
||||||
typedef boost::ptr_vector<PATH> PATHS;
|
typedef boost::ptr_vector<PATH> PATHS;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3163,17 +3157,28 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ExportPCB
|
* Function ExportPCB
|
||||||
* writes the given BOARD out as a SPECTRA DSN format file.
|
* writes the internal PCB instance out as a SPECTRA DSN format file.
|
||||||
*
|
*
|
||||||
* @param aFilename The file to save to.
|
* @param aFilename The file to save to.
|
||||||
* @param aBoard The BOARD to save.
|
* @throw IOError, if an i/o error occurs saving the file.
|
||||||
*/
|
*/
|
||||||
void ExportPCB( wxString aFilename, BOARD* aBoard );
|
void ExportPCB( wxString aFilename ) throw( IOError );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function FromBOARD
|
||||||
|
* adds the entire BOARD to the PCB but does not write it out.
|
||||||
|
*
|
||||||
|
* @param aBoard The BOARD to convert to a PCB.
|
||||||
|
* @throw IOError, if the BOARD cannot be converted, and the text of the
|
||||||
|
* exception tells the error message.
|
||||||
|
*/
|
||||||
|
void FromBOARD( BOARD* aBoard ) throw( IOError );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ExportSESSION
|
* Function ExportSESSION
|
||||||
* writes the internal session out as a SPECTRA DSN format file.
|
* writes the internal SESSION instance out as a SPECTRA DSN format file.
|
||||||
*
|
*
|
||||||
* @param aFilename The file to save to.
|
* @param aFilename The file to save to.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,19 +34,38 @@
|
||||||
|
|
||||||
#include "specctra.h"
|
#include "specctra.h"
|
||||||
|
|
||||||
|
using namespace DSN;
|
||||||
|
|
||||||
|
|
||||||
// see wxPcbStruct.h
|
// see wxPcbStruct.h
|
||||||
void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
|
void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
SPECCTRA_DB db;
|
||||||
|
|
||||||
|
db.SetPCB( SPECCTRA_DB::MakePCB() );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.FromBOARD( m_Pcb );
|
||||||
|
// db.Export( filename );
|
||||||
|
}
|
||||||
|
catch ( IOError ioe )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace DSN {
|
namespace DSN {
|
||||||
|
|
||||||
|
|
||||||
|
void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace DSN
|
} // namespace DSN
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue