specctra export support

This commit is contained in:
dickelbeck 2008-01-21 22:16:45 +00:00
parent 06158c7cf7
commit 8d79a82b3d
7 changed files with 129 additions and 57 deletions

View File

@ -4,40 +4,56 @@ 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:
labels and texts display changed when rotated 180 degres: labels and texts display changed when rotated 180 degres:
horizontal text are now right justified insteed of 180 degree rotated, and are readable. horizontal text are now right justified insteed of 180 degree rotated, and are readable.
+pcbnew: +pcbnew:
bug 1874663 solved (edit a pad netname does not work very well) bug 1874663 solved (edit a pad netname does not work very well)
2008-Jan-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Jan-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
On line DRC when creating a zone outline. On line DRC when creating a zone outline.
Needs more work to display errors DRC. Needs more work to display errors DRC.
2008-Jan-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Jan-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+all: +all:
filtering small mouse moves ( < 5 pixels) when clicking. filtering small mouse moves ( < 5 pixels) when clicking.
Starting a wire or a track is now more easily because these small moves do not start a block commnad. Starting a wire or a track is now more easily because these small moves do not start a block commnad.
+pcbnew: +pcbnew:
rework of drill filles creation (excellon and reports) rework of drill filles creation (excellon and reports)
needed to have a clean implantation of buried vias and mainly microvia needed to have a clean implantation of buried vias and mainly microvia
which involve a more complex drill files generation which involve a more complex drill files generation
This is better to continue work on zones because : This is better to continue work on zones because :
hight density boards = use of BGA = microvias + good zones handling hight density boards = use of BGA = microvias + good zones handling
When a board has buried or blind vias (microvia are blind vias), When a board has buried or blind vias (microvia are blind vias),
pcbnew creates a drill file per layer pair. for a 4 layer board: pcbnew creates a drill file per layer pair. for a 4 layer board:
drill file for layer1 to layer 2 drill file for layer1 to layer 2
drill file for layer2 to layer 3 drill file for layer2 to layer 3
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>

View File

@ -387,6 +387,14 @@ public:
bool RecreateCmpFileFromBoard(); bool RecreateCmpFileFromBoard();
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();

View File

@ -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

View File

@ -27,8 +27,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/* Cree ou reinitialise le menu du haut d'ecran /* Cree ou reinitialise le menu du haut d'ecran
*/ */
{ {
int ii; int ii;
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar * menuBar = GetMenuBar();
if( menuBar == NULL ) if( menuBar == NULL )
{ {
@ -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);

View File

@ -55,9 +55,15 @@
#include <wx/ffile.h> #include <wx/ffile.h>
#define EDA_BASE // build_version.h behavior #define STANDALONE 0 // set to 1 for "stand alone, i.e. unit testing"
#undef COMMON_GLOBL // set to 0 for component of pcbnew
#define COMMON_GLOBL // build_version.h behavior
#if STANDALONE
#define EDA_BASE // build_version.h behavior
#undef COMMON_GLOBL
#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") );
} }

View File

@ -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.
*/ */

View File

@ -34,18 +34,37 @@
#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