KiCad PCB EDA Suite
specctra_export.cpp File Reference
#include <pcb_edit_frame.h>
#include <confirm.h>
#include <gestfich.h>
#include <locale_io.h>
#include <macros.h>
#include <math/util.h>
#include <set>
#include <map>
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <fp_shape.h>
#include <pcb_track.h>
#include <pad.h>
#include <zone.h>
#include <base_units.h>
#include <collectors.h>
#include <geometry/shape_poly_set.h>
#include <geometry/convex_hull.h>
#include <convert_basic_shapes_to_polygon.h>
#include <geometry/geometry_utils.h>
#include <pcbnew_settings.h>
#include <wx/log.h>
#include "specctra.h"

Go to the source code of this file.


namespace  DSN
 This source file implements export and import capabilities to the specctra dsn file format.




typedef std::map< wxString, int > DSN::PINMAP
 data type used to ensure unique-ness of pin names, holding (wxString and int) More...
typedef std::set< std::string > DSN::STRINGSET
typedef std::pair< STRINGSET::iterator, bool > DSN::STRINGSET_PAIR


void ExportBoardToSpecctraFile (BOARD *aBoard, const wxString &aFullFilename)
 Helper method to export board to DSN file. More...
static double DSN::scale (int kicadDist)
 Convert a distance from Pcbnew internal units to the reported Specctra DSN units in floating point format. More...
static double DSN::IU2um (int kicadDist)
static double DSN::mapX (int x)
static double DSN::mapY (int y)
static POINT DSN::mapPt (const VECTOR2I &pt)
 Convert a KiCad point into a DSN file point. More...
static bool DSN::isRoundKeepout (PAD *aPad)
 Decide if the pad is a copper-less through hole which needs to be made into a round keepout. More...
static PATHDSN::makePath (const POINT &aStart, const POINT &aEnd, const std::string &aLayerName)
 Create a PATH element with a single straight line, a pair of vertices. More...


static const double safetyMargin = 0.1

Macro Definition Documentation



Definition at line 70 of file specctra_export.cpp.

Function Documentation

◆ ExportBoardToSpecctraFile()

void ExportBoardToSpecctraFile ( BOARD aBoard,
const wxString &  aFullFilename 

Helper method to export board to DSN file.

aBoardboard object
aFullFilenamespecctra file name

Definition at line 114 of file specctra_export.cpp.

118 db.SetPCB( SPECCTRA_DB::MakePCB() );
120 LOCALE_IO toggle; // Switch the locale to standard C
122 // Build the board outlines *before* flipping footprints
123 if( !db.BuiltBoardOutlines( aBoard ) )
124 wxLogWarning( _( "Board outline is malformed. Run DRC for a full analysis." ) );
126 // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the top view. So we
127 // temporarily flip any footprints which are on the back side of the board to the front,
128 // and record this in the FOOTPRINT's flag field.
129 db.FlipFOOTPRINTs( aBoard );
131 try
132 {
133 aBoard->SynchronizeNetsAndNetClasses( false );
134 db.FromBOARD( aBoard );
135 db.ExportPCB( aFullFilename, true );
136 db.RevertFOOTPRINTs( aBoard );
138 // if an exception is thrown by FromBOARD() or ExportPCB(), then ~SPECCTRA_DB() will
139 // close the file.
140 }
141 catch( ... )
142 {
143 db.RevertFOOTPRINTs( aBoard );
144 throw;
145 }
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1524
A DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3648
void ExportPCB(const wxString &aFilename, bool aNameChange=false)
Write the internal PCB instance out as a SPECTRA DSN format file.
Definition: specctra.cpp:3697
void FlipFOOTPRINTs(BOARD *aBoard)
Flip the footprints which are on the back side of the board to the front.
void SetPCB(PCB *aPcb)
Delete any existing PCB and replaces it with the given one.
Definition: specctra.h:3688
bool BuiltBoardOutlines(BOARD *aBoard)
Build the board outlines and store it in m_brd_outlines.
void FromBOARD(BOARD *aBoard)
Add the entire BOARD to the PCB but does not write it out.
void RevertFOOTPRINTs(BOARD *aBoard)
Flip the footprints which were on the back side of the board back to the back.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
#define _(s)

References _, DSN::SPECCTRA_DB::BuiltBoardOutlines(), DSN::SPECCTRA_DB::ExportPCB(), DSN::SPECCTRA_DB::FlipFOOTPRINTs(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::RevertFOOTPRINTs(), DSN::SPECCTRA_DB::SetPCB(), and BOARD::SynchronizeNetsAndNetClasses().

Referenced by ExportSpecctraDSN(), and PCB_EDIT_FRAME::ExportSpecctraFile().

Variable Documentation

◆ safetyMargin

const double safetyMargin = 0.1