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 <class_drawpanel.h> // m_canvas
36 #include <confirm.h> // DisplayError()
37 #include <gestfich.h> // EDA_FileSelector()
38 #include <wxPcbStruct.h>
39 #include <macros.h>
40 
41 #include <class_board.h>
42 #include <class_module.h>
43 #include <class_edge_mod.h>
44 #include <class_track.h>
45 #include <class_zone.h>
46 #include <class_drawsegment.h>
47 #include <connectivity_data.h>
48 #include <view/view.h>
49 
50 #include <specctra.h>
51 
52 
53 using namespace DSN;
54 
55 void PCB_EDIT_FRAME::ImportSpecctraDesign( wxCommandEvent& event )
56 {
57  /* @todo write this someday
58 
59  if( !Clear_Pcb( true ) )
60  return;
61  */
62 }
63 
64 
65 void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
66 {
67  wxString fullFileName = GetBoard()->GetFileName();
68  wxString path;
69  wxString name;
70  wxString ext;
71 
72  wxString sessionExt( wxT( ".ses" ) );
73  wxString mask = wxT( "*" ) + sessionExt;
74 
75  wxFileName::SplitPath( fullFileName, &path, &name, &ext );
76  name += sessionExt;
77 
78  fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ),
79  path,
80  name,
81  sessionExt,
82  mask,
83  this,
84  wxFD_OPEN,
85  false );
86 
87  if( fullFileName == wxEmptyString )
88  {
89  return;
90  }
91 
92  SetCurItem( NULL );
93 
94  // To avoid issues with undo/redo lists (dangling pointers)
95  // clear the lists
96  // todo: use undo/redo feature
97  GetScreen()->ClearUndoRedoList();
98 
99  SPECCTRA_DB db;
100  LOCALE_IO toggle;
101 
102  try
103  {
104  db.LoadSESSION( fullFileName );
105  db.FromSESSION( GetBoard() );
106  }
107  catch( const IO_ERROR& ioe )
108  {
109  wxString msg = _(
110  "Board may be corrupted, do not save it.\n"
111  "Fix problem and try again"
112  );
113 
114  wxString extra = ioe.What();
115 
116  DisplayErrorMessage( this, msg, extra);
117  return;
118  }
119 
120  OnModify();
121  GetBoard()->m_Status_Pcb = 0;
122 
123  GetBoard()->GetConnectivity()->Clear();
124  GetBoard()->GetConnectivity()->Build( GetBoard() );
125 
126  if( GetGalCanvas() ) // Update view:
127  {
128  auto view = GetGalCanvas()->GetView();
129 
130  // Update footprint positions
131  view->RecacheAllItems();
132 
133  // add imported tracks (previous tracks are removed, therfore all are new)
134  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
135  {
136  view->Add( track );
137  }
138  }
139 
140  SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
141 
142  Refresh();
143 }
144 
145 
146 namespace DSN {
147 
148 
157 static int scale( double distance, UNIT_RES* aResolution )
158 {
159  double resValue = aResolution->GetValue();
160  double factor;
161 
162  switch( aResolution->GetEngUnits() )
163  {
164  default:
165  case T_inch:
166  factor = 25.4e6; // nanometers per inch
167  break;
168  case T_mil:
169  factor = 25.4e3; // nanometers per mil
170  break;
171  case T_cm:
172  factor = 1e7; // nanometers per cm
173  break;
174  case T_mm:
175  factor = 1e6; // nanometers per mm
176  break;
177  case T_um:
178  factor = 1e3; // nanometers per um
179  break;
180  }
181 
182  int ret = KiROUND( factor * distance / resValue );
183 
184  return ret;
185 }
186 
187 
196 static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
197 {
198  wxPoint ret( scale( aPoint.x, aResolution ),
199  -scale( aPoint.y, aResolution ) ); // negate y
200 
201  return ret;
202 }
203 
204 
205 TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
206 {
207  int layerNdx = findLayerName( aPath->layer_id );
208 
209  if( layerNdx == -1 )
210  {
211  wxString layerName = FROM_UTF8( aPath->layer_id.c_str() );
212  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
213  GetChars( layerName ) ) );
214  }
215 
216  TRACK* track = new TRACK( sessionBoard );
217 
218  track->SetStart( mapPt( aPath->points[aPointIndex+0], routeResolution ) );
219  track->SetEnd( mapPt( aPath->points[aPointIndex+1], routeResolution ) );
220  track->SetLayer( pcbLayer2kicad[layerNdx] );
221  track->SetWidth( scale( aPath->aperture_width, routeResolution ) );
222  track->SetNetCode( aNetcode );
223 
224  return track;
225 }
226 
227 
228 ::VIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint,
229  int aNetCode, int aViaDrillDefault )
230 {
231  ::VIA* via = 0;
232  SHAPE* shape;
233 
234  int shapeCount = aPadstack->Length();
235  int drill_diam_iu = -1;
236  int copperLayerCount = sessionBoard->GetCopperLayerCount();
237 
238 
239  // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
240  // It is after the colon and before the last '_'
241  int drillStartNdx = aPadstack->padstack_id.find( ':' );
242 
243  if( drillStartNdx != -1 )
244  {
245  ++drillStartNdx; // skip over the ':'
246 
247  int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
248  if( drillEndNdx != -1 )
249  {
250  std::string diam_txt( aPadstack->padstack_id,
251  drillStartNdx, drillEndNdx-drillStartNdx );
252 
253  double drill_um = strtod( diam_txt.c_str(), 0 );
254 
255  drill_diam_iu = int( drill_um * (IU_PER_MM / 1000.0) );
256 
257  if( drill_diam_iu == aViaDrillDefault )
258  drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
259  }
260  }
261 
262  if( shapeCount == 0 )
263  {
264  THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
265  }
266  else if( shapeCount == 1 )
267  {
268  shape = (SHAPE*) (*aPadstack)[0];
269  DSN_T type = shape->shape->Type();
270  if( type != T_circle )
271  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
272  GetChars( GetTokenString( type ) ) ) );
273 
274  CIRCLE* circle = (CIRCLE*) shape->shape;
275  int viaDiam = scale( circle->diameter, routeResolution );
276 
277  via = new ::VIA( sessionBoard );
278  via->SetPosition( mapPt( aPoint, routeResolution ) );
279  via->SetDrill( drill_diam_iu );
280  via->SetViaType( VIA_THROUGH );
281  via->SetWidth( viaDiam );
282  via->SetLayerPair( F_Cu, B_Cu );
283  }
284  else if( shapeCount == copperLayerCount )
285  {
286  shape = (SHAPE*) (*aPadstack)[0];
287  DSN_T type = shape->shape->Type();
288  if( type != T_circle )
289  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
290  GetChars( GetTokenString( type ) ) ) );
291 
292  CIRCLE* circle = (CIRCLE*) shape->shape;
293  int viaDiam = scale( circle->diameter, routeResolution );
294 
295  via = new ::VIA( sessionBoard );
296  via->SetPosition( mapPt( aPoint, routeResolution ) );
297  via->SetDrill( drill_diam_iu );
298  via->SetViaType( VIA_THROUGH );
299  via->SetWidth( viaDiam );
300  via->SetLayerPair( F_Cu, B_Cu );
301  }
302  else // VIA_MICROVIA or VIA_BLIND_BURIED
303  {
304  int topLayerNdx = -1; // session layer detectors
305  int botLayerNdx = INT_MAX;
306 
307  int viaDiam = -1;
308 
309  for( int i=0; i<shapeCount; ++i )
310  {
311  shape = (SHAPE*) (*aPadstack)[i];
312  DSN_T type = shape->shape->Type();
313  if( type != T_circle )
314  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
315  GetChars( GetTokenString( type ) ) ) );
316 
317  CIRCLE* circle = (CIRCLE*) shape->shape;
318 
319  int layerNdx = findLayerName( circle->layer_id );
320  if( layerNdx == -1 )
321  {
322  wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
323  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
324  GetChars( layerName ) ) );
325  }
326 
327  if( layerNdx > topLayerNdx )
328  topLayerNdx = layerNdx;
329 
330  if( layerNdx < botLayerNdx )
331  botLayerNdx = layerNdx;
332 
333  if( viaDiam == -1 )
334  viaDiam = scale( circle->diameter, routeResolution );
335  }
336 
337  via = new ::VIA( sessionBoard );
338  via->SetPosition( mapPt( aPoint, routeResolution ) );
339  via->SetDrill( drill_diam_iu );
340 
341  if( (topLayerNdx==0 && botLayerNdx==1)
342  || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
343  via->SetViaType( VIA_MICROVIA );
344  else
345  via->SetViaType( VIA_BLIND_BURIED );
346 
347  via->SetWidth( viaDiam );
348 
349  PCB_LAYER_ID topLayer = pcbLayer2kicad[topLayerNdx];
350  PCB_LAYER_ID botLayer = pcbLayer2kicad[botLayerNdx];
351 
352  via->SetLayerPair( topLayer, botLayer );
353  }
354 
355  wxASSERT( via );
356 
357  via->SetNetCode( aNetCode );
358  return via;
359 }
360 
361 
362 // no UI code in this function, throw exception to report problems to the
363 // UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
364 
366 {
367  sessionBoard = aBoard; // not owned here
368 
369  if( !session )
370  THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
371 
372  /* Dick 16-Jan-2012: session need not have a placement section.
373  if( !session->placement )
374  THROW_IO_ERROR( _("Session file is missing the \"placement\" section") );
375  */
376 
377  if( !session->route )
378  THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
379 
380  if( !session->route->library )
381  THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
382 
383  // delete all the old tracks and vias
384  aBoard->m_Track.DeleteAll();
385 
386  aBoard->DeleteMARKERs();
387 
388  buildLayerMaps( aBoard );
389 
390  if( session->placement )
391  {
392  // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
393  // each COMPONENT, reposition and re-orient each component and put on
394  // correct side of the board.
395  COMPONENTS& components = session->placement->components;
396  for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
397  {
398  PLACES& places = comp->places;
399  for( unsigned i=0; i<places.size(); ++i )
400  {
401  PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
402 
403  wxString reference = FROM_UTF8( place->component_id.c_str() );
404  MODULE* module = aBoard->FindModuleByReference( reference );
405  if( !module )
406  {
407  THROW_IO_ERROR( wxString::Format( _("Session file has 'reference' to non-existent component \"%s\""),
408  GetChars( reference ) ) );
409  }
410 
411  if( !place->hasVertex )
412  continue;
413 
414  UNIT_RES* resolution = place->GetUnits();
415  wxASSERT( resolution );
416 
417  wxPoint newPos = mapPt( place->vertex, resolution );
418  module->SetPosition( newPos );
419 
420  if( place->side == T_front )
421  {
422  // convert from degrees to tenths of degrees used in KiCad.
423  int orientation = KiROUND( place->rotation * 10.0 );
424 
425  if( module->GetLayer() != F_Cu )
426  {
427  // module is on copper layer (back)
428  module->Flip( module->GetPosition() );
429  }
430 
431  module->SetOrientation( orientation );
432  }
433  else if( place->side == T_back )
434  {
435  int orientation = KiROUND( (place->rotation + 180.0) * 10.0 );
436 
437  if( module->GetLayer() != B_Cu )
438  {
439  // module is on component layer (front)
440  module->Flip( module->GetPosition() );
441  }
442 
443  module->SetOrientation( orientation );
444  }
445  else
446  {
447  // as I write this, the PARSER *is* catching this, so we should never see below:
448  wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
449  }
450  }
451  }
452  }
453 
455 
456  // Walk the NET_OUTs and create tracks and vias anew.
457  NET_OUTS& net_outs = session->route->net_outs;
458  for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
459  {
460  int netoutCode = 0;
461 
462  // page 143 of spec says wire's net_id is optional
463  if( net->net_id.size() )
464  {
465  wxString netName = FROM_UTF8( net->net_id.c_str() );
466  NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
467 
468  if( netinfo )
469  netoutCode = netinfo->GetNet();
470  else // else netCode remains 0
471  {
472  // int breakhere = 1;
473  }
474  }
475 
476  WIRES& wires = net->wires;
477  for( unsigned i = 0; i<wires.size(); ++i )
478  {
479  WIRE* wire = &wires[i];
480  DSN_T shape = wire->shape->Type();
481 
482  if( shape != T_path )
483  {
484  /* shape == T_polygon is expected from freerouter if you have
485  a zone on a non "power" type layer, i.e. a T_signal layer
486  and the design does a round trip back in as session here.
487  We kept our own zones in the BOARD, so ignore this so called
488  'wire'.
489 
490  wxString netId = FROM_UTF8( wire->net_id.c_str() );
491  THROW_IO_ERROR( wxString::Format( _("Unsupported wire shape: \"%s\" for net: \"%s\""),
492  DLEX::GetTokenString(shape).GetData(),
493  netId.GetData()
494  ) );
495  */
496  }
497  else
498  {
499  PATH* path = (PATH*) wire->shape;
500  for( unsigned pt=0; pt<path->points.size()-1; ++pt )
501  {
502  TRACK* track = makeTRACK( path, pt, netoutCode );
503  aBoard->Add( track );
504  }
505  }
506  }
507 
508  WIRE_VIAS& wire_vias = net->wire_vias;
509  LIBRARY& library = *session->route->library;
510  for( unsigned i=0; i<wire_vias.size(); ++i )
511  {
512  int netCode = 0;
513 
514  // page 144 of spec says wire_via's net_id is optional
515  if( net->net_id.size() )
516  {
517  wxString netName = FROM_UTF8( net->net_id.c_str() );
518  NETINFO_ITEM* netvia = aBoard->FindNet( netName );
519 
520  if( netvia )
521  netCode = netvia->GetNet();
522 
523  // else netCode remains 0
524  }
525 
526  WIRE_VIA* wire_via = &wire_vias[i];
527 
528  // example: (via Via_15:8_mil 149000 -71000 )
529 
530  PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
531  if( !padstack )
532  {
533  // Dick Feb 29, 2008:
534  // Freerouter has a bug where it will not round trip all vias.
535  // Vias which have a (use_via) element will be round tripped.
536  // Vias which do not, don't come back in in the session library,
537  // even though they may be actually used in the pre-routed,
538  // protected wire_vias. So until that is fixed, create the
539  // padstack from its name as a work around.
540 
541 
542  // Could use a STRING_FORMATTER here and convert the entire
543  // wire_via to text and put that text into the exception.
544  wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
545 
546  THROW_IO_ERROR( wxString::Format( _("A wire_via references a missing padstack \"%s\""),
547  GetChars( psid ) ) );
548  }
549 
550  NETCLASSPTR netclass = aBoard->GetDesignSettings().m_NetClasses.GetDefault();
551 
552  int via_drill_default = netclass->GetViaDrill();
553 
554  for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
555  {
556  ::VIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode, via_drill_default );
557  aBoard->Add( via );
558  }
559  }
560  }
561 }
562 
563 
564 } // namespace DSN
void LoadSESSION(const wxString &aFilename)
Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file.
Definition: specctra.cpp:262
Class VIA corresponds to the in the specctra dsn spec.
Definition: specctra.h:1011
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
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:53
This source file implements export and import capabilities to the specctra dsn file format...
Definition: specctra.cpp:62
This file is part of the common library TODO brief description.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
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:119
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3086
T
enum T contains all this lexer's tokens.
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3506
NET_OUTS net_outs
Definition: specctra.h:3422
Class BOARD to handle a board.
static POINT mapPt(const wxPoint &pt)
Function mapPt converts a KiCad point into a DSN file point.
int GetCopperLayerCount() const
Function GetCopperLayerCount.
POINTS vertexes
Definition: specctra.h:2962
Class UNIT_RES is a holder for either a T_unit or T_resolution object which are usually mutually excl...
Definition: specctra.h:401
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
int Length() const
Function Length returns the number of ELEMs in this ELEM.
Definition: specctra.h:316
Classes to handle copper zones.
double x
Definition: specctra.h:96
boost::ptr_vector< NET_OUT > NET_OUTS
Definition: specctra.h:3411
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:41
std::string layer_id
Definition: specctra.h:580
Functions relatives to tracks, vias and segments used to fill zones.
This file contains miscellaneous commonly used macros and functions.
void SetWidth(int aWidth)
Definition: class_track.h:116
POINT vertex
Definition: specctra.h:1670
Class PATH supports both the and the per the specctra dsn spec...
Definition: specctra.h:576
BOARD_ITEM * Next() const
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
PCB_LAYER_ID
A quick note on layer IDs:
DSN_T GetEngUnits() const
Definition: specctra.h:423
PADSTACK * FindPADSTACK(const std::string &aPadstackId)
Function FindPADSTACK searches the padstack container by name.
Definition: specctra.h:2388
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:87
void Refresh()
Update the board display after modifying it bu 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
const wxString & GetFileName() const
Definition: class_board.h:234
DSN_T side
Definition: specctra.h:1665
Class PLACE implements the in the specctra dsn spec.
Definition: specctra.h:1659
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
LIBRARY * library
Definition: specctra.h:3421
::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...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
std::string component_id
reference designator
Definition: specctra.h:1663
Class PADSTACK holds either a via or a pad definition.
Definition: specctra.h:2098
Class 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:60
int GetNet() const
Function GetNet.
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
std::string layer_id
Definition: specctra.h:726
SESSION * session
Definition: specctra.h:3614
BOARD * GetBoard()
Class 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
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
Class LIBRARY corresponds to the 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:92
Struct POINT is a holder for a point in the SPECCTRA DSN coordinate system.
Definition: specctra.h:94
void ImportSpecctraSession(wxCommandEvent &event)
Function ImportSpecctraSession will import a specctra *.ses file and use it to relocate MODULEs and t...
Class WIRE corresponds to in the specctra dsn spec.
Definition: specctra.h:2847
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 GetValue() const
Definition: specctra.h:424
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1732
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
POINTS points
Definition: specctra.h:583
NETCLASSPTR GetDefault() const
Function GetDefault.
static double scale(int kicadDist)
Function scale converts a distance from PCBNEW internal units to the reported specctra dsn units in f...
double aperture_width
Definition: specctra.h:581
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
std::string padstack_id
Definition: specctra.h:2104
wxString GetTokenString(int aTok)
Function GetTokenString returns a quote wrapped wxString representation of a token value...
Definition: dsnlexer.cpp:334
const char * name
ROUTE * route
Definition: specctra.h:3544
ELEM * shape
Definition: specctra.h:837
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:122
Class WIRE_VIA corresponds to 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...
DLIST< TRACK > m_Track
Definition: class_board.h:246
Module description (excepted pads)
std::vector< PCB_LAYER_ID > pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3628
DSN_T Type() const
Definition: specctra.h:231
EDGE_MODULE class definition.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3631
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:290
COMPONENTS components
Definition: specctra.h:1795
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
void ImportSpecctraDesign(wxCommandEvent &event)
Function ImportSpecctraDesign will import a specctra *.dsn file and use it to replace an entire BOARD...
double diameter
Definition: specctra.h:728
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237