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.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  return;
89 
90  SetCurItem( NULL );
91 
92  // To avoid issues with undo/redo lists (dangling pointers)
93  // clear the lists
94  // todo: use undo/redo feature
95  GetScreen()->ClearUndoRedoList();
96 
97  SPECCTRA_DB db;
98  LOCALE_IO toggle;
99 
100  try
101  {
102  db.LoadSESSION( fullFileName );
103  db.FromSESSION( GetBoard() );
104  }
105  catch( const IO_ERROR& ioe )
106  {
107  wxString msg = ioe.What();
108  msg += '\n';
109  msg += _("BOARD may be corrupted, do not save it.");
110  msg += '\n';
111  msg += _("Fix problem and try again.");
112 
113  DisplayError( this, msg );
114  return;
115  }
116 
117  OnModify();
118  GetBoard()->m_Status_Pcb = 0;
119 
120  GetBoard()->GetConnectivity()->Clear();
121  GetBoard()->GetConnectivity()->Build( GetBoard() );
122 
123  if( GetGalCanvas() ) // Update view:
124  {
125  auto view = GetGalCanvas()->GetView();
126 
127  // Update footprint positions
128  view->RecacheAllItems();
129 
130  // add imported tracks (previous tracks are removed, therfore all are new)
131  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
132  view->Add( track );
133  }
134 
135  SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
136 
137  Refresh();
138 }
139 
140 
141 namespace DSN {
142 
143 
152 static int scale( double distance, UNIT_RES* aResolution )
153 {
154  double resValue = aResolution->GetValue();
155  double factor;
156 
157  switch( aResolution->GetEngUnits() )
158  {
159  default:
160  case T_inch:
161  factor = 25.4e6; // nanometers per inch
162  break;
163  case T_mil:
164  factor = 25.4e3; // nanometers per mil
165  break;
166  case T_cm:
167  factor = 1e7; // nanometers per cm
168  break;
169  case T_mm:
170  factor = 1e6; // nanometers per mm
171  break;
172  case T_um:
173  factor = 1e3; // nanometers per um
174  break;
175  }
176 
177  int ret = KiROUND( factor * distance / resValue );
178 
179  return ret;
180 }
181 
182 
191 static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
192 {
193  wxPoint ret( scale( aPoint.x, aResolution ),
194  -scale( aPoint.y, aResolution ) ); // negate y
195 
196  return ret;
197 }
198 
199 
200 TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
201 {
202  int layerNdx = findLayerName( aPath->layer_id );
203 
204  if( layerNdx == -1 )
205  {
206  wxString layerName = FROM_UTF8( aPath->layer_id.c_str() );
207  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
208  GetChars( layerName ) ) );
209  }
210 
211  TRACK* track = new TRACK( sessionBoard );
212 
213  track->SetStart( mapPt( aPath->points[aPointIndex+0], routeResolution ) );
214  track->SetEnd( mapPt( aPath->points[aPointIndex+1], routeResolution ) );
215  track->SetLayer( pcbLayer2kicad[layerNdx] );
216  track->SetWidth( scale( aPath->aperture_width, routeResolution ) );
217  track->SetNetCode( aNetcode );
218 
219  return track;
220 }
221 
222 
223 ::VIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint,
224  int aNetCode, int aViaDrillDefault )
225 {
226  ::VIA* via = 0;
227  SHAPE* shape;
228 
229  int shapeCount = aPadstack->Length();
230  int drill_diam_iu = -1;
231  int copperLayerCount = sessionBoard->GetCopperLayerCount();
232 
233 
234  // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
235  // It is after the colon and before the last '_'
236  int drillStartNdx = aPadstack->padstack_id.find( ':' );
237 
238  if( drillStartNdx != -1 )
239  {
240  ++drillStartNdx; // skip over the ':'
241 
242  int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
243  if( drillEndNdx != -1 )
244  {
245  std::string diam_txt( aPadstack->padstack_id,
246  drillStartNdx, drillEndNdx-drillStartNdx );
247 
248  double drill_um = strtod( diam_txt.c_str(), 0 );
249 
250  drill_diam_iu = int( drill_um * (IU_PER_MM / 1000.0) );
251 
252  if( drill_diam_iu == aViaDrillDefault )
253  drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
254  }
255  }
256 
257  if( shapeCount == 0 )
258  {
259  THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
260  }
261  else if( shapeCount == 1 )
262  {
263  shape = (SHAPE*) (*aPadstack)[0];
264  DSN_T type = shape->shape->Type();
265  if( type != T_circle )
266  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
267  GetChars( GetTokenString( type ) ) ) );
268 
269  CIRCLE* circle = (CIRCLE*) shape->shape;
270  int viaDiam = scale( circle->diameter, routeResolution );
271 
272  via = new ::VIA( sessionBoard );
273  via->SetPosition( mapPt( aPoint, routeResolution ) );
274  via->SetDrill( drill_diam_iu );
275  via->SetViaType( VIA_THROUGH );
276  via->SetWidth( viaDiam );
277  via->SetLayerPair( F_Cu, B_Cu );
278  }
279  else if( shapeCount == copperLayerCount )
280  {
281  shape = (SHAPE*) (*aPadstack)[0];
282  DSN_T type = shape->shape->Type();
283  if( type != T_circle )
284  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
285  GetChars( GetTokenString( type ) ) ) );
286 
287  CIRCLE* circle = (CIRCLE*) shape->shape;
288  int viaDiam = scale( circle->diameter, routeResolution );
289 
290  via = new ::VIA( sessionBoard );
291  via->SetPosition( mapPt( aPoint, routeResolution ) );
292  via->SetDrill( drill_diam_iu );
293  via->SetViaType( VIA_THROUGH );
294  via->SetWidth( viaDiam );
295  via->SetLayerPair( F_Cu, B_Cu );
296  }
297  else // VIA_MICROVIA or VIA_BLIND_BURIED
298  {
299  int topLayerNdx = -1; // session layer detectors
300  int botLayerNdx = INT_MAX;
301 
302  int viaDiam = -1;
303 
304  for( int i=0; i<shapeCount; ++i )
305  {
306  shape = (SHAPE*) (*aPadstack)[i];
307  DSN_T type = shape->shape->Type();
308  if( type != T_circle )
309  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
310  GetChars( GetTokenString( type ) ) ) );
311 
312  CIRCLE* circle = (CIRCLE*) shape->shape;
313 
314  int layerNdx = findLayerName( circle->layer_id );
315  if( layerNdx == -1 )
316  {
317  wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
318  THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
319  GetChars( layerName ) ) );
320  }
321 
322  if( layerNdx > topLayerNdx )
323  topLayerNdx = layerNdx;
324 
325  if( layerNdx < botLayerNdx )
326  botLayerNdx = layerNdx;
327 
328  if( viaDiam == -1 )
329  viaDiam = scale( circle->diameter, routeResolution );
330  }
331 
332  via = new ::VIA( sessionBoard );
333  via->SetPosition( mapPt( aPoint, routeResolution ) );
334  via->SetDrill( drill_diam_iu );
335 
336  if( (topLayerNdx==0 && botLayerNdx==1)
337  || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
338  via->SetViaType( VIA_MICROVIA );
339  else
340  via->SetViaType( VIA_BLIND_BURIED );
341 
342  via->SetWidth( viaDiam );
343 
344  PCB_LAYER_ID topLayer = pcbLayer2kicad[topLayerNdx];
345  PCB_LAYER_ID botLayer = pcbLayer2kicad[botLayerNdx];
346 
347  via->SetLayerPair( topLayer, botLayer );
348  }
349 
350  wxASSERT( via );
351 
352  via->SetNetCode( aNetCode );
353  return via;
354 }
355 
356 
357 // no UI code in this function, throw exception to report problems to the
358 // UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
359 
361 {
362  sessionBoard = aBoard; // not owned here
363 
364  if( !session )
365  THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
366 
367  /* Dick 16-Jan-2012: session need not have a placement section.
368  if( !session->placement )
369  THROW_IO_ERROR( _("Session file is missing the \"placement\" section") );
370  */
371 
372  if( !session->route )
373  THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
374 
375  if( !session->route->library )
376  THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
377 
378  // delete all the old tracks and vias
379  aBoard->m_Track.DeleteAll();
380 
381  aBoard->DeleteMARKERs();
382 
383  buildLayerMaps( aBoard );
384 
385  if( session->placement )
386  {
387  // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
388  // each COMPONENT, reposition and re-orient each component and put on
389  // correct side of the board.
390  COMPONENTS& components = session->placement->components;
391  for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
392  {
393  PLACES& places = comp->places;
394  for( unsigned i=0; i<places.size(); ++i )
395  {
396  PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
397 
398  wxString reference = FROM_UTF8( place->component_id.c_str() );
399  MODULE* module = aBoard->FindModuleByReference( reference );
400  if( !module )
401  {
402  THROW_IO_ERROR( wxString::Format( _("Session file has 'reference' to non-existent component \"%s\""),
403  GetChars( reference ) ) );
404  }
405 
406  if( !place->hasVertex )
407  continue;
408 
409  UNIT_RES* resolution = place->GetUnits();
410  wxASSERT( resolution );
411 
412  wxPoint newPos = mapPt( place->vertex, resolution );
413  module->SetPosition( newPos );
414 
415  if( place->side == T_front )
416  {
417  // convert from degrees to tenths of degrees used in KiCad.
418  int orientation = KiROUND( place->rotation * 10.0 );
419 
420  if( module->GetLayer() != F_Cu )
421  {
422  // module is on copper layer (back)
423  module->Flip( module->GetPosition() );
424  }
425 
426  module->SetOrientation( orientation );
427  }
428  else if( place->side == T_back )
429  {
430  int orientation = KiROUND( (place->rotation + 180.0) * 10.0 );
431 
432  if( module->GetLayer() != B_Cu )
433  {
434  // module is on component layer (front)
435  module->Flip( module->GetPosition() );
436  }
437 
438  module->SetOrientation( orientation );
439  }
440  else
441  {
442  // as I write this, the PARSER *is* catching this, so we should never see below:
443  wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
444  }
445  }
446  }
447  }
448 
450 
451  // Walk the NET_OUTs and create tracks and vias anew.
452  NET_OUTS& net_outs = session->route->net_outs;
453  for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
454  {
455  int netoutCode = 0;
456 
457  // page 143 of spec says wire's net_id is optional
458  if( net->net_id.size() )
459  {
460  wxString netName = FROM_UTF8( net->net_id.c_str() );
461  NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
462 
463  if( netinfo )
464  netoutCode = netinfo->GetNet();
465  else // else netCode remains 0
466  {
467  // int breakhere = 1;
468  }
469  }
470 
471  WIRES& wires = net->wires;
472  for( unsigned i = 0; i<wires.size(); ++i )
473  {
474  WIRE* wire = &wires[i];
475  DSN_T shape = wire->shape->Type();
476 
477  if( shape != T_path )
478  {
479  /* shape == T_polygon is expected from freerouter if you have
480  a zone on a non "power" type layer, i.e. a T_signal layer
481  and the design does a round trip back in as session here.
482  We kept our own zones in the BOARD, so ignore this so called
483  'wire'.
484 
485  wxString netId = FROM_UTF8( wire->net_id.c_str() );
486  THROW_IO_ERROR( wxString::Format( _("Unsupported wire shape: \"%s\" for net: \"%s\""),
487  DLEX::GetTokenString(shape).GetData(),
488  netId.GetData()
489  ) );
490  */
491  }
492  else
493  {
494  PATH* path = (PATH*) wire->shape;
495  for( unsigned pt=0; pt<path->points.size()-1; ++pt )
496  {
497  TRACK* track = makeTRACK( path, pt, netoutCode );
498  aBoard->Add( track );
499  }
500  }
501  }
502 
503  WIRE_VIAS& wire_vias = net->wire_vias;
504  LIBRARY& library = *session->route->library;
505  for( unsigned i=0; i<wire_vias.size(); ++i )
506  {
507  int netCode = 0;
508 
509  // page 144 of spec says wire_via's net_id is optional
510  if( net->net_id.size() )
511  {
512  wxString netName = FROM_UTF8( net->net_id.c_str() );
513  NETINFO_ITEM* netvia = aBoard->FindNet( netName );
514 
515  if( netvia )
516  netCode = netvia->GetNet();
517 
518  // else netCode remains 0
519  }
520 
521  WIRE_VIA* wire_via = &wire_vias[i];
522 
523  // example: (via Via_15:8_mil 149000 -71000 )
524 
525  PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
526  if( !padstack )
527  {
528  // Dick Feb 29, 2008:
529  // Freerouter has a bug where it will not round trip all vias.
530  // Vias which have a (use_via) element will be round tripped.
531  // Vias which do not, don't come back in in the session library,
532  // even though they may be actually used in the pre-routed,
533  // protected wire_vias. So until that is fixed, create the
534  // padstack from its name as a work around.
535 
536 
537  // Could use a STRING_FORMATTER here and convert the entire
538  // wire_via to text and put that text into the exception.
539  wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
540 
541  THROW_IO_ERROR( wxString::Format( _("A wire_via references a missing padstack \"%s\""),
542  GetChars( psid ) ) );
543  }
544 
545  NETCLASSPTR netclass = aBoard->GetDesignSettings().m_NetClasses.GetDefault();
546 
547  int via_drill_default = netclass->GetViaDrill();
548 
549  for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
550  {
551  ::VIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode, via_drill_default );
552  aBoard->Add( via );
553  }
554  }
555  }
556 }
557 
558 
559 } // 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:1008
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:117
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3083
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:3502
NET_OUTS net_outs
Definition: specctra.h:3419
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:2959
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:3408
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:114
POINT vertex
Definition: specctra.h:1667
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:1664
bool hasVertex
Definition: specctra.h:1666
ELEM * shape
Definition: specctra.h:2855
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:3441
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:2385
void Refresh()
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1781
const wxString & GetFileName() const
Definition: class_board.h:234
DSN_T side
Definition: specctra.h:1662
Class PLACE implements the in the specctra dsn spec.
Definition: specctra.h:1656
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:3418
::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:533
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
std::string component_id
reference designator
Definition: specctra.h:1660
Class PADSTACK holds either a via or a pad definition.
Definition: specctra.h:2095
#define THROW_IO_ERROR(x)
Definition: utf8.cpp:60
Class SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3604
#define UNDEFINED_DRILL_DIAMETER
Definition: class_track.h:58
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:3611
BOARD * GetBoard()
Class SHAPE corresponds to the "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1860
PLACEMENT * placement
Definition: specctra.h:3539
const std::string & GetPadstackId()
Definition: specctra.h:2979
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:2228
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:2844
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:1729
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:2101
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:3541
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:3631
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2947
void SetStart(const wxPoint &aStart)
Definition: class_track.h:120
Class WIRE_VIA corresponds to in the specctra dsn spec.
Definition: specctra.h:2954
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:3625
DSN_T Type() const
Definition: specctra.h:231
EDGE_MODULE class definition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3628
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:1792
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