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 <[email protected]>
5  * Copyright (C) 2007-2022 KiCad Developers, see AUTHORS.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 <locale_io.h>
39 #include <macros.h>
40 #include <board.h>
41 #include <board_design_settings.h>
42 #include <footprint.h>
43 #include <pcb_track.h>
45 #include <view/view.h>
46 #include "specctra.h"
47 #include <math/util.h> // for KiROUND
48 #include <pcbnew_settings.h>
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  ClearUndoRedoList();
59 
60  // Remove existing tracks from view. They will be readded later after loading
61  // new tracks.
62  if( GetCanvas() ) // clear view:
63  {
64  for( PCB_TRACK* track : GetBoard()->Tracks() )
65  GetCanvas()->GetView()->Remove( track );
66  }
67 
68  SPECCTRA_DB db;
69  LOCALE_IO toggle;
70 
71  try
72  {
73  db.LoadSESSION( fullFileName );
74  db.FromSESSION( GetBoard() );
75  }
76  catch( const IO_ERROR& ioe )
77  {
78  wxString msg = _( "Board may be corrupted, do not save it.\n Fix problem and try again" );
79 
80  wxString extra = ioe.What();
81 
82  DisplayErrorMessage( this, msg, extra);
83  return false;
84  }
85 
86  OnModify();
87 
88  GetBoard()->GetConnectivity()->Clear();
89  GetBoard()->GetConnectivity()->Build( GetBoard() );
90 
91  if( GetCanvas() ) // Update view:
92  {
93  // Update footprint positions
94  GetCanvas()->GetView()->RecacheAllItems();
95 
96  // add imported tracks (previous tracks are removed, therfore all are new)
97  for( auto track : GetBoard()->Tracks() )
98  GetCanvas()->GetView()->Add( track );
99  }
100 
101  SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
102 
103  Refresh();
104 
105  return true;
106 }
107 
108 
109 namespace DSN {
110 
111 
120 static int scale( double distance, UNIT_RES* aResolution )
121 {
122  double resValue = aResolution->GetValue();
123  double factor;
124 
125  switch( aResolution->GetEngUnits() )
126  {
127  default:
128  case T_inch:
129  factor = 25.4e6; // nanometers per inch
130  break;
131  case T_mil:
132  factor = 25.4e3; // nanometers per mil
133  break;
134  case T_cm:
135  factor = 1e7; // nanometers per cm
136  break;
137  case T_mm:
138  factor = 1e6; // nanometers per mm
139  break;
140  case T_um:
141  factor = 1e3; // nanometers per um
142  break;
143  }
144 
145  int ret = KiROUND( factor * distance / resValue );
146 
147  return ret;
148 }
149 
150 
159 static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
160 {
161  wxPoint ret( scale( aPoint.x, aResolution ),
162  -scale( aPoint.y, aResolution ) ); // negate y
163 
164  return ret;
165 }
166 
167 
168 PCB_TRACK* SPECCTRA_DB::makeTRACK( WIRE* wire, PATH* aPath, int aPointIndex, int aNetcode )
169 {
170  int layerNdx = findLayerName( aPath->layer_id );
171 
172  if( layerNdx == -1 )
173  {
174  THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'." ),
175  FROM_UTF8( aPath->layer_id.c_str() ) ) );
176  }
177 
178  PCB_TRACK* track = new PCB_TRACK( m_sessionBoard );
179 
180  track->SetStart( mapPt( aPath->points[aPointIndex+0], m_routeResolution ) );
181  track->SetEnd( mapPt( aPath->points[aPointIndex+1], m_routeResolution ) );
182  track->SetLayer( m_pcbLayer2kicad[layerNdx] );
183  track->SetWidth( scale( aPath->aperture_width, m_routeResolution ) );
184  track->SetNetCode( aNetcode );
185 
186  // a track can be locked.
187  // However specctra as 4 types, none is exactly the same as our locked option
188  // wire->wire_type = T_fix, T_route, T_normal or T_protect
189  // fix and protect could be used as lock option
190  // but protect is returned for all tracks having initially the route or protect property
191  if( wire->wire_type == T_fix )
192  track->SetLocked( true );
193 
194  return track;
195 }
196 
197 
198 PCB_VIA* SPECCTRA_DB::makeVIA( WIRE_VIA*aVia, PADSTACK* aPadstack, const POINT& aPoint, int aNetCode,
199  int aViaDrillDefault )
200 {
201  PCB_VIA* via = 0;
202  SHAPE* shape;
203  int shapeCount = aPadstack->Length();
204  int drill_diam_iu = -1;
205  int copperLayerCount = m_sessionBoard->GetCopperLayerCount();
206 
207 
208  // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
209  // It is after the colon and before the last '_'
210  int drillStartNdx = aPadstack->padstack_id.find( ':' );
211 
212  if( drillStartNdx != -1 )
213  {
214  ++drillStartNdx; // skip over the ':'
215 
216  int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
217  if( drillEndNdx != -1 )
218  {
219  std::string diam_txt( aPadstack->padstack_id,
220  drillStartNdx, drillEndNdx-drillStartNdx );
221 
222  double drill_um = strtod( diam_txt.c_str(), 0 );
223 
224  drill_diam_iu = int( drill_um * (IU_PER_MM / 1000.0) );
225 
226  if( drill_diam_iu == aViaDrillDefault )
227  drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
228  }
229  }
230 
231  if( shapeCount == 0 )
232  {
233  THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
234  }
235  else if( shapeCount == 1 )
236  {
237  shape = (SHAPE*) (*aPadstack)[0];
238  DSN_T type = shape->shape->Type();
239 
240  if( type != T_circle )
241  {
242  THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s." ),
243  GetTokenString( type ) ) );
244  }
245 
246  CIRCLE* circle = (CIRCLE*) shape->shape;
247  int viaDiam = scale( circle->diameter, m_routeResolution );
248 
249  via = new PCB_VIA( m_sessionBoard );
250  via->SetPosition( mapPt( aPoint, m_routeResolution ) );
251  via->SetDrill( drill_diam_iu );
252  via->SetViaType( VIATYPE::THROUGH );
253  via->SetWidth( viaDiam );
254  via->SetLayerPair( F_Cu, B_Cu );
255  }
256  else if( shapeCount == copperLayerCount )
257  {
258  shape = (SHAPE*) (*aPadstack)[0];
259  DSN_T type = shape->shape->Type();
260  if( type != T_circle )
262  wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
263 
264  CIRCLE* circle = (CIRCLE*) shape->shape;
265  int viaDiam = scale( circle->diameter, m_routeResolution );
266 
267  via = new PCB_VIA( m_sessionBoard );
268  via->SetPosition( mapPt( aPoint, m_routeResolution ) );
269  via->SetDrill( drill_diam_iu );
270  via->SetViaType( VIATYPE::THROUGH );
271  via->SetWidth( viaDiam );
272  via->SetLayerPair( F_Cu, B_Cu );
273  }
274  else // VIA_MICROVIA or VIA_BLIND_BURIED
275  {
276  int topLayerNdx = -1; // session layer detectors
277  int botLayerNdx = INT_MAX;
278 
279  int viaDiam = -1;
280 
281  for( int i=0; i<shapeCount; ++i )
282  {
283  shape = (SHAPE*) (*aPadstack)[i];
284  DSN_T type = shape->shape->Type();
285  if( type != T_circle )
287  _( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
288 
289  CIRCLE* circle = (CIRCLE*) shape->shape;
290 
291  int layerNdx = findLayerName( circle->layer_id );
292  if( layerNdx == -1 )
293  {
294  wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
296  _( "Session file uses invalid layer id \"%s\"" ), layerName ) );
297  }
298 
299  if( layerNdx > topLayerNdx )
300  topLayerNdx = layerNdx;
301 
302  if( layerNdx < botLayerNdx )
303  botLayerNdx = layerNdx;
304 
305  if( viaDiam == -1 )
306  viaDiam = scale( circle->diameter, m_routeResolution );
307  }
308 
309  via = new PCB_VIA( m_sessionBoard );
310  via->SetPosition( mapPt( aPoint, m_routeResolution ) );
311  via->SetDrill( drill_diam_iu );
312 
313  if( (topLayerNdx==0 && botLayerNdx==1)
314  || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
315  via->SetViaType( VIATYPE::MICROVIA );
316  else
317  via->SetViaType( VIATYPE::BLIND_BURIED );
318 
319  via->SetWidth( viaDiam );
320 
321  PCB_LAYER_ID topLayer = m_pcbLayer2kicad[topLayerNdx];
322  PCB_LAYER_ID botLayer = m_pcbLayer2kicad[botLayerNdx];
323 
324  via->SetLayerPair( topLayer, botLayer );
325  }
326 
327  wxASSERT( via );
328 
329  via->SetNetCode( aNetCode );
330 
331  // a via can be locked.
332  // However specctra as 4 types, none is exactly the same as our locked option
333  // aVia->via_type = T_fix, T_route, T_normal or T_protect
334  // fix and protect could be used as lock option
335  // but protect is returned for all tracks having initially the route or protect property
336  if( aVia->via_type == T_fix )
337  via->SetLocked( true );
338 
339  return via;
340 }
341 
342 
343 // no UI code in this function, throw exception to report problems to the
344 // UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
345 
347 {
348  m_sessionBoard = aBoard; // not owned here
349 
350  if( !m_session )
351  THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
352 
353  if( !m_session->route )
354  THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
355 
356  if( !m_session->route->library )
357  THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
358 
359  // delete all the old tracks and vias but save locked tracks/vias
360  // they will be re-added later
361  std::vector<PCB_TRACK*> locked;
362 
363  while( !aBoard->Tracks().empty() )
364  {
365  PCB_TRACK* track = aBoard->Tracks().back();
366  aBoard->Tracks().pop_back();
367 
368  if( track->IsLocked() )
369  locked.push_back( track );
370  else
371  delete track;
372  }
373 
374  aBoard->DeleteMARKERs();
375 
376  buildLayerMaps( aBoard );
377 
378  // Add locked tracks: because they are exported as Fix tracks, they are not
379  // in .ses file.
380  for( PCB_TRACK* track: locked )
381  {
382  aBoard->Add( track );
383  }
384 
385  if( m_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 = m_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  FOOTPRINT* footprint = aBoard->FindFootprintByReference( reference );
400 
401  if( !footprint )
402  {
403  THROW_IO_ERROR( wxString::Format( _( "Reference '%s' not found." ),
404  reference ) );
405  }
406 
407  if( !place->hasVertex )
408  continue;
409 
410  UNIT_RES* resolution = place->GetUnits();
411  wxASSERT( resolution );
412 
413  wxPoint newPos = mapPt( place->vertex, resolution );
414  footprint->SetPosition( newPos );
415 
416  if( place->side == T_front )
417  {
418  // convert from degrees to tenths of degrees used in KiCad.
419  int orientation = KiROUND( place->rotation * 10.0 );
420 
421  if( footprint->GetLayer() != F_Cu )
422  {
423  // footprint is on copper layer (back)
424  footprint->Flip( footprint->GetPosition(), false );
425  }
426 
427  footprint->SetOrientation( orientation );
428  }
429  else if( place->side == T_back )
430  {
431  int orientation = KiROUND( (place->rotation + 180.0) * 10.0 );
432 
433  if( footprint->GetLayer() != B_Cu )
434  {
435  // footprint is on component layer (front)
436  footprint->Flip( footprint->GetPosition(), false );
437  }
438 
439  footprint->SetOrientation( orientation );
440  }
441  else
442  {
443  // as I write this, the PARSER *is* catching this, so we should never see below:
444  wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
445  }
446  }
447  }
448  }
449 
451 
452  // Walk the NET_OUTs and create tracks and vias anew.
453  NET_OUTS& net_outs = m_session->route->net_outs;
454  for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
455  {
456  int netoutCode = 0;
457 
458  // page 143 of spec says wire's net_id is optional
459  if( net->net_id.size() )
460  {
461  wxString netName = FROM_UTF8( net->net_id.c_str() );
462  NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
463 
464  if( netinfo )
465  {
466  netoutCode = netinfo->GetNetCode();
467  }
468  else // else netCode remains 0
469  {
470  // int breakhere = 1;
471  }
472  }
473 
474  WIRES& wires = net->wires;
475  for( unsigned i = 0; i<wires.size(); ++i )
476  {
477  WIRE* wire = &wires[i];
478  DSN_T shape = wire->shape->Type();
479 
480  if( shape != T_path )
481  {
482  /* shape == T_polygon is expected from freerouter if you have
483  a zone on a non "power" type layer, i.e. a T_signal layer
484  and the design does a round trip back in as session here.
485  We kept our own zones in the BOARD, so ignore this so called
486  'wire'.
487 
488  wxString netId = FROM_UTF8( wire->net_id.c_str() );
489  THROW_IO_ERROR( wxString::Format( _("Unsupported wire shape: '%s' for net: '%s'"),
490  DLEX::GetTokenString(shape).GetData(),
491  netId.GetData()
492  ) );
493  */
494  }
495  else
496  {
497  PATH* path = (PATH*) wire->shape;
498 
499  for( unsigned pt=0; pt < path->points.size()-1; ++pt )
500  {
501  PCB_TRACK* track = makeTRACK( wire, path, pt, netoutCode );
502  aBoard->Add( track );
503  }
504  }
505  }
506 
507  WIRE_VIAS& wire_vias = net->wire_vias;
509  for( unsigned i=0; i<wire_vias.size(); ++i )
510  {
511  int netCode = 0;
512 
513  // page 144 of spec says wire_via's net_id is optional
514  if( net->net_id.size() )
515  {
516  wxString netName = FROM_UTF8( net->net_id.c_str() );
517  NETINFO_ITEM* netvia = aBoard->FindNet( netName );
518 
519  if( netvia )
520  netCode = netvia->GetNetCode();
521 
522  // else netCode remains 0
523  }
524 
525  WIRE_VIA* wire_via = &wire_vias[i];
526 
527  // example: (via Via_15:8_mil 149000 -71000 )
528 
529  PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
530  if( !padstack )
531  {
532  // Dick Feb 29, 2008:
533  // Freerouter has a bug where it will not round trip all vias.
534  // Vias which have a (use_via) element will be round tripped.
535  // Vias which do not, don't come back in in the session library,
536  // even though they may be actually used in the pre-routed,
537  // protected wire_vias. So until that is fixed, create the
538  // padstack from its name as a work around.
539 
540 
541  // Could use a STRING_FORMATTER here and convert the entire
542  // wire_via to text and put that text into the exception.
543  wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
544 
545  THROW_IO_ERROR( wxString::Format( _( "A wire_via refers to missing padstack '%s'." ),
546  psid ) );
547  }
548 
549  NETCLASSPTR netclass = aBoard->GetDesignSettings().GetNetClasses().GetDefault();
550 
551  int via_drill_default = netclass->GetViaDrill();
552 
553  for( unsigned v = 0; v < wire_via->vertexes.size(); ++v )
554  {
555  PCB_VIA* via = makeVIA( wire_via, padstack, wire_via->vertexes[v], netCode,
556  via_drill_default );
557  aBoard->Add( via );
558  }
559  }
560  }
561 }
562 
563 
564 } // namespace DSN
void LoadSESSION(const wxString &aFilename)
A recursive descent parser for a SPECCTRA DSN "session" file.
Definition: specctra.cpp:277
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1328
void buildLayerMaps(BOARD *aBoard)
Create a few data translation structures for layer name and number mapping between the DSN::PCB struc...
Definition: specctra.cpp:76
BOARD * m_sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3998
DSN::T DSN_T
Definition: specctra.h:46
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
This source file implements export and import capabilities to the specctra dsn file format.
Definition: specctra.cpp:63
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
double y
Definition: specctra.h:105
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:164
This file is part of the common library.
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3130
void SetEnd(const wxPoint &aEnd)
Definition: pcb_track.h:104
static constexpr double IU_PER_MM
Mock up a conversion function.
NET_OUTS net_outs
Definition: specctra.h:3518
static POINT mapPt(const wxPoint &pt)
Convert a KiCad point into a DSN file point.
POINTS vertexes
Definition: specctra.h:3120
A holder for either a T_unit or T_resolution object which are usually mutually exclusive in the dsn g...
Definition: specctra.h:402
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
double x
Definition: specctra.h:104
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:218
boost::ptr_vector< NET_OUT > NET_OUTS
Definition: specctra.h:3451
DSN_T GetEngUnits() const
Definition: specctra.h:419
virtual bool IsLocked() const
Definition: board_item.cpp:64
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
std::string layer_id
Definition: specctra.h:650
int GetValue() const
Definition: specctra.h:420
DSN_T via_type
Definition: specctra.h:3123
This file contains miscellaneous commonly used macros and functions.
POINT vertex
Definition: specctra.h:1740
int findLayerName(const std::string &aLayerName) const
Return the PCB layer index for a given layer name, within the specctra sessionfile.
Definition: specctra.cpp:125
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
Definition: specctra.h:582
double rotation
Definition: specctra.h:1737
bool hasVertex
Definition: specctra.h:1739
ELEM * shape
Definition: specctra.h:2971
UNIT_RES * GetUnits() const override
Return the units for this section.
Definition: specctra.h:3475
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:608
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:804
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1812
DSN_T side
Definition: specctra.h:1735
Implement a <placement_reference> in the specctra dsn spec.
Definition: specctra.h:1687
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:69
LIBRARY * library
Definition: specctra.h:3517
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:345
void SetStart(const wxPoint &aStart)
Definition: pcb_track.h:107
#define _(s)
std::string component_id
reference designator
Definition: specctra.h:1733
Hold either a via or a pad definition.
Definition: specctra.h:2126
NETCLASSES & GetNetClasses() const
A DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3647
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
std::string layer_id
Definition: specctra.h:775
BOARD * GetBoard()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
UNIT_RES * m_routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3995
A "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1893
PLACEMENT * placement
Definition: specctra.h:3630
const std::string & GetPadstackId()
Definition: specctra.h:3001
void SetWidth(int aWidth)
Definition: pcb_track.h:101
PCB_TRACK * makeTRACK(WIRE *wire, PATH *aPath, int aPointIndex, int aNetcode)
Create a #TRACK form the #PATH and BOARD info.
Handle the data for a net.
Definition: netinfo.h:66
bool ImportSpecctraSession(const wxString &aFullFilename)
Import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an ...
A <library_descriptor> in the specctra dsn specification.
Definition: specctra.h:2257
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3992
A point in the SPECCTRA DSN coordinate system.
Definition: specctra.h:102
A <wire_shape_descriptor> in the specctra dsn spec.
Definition: specctra.h:2880
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1761
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
DSN_T Type() const
Definition: specctra.h:210
POINTS points
Definition: specctra.h:653
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71
int GetCopperLayerCount() const
Definition: board.cpp:455
SESSION * m_session
Definition: specctra.h:3981
static double scale(int kicadDist)
Convert a distance from Pcbnew internal units to the reported Specctra DSN units in floating point fo...
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:73
double aperture_width
Definition: specctra.h:651
PCB_VIA * makeVIA(WIRE_VIA *aVia, PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault)
Instantiate a KiCad #VIA on the heap and initializes it with internal values consistent with the give...
std::string padstack_id
Definition: specctra.h:2226
ROUTE * route
Definition: specctra.h:3632
virtual UNIT_RES * GetUnits() const
Return the units for this section.
Definition: specctra.cpp:3765
ELEM * shape
Definition: specctra.h:893
NETCLASSPTR GetDefault() const
Definition: netclass.h:253
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2983
A <wire_via_descriptor> in the specctra dsn spec.
Definition: specctra.h:2989
void FromSESSION(BOARD *aBoard)
Add the entire #SESSION info to a BOARD but does not write it out.
DSN_T wire_type
Definition: specctra.h:2975
int Length() const
Return the number of ELEMs in this holder.
Definition: specctra.h:317
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
COMPONENTS components
Definition: specctra.h:1882
TRACKS & Tracks()
Definition: board.h:231
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:1349
double diameter
Definition: specctra.h:777
int GetNetCode() const
Definition: netinfo.h:120