From 8d79a82b3d46a78529718fc916e2c41e943bd715 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Mon, 21 Jan 2008 22:16:45 +0000 Subject: [PATCH] specctra export support --- change_log.txt | 56 ++++++++++++++++++++++++-------------- include/wxPcbStruct.h | 8 ++++++ pcbnew/CMakeLists.txt | 5 ++-- pcbnew/menubarpcb.cpp | 11 ++++++-- pcbnew/specctra.cpp | 32 ++++++++++++++++------ pcbnew/specctra.h | 51 ++++++++++++++++++---------------- pcbnew/specctra_export.cpp | 23 ++++++++++++++-- 7 files changed, 129 insertions(+), 57 deletions(-) diff --git a/change_log.txt b/change_log.txt index 5f8529f6ae..1f02da23c8 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,40 +4,56 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + + +2008-Jan-21 UPDATE Dick Hollenbeck +================================================================================ ++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 ================================================================================ +eeschema: - labels and texts display changed when rotated 180 degres: - horizontal text are now right justified insteed of 180 degree rotated, and are readable. - + labels and texts display changed when rotated 180 degres: + horizontal text are now right justified insteed of 180 degree rotated, and are readable. + +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 ================================================================================ +pcbnew: - On line DRC when creating a zone outline. - Needs more work to display errors DRC. + On line DRC when creating a zone outline. + Needs more work to display errors DRC. 2008-Jan-18 UPDATE Jean-Pierre Charras ================================================================================ +all: - 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. - + 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. + +pcbnew: - rework of drill filles creation (excellon and reports) - needed to have a clean implantation of buried vias and mainly microvia - which involve a more complex drill files generation - This is better to continue work on zones because : - hight density boards = use of BGA = microvias + good zones handling - 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: - drill file for layer1 to layer 2 - drill file for layer2 to layer 3 - drill file for layer3 to layer 4 - + rework of drill filles creation (excellon and reports) + needed to have a clean implantation of buried vias and mainly microvia + which involve a more complex drill files generation + This is better to continue work on zones because : + hight density boards = use of BGA = microvias + good zones handling + 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: + drill file for layer1 to layer 2 + drill file for layer2 to layer 3 + drill file for layer3 to layer 4 2008-Jan-18 UPDATE Dick Hollenbeck diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 1c845b4126..bd36f0fd8d 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -387,6 +387,14 @@ public: bool RecreateCmpFileFromBoard(); 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 */ MODULE* ListAndSelectModuleName(); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index a6569b1088..ae0fbf9d21 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -61,7 +61,7 @@ SET(PCBNEW_SRCS # docedit.cpp <-- not used dragsegm.cpp drc.cpp -# dsn.cpp + dsn.cpp edgemod.cpp edit.cpp editedge.cpp @@ -121,7 +121,8 @@ SET(PCBNEW_SRCS set_color.cpp set_grid.cpp solve.cpp -# specctra.cpp + specctra.cpp + specctra_export.cpp surbrill.cpp swap_layers.cpp tool_modedit.cpp diff --git a/pcbnew/menubarpcb.cpp b/pcbnew/menubarpcb.cpp index 1ab680227e..43a6adb920 100644 --- a/pcbnew/menubarpcb.cpp +++ b/pcbnew/menubarpcb.cpp @@ -27,8 +27,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar() /* Cree ou reinitialise le menu du haut d'ecran */ { -int ii; -wxMenuBar * menuBar = GetMenuBar(); + int ii; + wxMenuBar * menuBar = GetMenuBar(); if( menuBar == NULL ) { @@ -98,10 +98,17 @@ wxMenuBar * menuBar = GetMenuBar(); // Add Export menu m_FilesMenu->AppendSeparator(); 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, _("&GenCAD"), _("Export GenCAD Format") ); item->SetBitmap(export_xpm); submenuexport->Append(item); + item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT, _("&Module report"), _("Create a pcb report (footprint report)") ); item->SetBitmap(tools_xpm); diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index c08fa416cf..e7bf4a5974 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -55,9 +55,15 @@ #include -#define EDA_BASE // build_version.h behavior -#undef COMMON_GLOBL -#define COMMON_GLOBL // build_version.h behavior +#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 + #undef COMMON_GLOBL + #define COMMON_GLOBL // build_version.h behavior +#endif #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") ); @@ -3329,8 +3335,6 @@ void SPECCTRA_DB::ExportPCB( wxString filename, BOARD* aBoard ) ThrowIOError( _("Unable to open file \"%s\""), filename.GetData() ); } - // copy the BOARD to an empty PCB here. - if( pcb ) pcb->Format( this, 0 ); @@ -3361,6 +3365,18 @@ PCB* SPECCTRA_DB::MakePCB() PCB* pcb = new 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; } @@ -3556,7 +3572,7 @@ void PLACE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) // unit test this source file -#if 1 +#if STANDALONE 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 db.ExportSESSION( wxT("/tmp/export.ses") ); -// db.ExportPCB( wxT("/tmp/export.dsn"), 0 ); +// db.ExportPCB( wxT("/tmp/export.dsn") ); } diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 86218c48a1..03ad10e4b1 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -1,6 +1,3 @@ -#ifndef SPECCTRA_H_ -#define SPECCTRA_H_ - /* * 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 */ +#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 + +#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 fairly well. There are classes for each major type of descriptor in the spec. @@ -47,21 +56,9 @@ an assignment operator() or copy constructore, then boost::ptr_vector cannot be beat. */ - - -#include - -#include "fctsys.h" -#include "pcbstruct.h" -#include "dsn.h" - - - namespace DSN { - class SPECCTRA_DB; -class PCB; /** @@ -579,9 +576,6 @@ public: out->Print( nestLevel, ")\n" ); } }; - - -/// see http://www.boost.org/libs/ptr_container/doc/ptr_sequence_adapter.html typedef boost::ptr_vector PATHS; @@ -3163,17 +3157,28 @@ public: /** * 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 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 - * 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. */ diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 1106ecc033..f8abba6dc1 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -34,18 +34,37 @@ #include "specctra.h" +using namespace DSN; + // see wxPcbStruct.h 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 { + +void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) +{ + + +} } // namespace DSN