specctra import work
This commit is contained in:
parent
cf460637b2
commit
c8584436b4
|
@ -119,7 +119,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
|
||||||
|
|
||||||
if( query && GetScreen()->IsModify() )
|
if( query && GetScreen()->IsModify() )
|
||||||
{
|
{
|
||||||
if( m_Pcb->m_Drawings ||m_Pcb->m_Modules
|
if( m_Pcb->m_Drawings || m_Pcb->m_Modules
|
||||||
|| m_Pcb->m_Track || m_Pcb->m_Zone )
|
|| m_Pcb->m_Track || m_Pcb->m_Zone )
|
||||||
{
|
{
|
||||||
if( !IsOK( this, _( "Current Board will be lost ?" ) ) )
|
if( !IsOK( this, _( "Current Board will be lost ?" ) ) )
|
||||||
|
|
|
@ -844,6 +844,7 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
|
||||||
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb);
|
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb);
|
||||||
zone_descr->ReadDescr( File, &LineNum );
|
zone_descr->ReadDescr( File, &LineNum );
|
||||||
m_Pcb->Add(zone_descr);
|
m_Pcb->Add(zone_descr);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
||||||
|
|
|
@ -1782,6 +1782,7 @@ public:
|
||||||
i->Format( out, nestLevel );
|
i->Format( out, nestLevel );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
typedef boost::ptr_vector<COMPONENT> COMPONENTS;
|
||||||
|
|
||||||
|
|
||||||
class PLACEMENT : public ELEM
|
class PLACEMENT : public ELEM
|
||||||
|
@ -1792,7 +1793,6 @@ class PLACEMENT : public ELEM
|
||||||
|
|
||||||
DSN_T flip_style;
|
DSN_T flip_style;
|
||||||
|
|
||||||
typedef boost::ptr_vector<COMPONENT> COMPONENTS;
|
|
||||||
COMPONENTS components;
|
COMPONENTS components;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -3812,6 +3812,17 @@ public:
|
||||||
* @param aBoard The BOARD to convert to a PCB.
|
* @param aBoard The BOARD to convert to a PCB.
|
||||||
*/
|
*/
|
||||||
void FromBOARD( BOARD* aBoard );
|
void FromBOARD( BOARD* aBoard );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function FromSESSION
|
||||||
|
* adds the entire SESSION info to a BOARD but does not write it out. The
|
||||||
|
* the BOARD given to this function will have all its tracks and via's replaced,
|
||||||
|
* and all its components are subject to being moved.
|
||||||
|
*
|
||||||
|
* @param aBoard The BOARD to merge the SESSION information into.
|
||||||
|
*/
|
||||||
|
void FromSESSION( BOARD* aBoard ) throw( IOError );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,13 +63,6 @@ void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event )
|
||||||
if( fullFileName == wxEmptyString )
|
if( fullFileName == wxEmptyString )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// prepare the EQUIPOTs
|
|
||||||
if( !( m_Pcb->m_Status_Pcb & NET_CODES_OK ) )
|
|
||||||
{
|
|
||||||
//m_Pcb->m_Status_Pcb &= ~(LISTE_PAD_OK);
|
|
||||||
recalcule_pad_net_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
SPECCTRA_DB db;
|
SPECCTRA_DB db;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
wxString errorText;
|
wxString errorText;
|
||||||
|
@ -172,8 +165,8 @@ static POINT mapPt( const wxPoint& pt )
|
||||||
/**
|
/**
|
||||||
* Function findPOINT
|
* Function findPOINT
|
||||||
* searches the list of POINT_PAIRS for a matching end to the given POINT.
|
* searches the list of POINT_PAIRS for a matching end to the given POINT.
|
||||||
* @return int - 0 if no match, or + one based index of a POINT_PAIR with a matching ".start",
|
* @return int - 0 if no match, or positive one based index of a POINT_PAIR with a matching ".start",
|
||||||
* or a - one based index of a POINT_PAIR with a matching ".end".
|
* or a negated one based index of a POINT_PAIR with a matching ".end".
|
||||||
*/
|
*/
|
||||||
static int findPOINT( const POINT& pt, const POINT_PAIR source[], int count )
|
static int findPOINT( const POINT& pt, const POINT_PAIR source[], int count )
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,17 +34,113 @@
|
||||||
|
|
||||||
|
|
||||||
#include "specctra.h"
|
#include "specctra.h"
|
||||||
|
#include "common.h" // IsOK() & EDA_FileSelector()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace DSN;
|
using namespace DSN;
|
||||||
|
|
||||||
void WinEDA_PcbFrame::ImportSpecctraDesign( wxCommandEvent& event )
|
void WinEDA_PcbFrame::ImportSpecctraDesign( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
if( !Clear_Pcb( true ) )
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event )
|
void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
if( GetScreen()->IsModify() )
|
||||||
|
{
|
||||||
|
if( !IsOK( this, _( "Board Modified: Continue ?" ) ) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString sessionExt( wxT( ".ses" ) );
|
||||||
|
wxString fileName = GetScreen()->m_FileName;
|
||||||
|
wxString mask = wxT( "*" ) + sessionExt;
|
||||||
|
|
||||||
|
ChangeFileNameExt( fileName, sessionExt );
|
||||||
|
|
||||||
|
fileName = EDA_FileSelector( _( "Merge Specctra Session file:" ),
|
||||||
|
wxEmptyString,
|
||||||
|
fileName,
|
||||||
|
sessionExt,
|
||||||
|
mask,
|
||||||
|
this,
|
||||||
|
wxFD_OPEN,
|
||||||
|
FALSE );
|
||||||
|
|
||||||
|
if( fileName == wxEmptyString )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SPECCTRA_DB db;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.LoadSESSION( fileName );
|
||||||
|
db.FromSESSION( m_Pcb );
|
||||||
|
}
|
||||||
|
catch( IOError ioe )
|
||||||
|
{
|
||||||
|
DisplayError( this, ioe.errorText );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_SelTrackWidthBox_Changed = TRUE;
|
||||||
|
m_SelViaSizeBox_Changed = TRUE;
|
||||||
|
|
||||||
|
GetScreen()->SetModify();
|
||||||
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
|
||||||
|
Affiche_Message( wxString( _("Session file imported and merged OK.")) );
|
||||||
|
|
||||||
|
DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace DSN {
|
||||||
|
|
||||||
|
// no UI code in this function, throw exception to report problems to the
|
||||||
|
// UI handler: void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
|
|
||||||
|
void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
|
||||||
|
{
|
||||||
|
wxASSERT( session );
|
||||||
|
|
||||||
|
// delete all the old tracks and vias
|
||||||
|
aBoard->m_Track->DeleteStructList();
|
||||||
|
aBoard->m_Track = NULL;
|
||||||
|
aBoard->m_NbSegmTrack = 0;
|
||||||
|
|
||||||
|
aBoard->DeleteMARKERs();
|
||||||
|
|
||||||
|
|
||||||
|
if( !session->placement )
|
||||||
|
ThrowIOError( _("Session file is missing the \"placement\" section") );
|
||||||
|
|
||||||
|
if( !session->route )
|
||||||
|
ThrowIOError( _("Session file is missing the \"routes\" section") );
|
||||||
|
|
||||||
|
if( !session->route->library )
|
||||||
|
ThrowIOError( _("Session file is missing the \"library_out\" section") );
|
||||||
|
|
||||||
|
|
||||||
|
// Walk the PLACEMENT object's components list.
|
||||||
|
COMPONENTS& components = session->placement->components;
|
||||||
|
for( COMPONENTS::iterator i=components.begin(); i!=components.end(); ++i )
|
||||||
|
{
|
||||||
|
// reposition and re-orient each component and put on correct side of the board.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk the NET_OUTs and create tracks and vias anew.
|
||||||
|
NET_OUTS& net_outs = session->route->net_outs;
|
||||||
|
for( NET_OUTS::iterator i=net_outs.begin(); i!=net_outs.end(); ++i )
|
||||||
|
{
|
||||||
|
// create a track or via and position it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace DSN
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue