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