KiCad PCB EDA Suite
specctra_import.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 
26 /* This source is a complement to specctra.cpp and implements the import of
27  a specctra session file (*.ses), and import of a specctra design file
28  (*.dsn) file. The specification for the grammar of the specctra dsn file
29  used to develop this code is given here:
30  http://tech.groups.yahoo.com/group/kicad-users/files/ then file "specctra.pdf"
31  Also see the comments at the top of the specctra.cpp file itself.
32 */
33 
34 
35 #include <confirm.h> // DisplayError()
36 #include <gestfich.h> // EDA_FileSelector()
37 #include <pcb_edit_frame.h>
38 #include <macros.h>
39 #include <class_board.h>
40 #include <class_module.h>
41 #include <class_edge_mod.h>
42 #include <class_track.h>
43 #include <class_zone.h>
44 #include <class_drawsegment.h>
46 #include <view/view.h>
47 #include "specctra.h"
48 #include <math/util.h> // for KiROUND
49 
50 using namespace DSN;
51 
52 
53 bool PCB_EDIT_FRAME::ImportSpecctraSession( const wxString& fullFileName )
54 {
55  // To avoid issues with undo/redo lists (dangling pointers)
56  // clear the lists
57  // todo: use undo/redo feature
58  GetScreen()->ClearUndoRedoList();
59 
60  SPECCTRA_DB db;
61  LOCALE_IO toggle;
62 
63  try
64  {
65  db.LoadSESSION( fullFileName );
66  db.FromSESSION( GetBoard() );
67  }
68  catch( const IO_ERROR& ioe )
69  {
70  wxString msg = _( "Board may be corrupted, do not save it.\n Fix problem and try again" );
71 
72  wxString extra = ioe.What();
73 
74  DisplayErrorMessage( this, msg, extra);
75  return false;
76  }
77 
78  OnModify();
79 
80  GetBoard()->GetConnectivity()->Clear();
81  GetBoard()->GetConnectivity()->Build( GetBoard() );
82 
83  if( GetCanvas() ) // Update view:
84  {
85  // Update footprint positions
86  GetCanvas()->GetView()->RecacheAllItems();
87 
88  // add imported tracks (previous tracks are removed, therfore all are new)
89  for( auto track : GetBoard()->Tracks() )
90  GetCanvas()->GetView()->Add( track );
91  }
92 
93  SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
94 
95  Refresh();
96 
97  return true;
98 }
99 
100 
101 namespace DSN {
102 
103 
112 static int scale( double distance, UNIT_RES* aResolution )
113 {
114  double resValue = aResolution->GetValue();
115  double factor;
116 
117  switch( aResolution->GetEngUnits() )
118  {
119  default:
120  case T_inch:
121  factor = 25.4e6; // nanometers per inch
122  break;
123  case T_mil:
124  factor = 25.4e3; // nanometers per mil
125  break;
126  case T_cm:
127  factor = 1e7; // nanometers per cm
128  break;
129  case T_mm:
130  factor = 1e6; // nanometers per mm
131  break;
132  case T_um:
133  factor = 1e3; // nanometers per um
134  break;
135  }
136 
137  int ret = KiROUND( factor * distance / resValue );
138 
139  return ret;
140 }
141 
142 
151 static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
152 {
153  wxPoint ret( scale( aPoint.x, aResolution ),
154  -scale( aPoint.y, aResolution ) ); // negate y
155 
156  return ret;
157 }
158 
159 
160 TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
161 {
162  int layerNdx = findLayerName( aPath->layer_id );
163 
164  if( layerNdx == -1 )
165  {
166  wxString layerName = FROM_UTF8( aPath->layer_id.c_str() );
167  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
168  GetChars( layerName ) ) );
169  }
170 
171  TRACK* track = new TRACK( sessionBoard );
172 
173  track->SetStart( mapPt( aPath->points[aPointIndex+0], routeResolution ) );
174  track->SetEnd( mapPt( aPath->points[aPointIndex+1], routeResolution ) );
175  track->SetLayer( pcbLayer2kicad[layerNdx] );
176  track->SetWidth( scale( aPath->aperture_width, routeResolution ) );
177  track->SetNetCode( aNetcode );
178 
179  return track;
180 }
181 
182 
183 ::VIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint,
184  int aNetCode, int aViaDrillDefault )
185 {
186  ::VIA* via = 0;
187  SHAPE* shape;
188 
189  int shapeCount = aPadstack->Length();
190  int drill_diam_iu = -1;
191  int copperLayerCount = sessionBoard->GetCopperLayerCount();
192 
193 
194  // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
195  // It is after the colon and before the last '_'
196  int drillStartNdx = aPadstack->padstack_id.find( ':' );
197 
198  if( drillStartNdx != -1 )
199  {
200  ++drillStartNdx; // skip over the ':'
201 
202  int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
203  if( drillEndNdx != -1 )
204  {
205  std::string diam_txt( aPadstack->padstack_id,
206  drillStartNdx, drillEndNdx-drillStartNdx );
207 
208  double drill_um = strtod( diam_txt.c_str(), 0 );
209 
210  drill_diam_iu = int( drill_um * (IU_PER_MM / 1000.0) );
211 
212  if( drill_diam_iu == aViaDrillDefault )
213  drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
214  }
215  }
216 
217  if( shapeCount == 0 )
218  {
219  THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
220  }
221  else if( shapeCount == 1 )
222  {
223  shape = (SHAPE*) (*aPadstack)[0];
224  DSN_T type = shape->shape->Type();
225  if( type != T_circle )
226  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
227  GetChars( GetTokenString( type ) ) ) );
228 
229  CIRCLE* circle = (CIRCLE*) shape->shape;
230  int viaDiam = scale( circle->diameter, routeResolution );
231 
232  via = new ::VIA( sessionBoard );
233  via->SetPosition( mapPt( aPoint, routeResolution ) );
234  via->SetDrill( drill_diam_iu );
235  via->SetViaType( VIATYPE::THROUGH );
236  via->SetWidth( viaDiam );
237  via->SetLayerPair( F_Cu, B_Cu );
238  }
239  else if( shapeCount == copperLayerCount )
240  {
241  shape = (SHAPE*) (*aPadstack)[0];
242  DSN_T type = shape->shape->Type();
243  if( type != T_circle )
244  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
245  GetChars( GetTokenString( type ) ) ) );
246 
247  CIRCLE* circle = (CIRCLE*) shape->shape;
248  int viaDiam = scale( circle->diameter, routeResolution );
249 
250  via = new ::VIA( sessionBoard );
251  via->SetPosition( mapPt( aPoint, routeResolution ) );
252  via->SetDrill( drill_diam_iu );
253  via->SetViaType( VIATYPE::THROUGH );
254  via->SetWidth( viaDiam );
255  via->SetLayerPair( F_Cu, B_Cu );
256  }
257  else // VIA_MICROVIA or VIA_BLIND_BURIED
258  {
259  int topLayerNdx = -1; // session layer detectors
260  int botLayerNdx = INT_MAX;
261 
262  int viaDiam = -1;
263 
264  for( int i=0; i<shapeCount; ++i )
265  {
266  shape = (SHAPE*) (*aPadstack)[i];
267  DSN_T type = shape->shape->Type();
268  if( type != T_circle )
269  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
270  GetChars( GetTokenString( type ) ) ) );
271 
272  CIRCLE* circle = (CIRCLE*) shape->shape;
273 
274  int layerNdx = findLayerName( circle->layer_id );
275  if( layerNdx == -1 )
276  {
277  wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
278  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
279  GetChars( layerName ) ) );
280  }
281 
282  if( layerNdx > topLayerNdx )
283  topLayerNdx = layerNdx;
284 
285  if( layerNdx < botLayerNdx )
286  botLayerNdx = layerNdx;
287 
288  if( viaDiam == -1 )
289  viaDiam = scale( circle->diameter, routeResolution );
290  }
291 
292  via = new ::VIA( sessionBoard );
293  via->SetPosition( mapPt( aPoint, routeResolution ) );
294  via->SetDrill( drill_diam_iu );
295 
296  if( (topLayerNdx==0 && botLayerNdx==1)
297  || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
298  via->SetViaType( VIATYPE::MICROVIA );
299  else
300  via->SetViaType( VIATYPE::BLIND_BURIED );
301 
302  via->SetWidth( viaDiam );
303 
304  PCB_LAYER_ID topLayer = pcbLayer2kicad[topLayerNdx];
305  PCB_LAYER_ID botLayer = pcbLayer2kicad[botLayerNdx];
306 
307  via->SetLayerPair( topLayer, botLayer );
308  }
309 
310  wxASSERT( via );
311 
312  via->SetNetCode( aNetCode );
313  return via;
314 }
315 
316 
317 // no UI code in this function, throw exception to report problems to the
318 // UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
319 
321 {
322  sessionBoard = aBoard; // not owned here
323 
324  if( !session )
325  THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
326 
327  /* Dick 16-Jan-2012: session need not have a placement section.
328  if( !session->placement )
329  THROW_IO_ERROR( _("Session file is missing the \"placement\" section") );
330  */
331 
332  if( !session->route )
333  THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
334 
335  if( !session->route->library )
336  THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
337 
338  // delete all the old tracks and vias
339  aBoard->Tracks().clear();
340 
341  aBoard->DeleteMARKERs();
342 
343  buildLayerMaps( aBoard );
344 
345  if( session->placement )
346  {
347  // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
348  // each COMPONENT, reposition and re-orient each component and put on
349  // correct side of the board.
350  COMPONENTS& components = session->placement->components;
351  for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
352  {
353  PLACES& places = comp->places;
354  for( unsigned i=0; i<places.size(); ++i )
355  {
356  PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
357 
358  wxString reference = FROM_UTF8( place->component_id.c_str() );
359  MODULE* module = aBoard->FindModuleByReference( reference );
360  if( !module )
361  {
362  THROW_IO_ERROR( wxString::Format( _("Session file has 'reference' to non-existent symbol \"%s\""),
363  GetChars( reference ) ) );
364  }
365 
366  if( !place->hasVertex )
367  continue;
368 
369  UNIT_RES* resolution = place->GetUnits();
370  wxASSERT( resolution );
371 
372  wxPoint newPos = mapPt( place->vertex, resolution );
373  module->SetPosition( newPos );
374 
375  if( place->side == T_front )
376  {
377  // convert from degrees to tenths of degrees used in KiCad.
378  int orientation = KiROUND( place->rotation * 10.0 );
379 
380  if( module->GetLayer() != F_Cu )
381  {
382  // module is on copper layer (back)
383  module->Flip( module->GetPosition(),
384  aBoard->GeneralSettings().m_FlipLeftRight );
385  }
386 
387  module->SetOrientation( orientation );
388  }
389  else if( place->side == T_back )
390  {
391  int orientation = KiROUND( (place->rotation + 180.0) * 10.0 );
392 
393  if( module->GetLayer() != B_Cu )
394  {
395  // module is on component layer (front)
396  module->Flip( module->GetPosition(),
397  aBoard->GeneralSettings().m_FlipLeftRight );
398  }
399 
400  module->SetOrientation( orientation );
401  }
402  else
403  {
404  // as I write this, the PARSER *is* catching this, so we should never see below:
405  wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
406  }
407  }
408  }
409  }
410 
412 
413  // Walk the NET_OUTs and create tracks and vias anew.
414  NET_OUTS& net_outs = session->route->net_outs;
415  for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
416  {
417  int netoutCode = 0;
418 
419  // page 143 of spec says wire's net_id is optional
420  if( net->net_id.size() )
421  {
422  wxString netName = FROM_UTF8( net->net_id.c_str() );
423  NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
424 
425  if( netinfo )
426  netoutCode = netinfo->GetNet();
427  else // else netCode remains 0
428  {
429  // int breakhere = 1;
430  }
431  }
432 
433  WIRES& wires = net->wires;
434  for( unsigned i = 0; i<wires.size(); ++i )
435  {
436  WIRE* wire = &wires[i];
437  DSN_T shape = wire->shape->Type();
438 
439  if( shape != T_path )
440  {
441  /* shape == T_polygon is expected from freerouter if you have
442  a zone on a non "power" type layer, i.e. a T_signal layer
443  and the design does a round trip back in as session here.
444  We kept our own zones in the BOARD, so ignore this so called
445  'wire'.
446 
447  wxString netId = FROM_UTF8( wire->net_id.c_str() );
448  THROW_IO_ERROR( wxString::Format( _("Unsupported wire shape: \"%s\" for net: \"%s\""),
449  DLEX::GetTokenString(shape).GetData(),
450  netId.GetData()
451  ) );
452  */
453  }
454  else
455  {
456  PATH* path = (PATH*) wire->shape;
457  for( unsigned pt=0; pt<path->points.size()-1; ++pt )
458  {
459  TRACK* track = makeTRACK( path, pt, netoutCode );
460  aBoard->Add( track );
461  }
462  }
463  }
464 
465  WIRE_VIAS& wire_vias = net->wire_vias;
466  LIBRARY& library = *session->route->library;
467  for( unsigned i=0; i<wire_vias.size(); ++i )
468  {
469  int netCode = 0;
470 
471  // page 144 of spec says wire_via's net_id is optional
472  if( net->net_id.size() )
473  {
474  wxString netName = FROM_UTF8( net->net_id.c_str() );
475  NETINFO_ITEM* netvia = aBoard->FindNet( netName );
476 
477  if( netvia )
478  netCode = netvia->GetNet();
479 
480  // else netCode remains 0
481  }
482 
483  WIRE_VIA* wire_via = &wire_vias[i];
484 
485  // example: (via Via_15:8_mil 149000 -71000 )
486 
487  PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
488  if( !padstack )
489  {
490  // Dick Feb 29, 2008:
491  // Freerouter has a bug where it will not round trip all vias.
492  // Vias which have a (use_via) element will be round tripped.
493  // Vias which do not, don't come back in in the session library,
494  // even though they may be actually used in the pre-routed,
495  // protected wire_vias. So until that is fixed, create the
496  // padstack from its name as a work around.
497 
498 
499  // Could use a STRING_FORMATTER here and convert the entire
500  // wire_via to text and put that text into the exception.
501  wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
502 
503  THROW_IO_ERROR( wxString::Format( _("A wire_via references a missing padstack \"%s\""),
504  GetChars( psid ) ) );
505  }
506 
507  NETCLASSPTR netclass = aBoard->GetDesignSettings().m_NetClasses.GetDefault();
508 
509  int via_drill_default = netclass->GetViaDrill();
510 
511  for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
512  {
513  ::VIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode, via_drill_default );
514  aBoard->Add( via );
515  }
516  }
517  }
518 }
519 
520 
521 } // namespace DSN
void LoadSESSION(const wxString &aFilename)
Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file.
Definition: specctra.cpp:262
VIA corresponds to the <via_descriptor> in the specctra dsn spec.
Definition: specctra.h:1011
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
TRACK * makeTRACK(PATH *aPath, int aPointIndex, int aNetcode)
Function makeTRACK creates a TRACK form the PATH and BOARD info.
void buildLayerMaps(BOARD *aBoard)
Function buildLayerMaps creates a few data translation structures for layer name and number mapping b...
Definition: specctra.cpp:74
DSN::T DSN_T
Definition: specctra.h:47
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:62
This source file implements export and import capabilities to the specctra dsn file format.
Definition: specctra.cpp:62
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:249
This file is part of the common library TODO brief description.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:90
double y
Definition: specctra.h:97
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
This file is part of the common library.
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:105
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3086
NET_OUTS net_outs
Definition: specctra.h:3422
static POINT mapPt(const wxPoint &pt)
Function mapPt converts a KiCad point into a DSN file point.
POINTS vertexes
Definition: specctra.h:2962
UNIT_RES is a holder for either a T_unit or T_resolution object which are usually mutually exclusive ...
Definition: specctra.h:401
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
double x
Definition: specctra.h:96
boost::ptr_vector< NET_OUT > NET_OUTS
Definition: specctra.h:3411
DSN_T GetEngUnits() const
Definition: specctra.h:423
std::string layer_id
Definition: specctra.h:580
int GetValue() const
Definition: specctra.h:424
Definitions for tracks, vias and zones.
This file contains miscellaneous commonly used macros and functions.
void SetWidth(int aWidth)
Definition: class_track.h:102
POINT vertex
Definition: specctra.h:1670
int findLayerName(const std::string &aLayerName) const
Function findLayerName returns the PCB layer index for a given layer name, within the specctra sessio...
Definition: specctra.cpp:124
PATH supports both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
Definition: specctra.h:576
double rotation
Definition: specctra.h:1667
bool hasVertex
Definition: specctra.h:1669
ELEM * shape
Definition: specctra.h:2858
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:3444
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
PCB_LAYER_ID
A quick note on layer IDs:
PADSTACK * FindPADSTACK(const std::string &aPadstackId)
Function FindPADSTACK searches the padstack container by name.
Definition: specctra.h:2388
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1784
DSN_T side
Definition: specctra.h:1665
PLACE implements the <placement_reference> in the specctra dsn spec.
Definition: specctra.h:1659
LIBRARY * library
Definition: specctra.h:3421
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:300
::VIA * makeVIA(PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault)
Function makeVIA instantiates a KiCad VIA on the heap and initializes it with internal values consist...
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
std::string component_id
reference designator
Definition: specctra.h:1663
PADSTACK holds either a via or a pad definition.
Definition: specctra.h:2098
#define THROW_IO_ERROR(msg)
SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3607
#define UNDEFINED_DRILL_DIAMETER
Definition: class_track.h:69
std::string layer_id
Definition: specctra.h:726
SESSION * session
Definition: specctra.h:3614
BOARD * GetBoard()
SHAPE corresponds to the "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1863
PLACEMENT * placement
Definition: specctra.h:3542
const std::string & GetPadstackId()
Definition: specctra.h:2982
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
bool ImportSpecctraSession(const wxString &aFullFilename)
Function ImportSpecctraSession will import a specctra *.ses file and use it to relocate MODULEs and t...
LIBRARY corresponds to the <library_descriptor> in the specctra dsn specification.
Definition: specctra.h:2231
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
Struct POINT is a holder for a point in the SPECCTRA DSN coordinate system.
Definition: specctra.h:94
WIRE corresponds to <wire_shape_descriptor> in the specctra dsn spec.
Definition: specctra.h:2847
const PCB_GENERAL_SETTINGS & GeneralSettings() const
Definition: class_board.h:562
Class to handle a graphic segment.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int GetNet() const
Function GetNet.
Definition: netinfo.h:225
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1732
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
DSN_T Type() const
Definition: specctra.h:231
POINTS points
Definition: specctra.h:583
#define _(s)
Definition: 3d_actions.cpp:31
int GetCopperLayerCount() const
Function GetCopperLayerCount.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
static double scale(int kicadDist)
Function scale converts a distance from PCBNEW internal units to the reported specctra dsn units in f...
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
double aperture_width
Definition: specctra.h:581
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
std::string padstack_id
Definition: specctra.h:2104
ROUTE * route
Definition: specctra.h:3544
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3506
ELEM * shape
Definition: specctra.h:837
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:268
BOARD * sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3634
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2950
void SetStart(const wxPoint &aStart)
Definition: class_track.h:108
WIRE_VIA corresponds to <wire_via_descriptor> in the specctra dsn spec.
Definition: specctra.h:2957
void FromSESSION(BOARD *aBoard)
Function FromSESSION adds the entire SESSION info to a BOARD but does not write it out.
Module description (excepted pads)
std::vector< PCB_LAYER_ID > pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3628
EDGE_MODULE class definition.
int Length() const
Function Length returns the number of ELEMs in this ELEM.
Definition: specctra.h:316
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3631
COMPONENTS components
Definition: specctra.h:1795
TRACKS & Tracks()
Definition: class_board.h:217
double diameter
Definition: specctra.h:728