KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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>
42#include <footprint.h>
43#include <pcb_group.h>
44#include <pcb_track.h>
46#include <view/view.h>
47#include "specctra.h"
48#include <math/util.h> // for KiROUND
49#include <pcbnew_settings.h>
50
51using namespace DSN;
52
53bool PCB_EDIT_FRAME::ImportSpecctraSession( const wxString& fullFileName )
54{
55 // To avoid issues with undo/redo lists (dangling pointers) clear the lists
56 // todo: use undo/redo feature
58
59 if( GetCanvas() ) // clear view:
60 {
61 for( PCB_TRACK* track : GetBoard()->Tracks() )
62 GetCanvas()->GetView()->Remove( track );
63 }
64
65 try
66 {
67 DSN::ImportSpecctraSession( GetBoard(), fullFileName );
68 }
69
70 catch( const IO_ERROR& ioe )
71 {
72 wxString msg = _( "Board may be corrupted, do not save it.\n Fix problem and try again" );
73
74 wxString extra = ioe.What();
75
76 DisplayErrorMessage( this, msg, extra);
77 return false;
78 }
79
80 OnModify();
81
82 if( GetCanvas() ) // Update view:
83 {
84 // Update footprint positions
85
86 // add imported tracks (previous tracks are removed, therefore all are new)
87 for( auto track : GetBoard()->Tracks() )
88 GetCanvas()->GetView()->Add( track );
89 }
90
91 SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
92
93 Refresh();
94
95 return true;
96}
97
98
99namespace DSN {
100
101
109static int scale( double distance, UNIT_RES* aResolution )
110{
111 double resValue = aResolution->GetValue();
112 double factor;
113
114 switch( aResolution->GetEngUnits() )
115 {
116 default:
117 case T_inch: factor = 25.4e6; break; // nanometers per inch
118 case T_mil: factor = 25.4e3; break; // nanometers per mil
119 case T_cm: factor = 1e7; break; // nanometers per cm
120 case T_mm: factor = 1e6; break; // nanometers per mm
121 case T_um: factor = 1e3; break; // nanometers per um
122 }
123
124 return KiROUND( factor * distance / resValue );
125}
126
127
136static VECTOR2I mapPt( const POINT& aPoint, UNIT_RES* aResolution )
137{
138 VECTOR2I ret( scale( aPoint.x, aResolution ),
139 -scale( aPoint.y, aResolution ) ); // negate y
140
141 return ret;
142}
143
144
145PCB_TRACK* SPECCTRA_DB::makeTRACK( WIRE* wire, PATH* aPath, int aPointIndex, int aNetcode )
146{
147 int layerNdx = findLayerName( aPath->layer_id );
148
149 if( layerNdx == -1 )
150 {
151 THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'." ),
152 From_UTF8( aPath->layer_id.c_str() ) ) );
153 }
154
155 PCB_TRACK* track = new PCB_TRACK( m_sessionBoard );
156
157 track->SetStart( mapPt( aPath->points[aPointIndex+0], m_routeResolution ) );
158 track->SetEnd( mapPt( aPath->points[aPointIndex+1], m_routeResolution ) );
159 track->SetLayer( m_pcbLayer2kicad[layerNdx] );
160 track->SetWidth( scale( aPath->aperture_width, m_routeResolution ) );
161 track->SetNetCode( aNetcode );
162
163 // a track can be locked.
164 // However specctra as 4 types, none is exactly the same as our locked option
165 // wire->wire_type = T_fix, T_route, T_normal or T_protect
166 // fix and protect could be used as lock option
167 // but protect is returned for all tracks having initially the route or protect property
168 if( wire->m_wire_type == T_fix )
169 track->SetLocked( true );
170
171 return track;
172}
173
174
175PCB_VIA* SPECCTRA_DB::makeVIA( WIRE_VIA*aVia, PADSTACK* aPadstack, const POINT& aPoint, int aNetCode,
176 int aViaDrillDefault )
177{
178 PCB_VIA* via = nullptr;
179 SHAPE* shape;
180 int shapeCount = aPadstack->Length();
181 int drill_diam_iu = -1;
182 int copperLayerCount = m_sessionBoard->GetCopperLayerCount();
183
184
185 // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
186 // It is after the colon and before the last '_'
187 size_t drillStartNdx = aPadstack->m_padstack_id.find( ':' );
188
189 if( drillStartNdx != std::string::npos )
190 {
191 ++drillStartNdx; // skip over the ':'
192
193 size_t drillEndNdx = aPadstack->m_padstack_id.rfind( '_' );
194
195 if( drillEndNdx != std::string::npos )
196 {
197 std::string diam_txt( aPadstack->m_padstack_id, drillStartNdx,
198 drillEndNdx-drillStartNdx );
199
200 double drill_um = strtod( diam_txt.c_str(), nullptr );
201
202 drill_diam_iu = int( drill_um * ( pcbIUScale.IU_PER_MM / 1000.0 ) );
203
204 if( drill_diam_iu == aViaDrillDefault )
205 drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
206 }
207 }
208
209 if( shapeCount == 0 )
210 {
211 THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
212 }
213 else if( shapeCount == 1 )
214 {
215 shape = (SHAPE*) (*aPadstack)[0];
216 DSN_T type = shape->shape->Type();
217
218 if( type != T_circle )
219 {
220 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s." ),
221 GetTokenString( type ) ) );
222 }
223
224 CIRCLE* circle = (CIRCLE*) shape->shape;
225 int viaDiam = scale( circle->diameter, m_routeResolution );
226
227 via = new PCB_VIA( m_sessionBoard );
228 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
229 via->SetDrill( drill_diam_iu );
230 via->SetViaType( VIATYPE::THROUGH );
231 via->SetWidth( ::PADSTACK::ALL_LAYERS, viaDiam );
232 via->SetLayerPair( F_Cu, B_Cu );
233 }
234 else if( shapeCount == copperLayerCount )
235 {
236 shape = (SHAPE*) (*aPadstack)[0];
237 DSN_T type = shape->shape->Type();
238
239 if( type != T_circle )
240 {
241 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
242 GetTokenString( type ) ) );
243 }
244
245 CIRCLE* circle = (CIRCLE*) shape->shape;
246 int viaDiam = scale( circle->diameter, m_routeResolution );
247
248 via = new PCB_VIA( m_sessionBoard );
249 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
250 via->SetDrill( drill_diam_iu );
251 via->SetViaType( VIATYPE::THROUGH );
252 via->SetWidth( ::PADSTACK::ALL_LAYERS, viaDiam );
253 via->SetLayerPair( F_Cu, B_Cu );
254 }
255 else // VIA_MICROVIA or VIA_BLIND_BURIED
256 {
257 int topLayerNdx = -1; // session layer detectors
258 int botLayerNdx = INT_MAX;
259
260 int viaDiam = -1;
261
262 for( int i=0; i<shapeCount; ++i )
263 {
264 shape = (SHAPE*) (*aPadstack)[i];
265 DSN_T type = shape->shape->Type();
266
267 if( type != T_circle )
268 {
269 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
270 GetTokenString( type ) ) );
271 }
272
273 CIRCLE* circle = (CIRCLE*) shape->shape;
274
275 int layerNdx = findLayerName( circle->layer_id );
276 if( layerNdx == -1 )
277 {
278 wxString layerName = From_UTF8( circle->layer_id.c_str() );
279 THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'" ),
280 layerName ) );
281 }
282
283 if( layerNdx > topLayerNdx )
284 topLayerNdx = layerNdx;
285
286 if( layerNdx < botLayerNdx )
287 botLayerNdx = layerNdx;
288
289 if( viaDiam == -1 )
290 viaDiam = scale( circle->diameter, m_routeResolution );
291 }
292
293 via = new PCB_VIA( m_sessionBoard );
294 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
295 via->SetDrill( drill_diam_iu );
296
297 if( ( topLayerNdx == 0 && botLayerNdx == 1 )
298 || ( topLayerNdx == copperLayerCount-2 && botLayerNdx == copperLayerCount-1 ) )
299 {
300 via->SetViaType( VIATYPE::MICROVIA );
301 }
302 else
303 {
304 via->SetViaType( VIATYPE::BLIND_BURIED );
305 }
306
307 via->SetWidth( ::PADSTACK::ALL_LAYERS, viaDiam );
308 via->SetLayerPair( m_pcbLayer2kicad[ topLayerNdx ], m_pcbLayer2kicad[ botLayerNdx ] );
309 }
310
311 wxASSERT( via );
312
313 via->SetNetCode( aNetCode );
314
315 // a via can be locked.
316 // However specctra as 4 types, none is exactly the same as our locked option
317 // aVia->via_type = T_fix, T_route, T_normal or T_protect
318 // fix and protect could be used as lock option
319 // but protect is returned for all tracks having initially the route or protect property
320 if( aVia->m_via_type == T_fix )
321 via->SetLocked( true );
322
323 return via;
324}
325
326
327// no UI code in this function, throw exception to report problems to the
328// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
329
331{
332 m_sessionBoard = aBoard; // not owned here
333
334 if( !m_session )
335 THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
336
337 if( !m_session->route )
338 THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
339
340 if( !m_session->route->library )
341 THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
342
343 // delete the old tracks and vias but save locked tracks/vias; they will be re-added later
344 std::vector<PCB_TRACK*> locked;
345 TRACKS tracks = aBoard->Tracks();
346 aBoard->RemoveAll( { PCB_TRACE_T } );
347
348 for( PCB_TRACK* track : tracks )
349 {
350 if( track->IsLocked() )
351 {
352 locked.push_back( track );
353 }
354 else
355 {
356 if( PCB_GROUP* group = track->GetParentGroup() )
357 group->RemoveItem( track );
358
359 delete track;
360 }
361 }
362
363 aBoard->DeleteMARKERs();
364
365 buildLayerMaps( aBoard );
366
367 // Add locked tracks: because they are exported as Fix tracks, they are not
368 // in .ses file.
369 for( PCB_TRACK* track : locked )
370 aBoard->Add( track );
371
372 if( m_session->placement )
373 {
374 // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
375 // each COMPONENT, reposition and re-orient each component and put on
376 // correct side of the board.
378
379 for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
380 {
381 PLACES& places = comp->m_places;
382 for( unsigned i=0; i<places.size(); ++i )
383 {
384 PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
385
386 wxString reference = From_UTF8( place->m_component_id.c_str() );
387 FOOTPRINT* footprint = aBoard->FindFootprintByReference( reference );
388
389 if( !footprint )
390 {
391 THROW_IO_ERROR( wxString::Format( _( "Reference '%s' not found." ),
392 reference ) );
393 }
394
395 if( !place->m_hasVertex )
396 continue;
397
398 UNIT_RES* resolution = place->GetUnits();
399 wxASSERT( resolution );
400
401 VECTOR2I newPos = mapPt( place->m_vertex, resolution );
402 footprint->SetPosition( newPos );
403
404 if( place->m_side == T_front )
405 {
406 // convert from degrees to tenths of degrees used in KiCad.
407 EDA_ANGLE orientation( place->m_rotation, DEGREES_T );
408
409 if( footprint->GetLayer() != F_Cu )
410 {
411 // footprint is on copper layer (back)
412 footprint->Flip( footprint->GetPosition(), FLIP_DIRECTION::TOP_BOTTOM );
413 }
414
415 footprint->SetOrientation( orientation );
416 }
417 else if( place->m_side == T_back )
418 {
419 EDA_ANGLE orientation( place->m_rotation + 180.0, DEGREES_T );
420
421 if( footprint->GetLayer() != B_Cu )
422 {
423 // footprint is on component layer (front)
424 footprint->Flip( footprint->GetPosition(), FLIP_DIRECTION::TOP_BOTTOM );
425 }
426
427 footprint->SetOrientation( orientation );
428 }
429 else
430 {
431 // as I write this, the PARSER *is* catching this, so we should never see below:
432 wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
433 }
434 }
435 }
436 }
437
439
440 // Walk the NET_OUTs and create tracks and vias anew.
441 NET_OUTS& net_outs = m_session->route->net_outs;
442 for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
443 {
444 int netoutCode = 0;
445
446 // page 143 of spec says wire's net_id is optional
447 if( net->net_id.size() )
448 {
449 wxString netName = From_UTF8( net->net_id.c_str() );
450 NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
451
452 if( netinfo )
453 netoutCode = netinfo->GetNetCode();
454 }
455
456 WIRES& wires = net->wires;
457 for( unsigned i = 0; i<wires.size(); ++i )
458 {
459 WIRE* wire = &wires[i];
460 DSN_T shape = wire->m_shape->Type();
461
462 if( shape != T_path )
463 {
464 /*
465 * shape == T_polygon is expected from freerouter if you have a zone on a non-
466 * "power" type layer, i.e. a T_signal layer and the design does a round-trip
467 * back in as session here. We kept our own zones in the BOARD, so ignore this
468 * so called 'wire'.
469
470 wxString netId = From_UTF8( wire->net_id.c_str() );
471 THROW_IO_ERROR( wxString::Format( _( "Unsupported wire shape: '%s' for net: '%s'" ),
472 DLEX::GetTokenString(shape).GetData(),
473 netId.GetData() ) );
474 */
475 }
476 else
477 {
478 PATH* path = (PATH*) wire->m_shape;
479
480 for( unsigned pt=0; pt < path->points.size()-1; ++pt )
481 {
482 PCB_TRACK* track = makeTRACK( wire, path, pt, netoutCode );
483 aBoard->Add( track );
484 }
485 }
486 }
487
488 WIRE_VIAS& wire_vias = net->wire_vias;
490
491 for( unsigned i=0; i<wire_vias.size(); ++i )
492 {
493 int netCode = 0;
494
495 // page 144 of spec says wire_via's net_id is optional
496 if( net->net_id.size() )
497 {
498 wxString netName = From_UTF8( net->net_id.c_str() );
499 NETINFO_ITEM* netvia = aBoard->FindNet( netName );
500
501 if( netvia )
502 netCode = netvia->GetNetCode();
503 }
504
505 WIRE_VIA* wire_via = &wire_vias[i];
506
507 // example: (via Via_15:8_mil 149000 -71000 )
508
509 PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
510 if( !padstack )
511 {
512 // Dick Feb 29, 2008:
513 // Freerouter has a bug where it will not round trip all vias. Vias which have
514 // a (use_via) element will be round tripped. Vias which do not, don't come back
515 // in in the session library, even though they may be actually used in the
516 // pre-routed, protected wire_vias. So until that is fixed, create the padstack
517 // from its name as a work around.
518 wxString psid( From_UTF8( wire_via->GetPadstackId().c_str() ) );
519
520 THROW_IO_ERROR( wxString::Format( _( "A wire_via refers to missing padstack '%s'." ),
521 psid ) );
522 }
523
524 std::shared_ptr<NET_SETTINGS>& netSettings = aBoard->GetDesignSettings().m_NetSettings;
525
526 int via_drill_default = netSettings->GetDefaultNetclass()->GetViaDrill();
527
528 for( unsigned v = 0; v < wire_via->m_vertexes.size(); ++v )
529 {
530 PCB_VIA* via = makeVIA( wire_via, padstack, wire_via->m_vertexes[v], netCode,
531 via_drill_default );
532 aBoard->Add( via );
533 }
534 }
535 }
536}
537
538
539bool ImportSpecctraSession( BOARD* aBoard, const wxString& fullFileName )
540{
541 SPECCTRA_DB db;
542 LOCALE_IO toggle;
543
544 db.LoadSESSION( fullFileName );
545 db.FromSESSION( aBoard );
546
547 aBoard->GetConnectivity()->ClearRatsnest();
548 aBoard->BuildConnectivity();
549
550 return true;
551}
552} // namespace DSN
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
std::shared_ptr< NET_SETTINGS > m_NetSettings
virtual void SetLocked(bool aLocked)
Definition: board_item.h:329
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:289
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:998
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1916
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:187
int GetCopperLayerCount() const
Definition: board.cpp:736
void RemoveAll(std::initializer_list< KICAD_T > aTypes={ PCB_NETINFO_T, PCB_MARKER_T, PCB_GROUP_T, PCB_ZONE_T, PCB_GENERATOR_T, PCB_FOOTPRINT_T, PCB_TRACE_T, PCB_SHAPE_T })
An efficient way to remove all items of a certain type from the board.
Definition: board.cpp:1242
const TRACKS & Tracks() const
Definition: board.h:329
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:2002
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:890
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1355
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:475
std::string layer_id
Definition: specctra.h:774
double diameter
Definition: specctra.h:776
int Length() const
Return the number of ELEMs in this holder.
Definition: specctra.h:316
virtual UNIT_RES * GetUnits() const
Return the units for this section.
Definition: specctra.cpp:3764
DSN_T Type() const
Definition: specctra.h:209
A <library_descriptor> in the specctra dsn specification.
Definition: specctra.h:2251
Hold either a via or a pad definition.
Definition: specctra.h:2120
std::string m_padstack_id
Definition: specctra.h:2219
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
Definition: specctra.h:582
POINTS points
Definition: specctra.h:652
double aperture_width
Definition: specctra.h:650
std::string layer_id
Definition: specctra.h:649
COMPONENTS m_components
Definition: specctra.h:1881
Implement a <placement_reference> in the specctra dsn spec.
Definition: specctra.h:1687
bool m_hasVertex
Definition: specctra.h:1738
POINT m_vertex
Definition: specctra.h:1739
DSN_T m_side
Definition: specctra.h:1734
double m_rotation
Definition: specctra.h:1736
std::string m_component_id
reference designator
Definition: specctra.h:1732
UNIT_RES * GetUnits() const override
Return the units for this section.
Definition: specctra.h:3468
NET_OUTS net_outs
Definition: specctra.h:3511
LIBRARY * library
Definition: specctra.h:3510
PLACEMENT * placement
Definition: specctra.h:3623
ROUTE * route
Definition: specctra.h:3625
A "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1893
A DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3641
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
PCB_TRACK * makeTRACK(WIRE *wire, PATH *aPath, int aPointIndex, int aNetcode)
Create a TRACK form the #PATH and BOARD info.
UNIT_RES * m_routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3988
BOARD * m_sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3991
SESSION * m_session
Definition: specctra.h:3974
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3985
void LoadSESSION(const wxString &aFilename)
A recursive descent parser for a SPECCTRA DSN "session" file.
Definition: specctra.cpp:278
void FromSESSION(BOARD *aBoard)
Add the entire #SESSION info to a BOARD but does not write it out.
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 given...
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
A holder for either a T_unit or T_resolution object which are usually mutually exclusive in the dsn g...
Definition: specctra.h:402
DSN_T GetEngUnits() const
Definition: specctra.h:418
int GetValue() const
Definition: specctra.h:419
ELEM * shape
Definition: specctra.h:892
A <wire_via_descriptor> in the specctra dsn spec.
Definition: specctra.h:2983
DSN_T m_via_type
Definition: specctra.h:3116
const std::string & GetPadstackId()
Definition: specctra.h:2994
POINTS m_vertexes
Definition: specctra.h:3113
A <wire_shape_descriptor> in the specctra dsn spec.
Definition: specctra.h:2874
DSN_T m_wire_type
Definition: specctra.h:2968
ELEM * m_shape
Definition: specctra.h:2964
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2334
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2404
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:235
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2276
VECTOR2I GetPosition() const override
Definition: footprint.h:223
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:57
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:49
Handle the data for a net.
Definition: netinfo.h:56
int GetNetCode() const
Definition: netinfo.h:108
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Definition: padstack.h:138
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
BOARD * GetBoard() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void OnModify() override
Must be called after a board change to set the modified flag.
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 set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:52
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:118
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:121
virtual void SetWidth(int aWidth)
Definition: pcb_track.h:115
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
This file is part of the common library.
#define _(s)
@ DEGREES_T
Definition: eda_angle.h:31
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:39
@ B_Cu
Definition: layer_ids.h:65
@ F_Cu
Definition: layer_ids.h:64
This file contains miscellaneous commonly used macros and functions.
This source file implements export and import capabilities to the specctra dsn file format.
Definition: specctra.cpp:63
boost::ptr_vector< NET_OUT > NET_OUTS
Definition: specctra.h:3444
static POINT mapPt(const VECTOR2I &pt)
Convert a KiCad point into a DSN file point.
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2976
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1760
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3123
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1811
bool ImportSpecctraSession(BOARD *aBoard, const wxString &fullFileName)
Helper method to import SES file to a board.
Class to handle a set of BOARD_ITEMs.
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:81
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
DSN::T DSN_T
Definition: specctra.h:48
const int scale
wxString From_UTF8(const char *cstring)
A point in the SPECCTRA DSN coordinate system.
Definition: specctra.h:102
double y
Definition: specctra.h:104
double x
Definition: specctra.h:103
const double IU_PER_MM
Definition: base_units.h:76
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96