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 int drillStartNdx = aPadstack->m_padstack_id.find( ':' );
188
189 if( drillStartNdx != -1 )
190 {
191 ++drillStartNdx; // skip over the ':'
192
193 int drillEndNdx = aPadstack->m_padstack_id.rfind( '_' );
194 if( drillEndNdx != -1 )
195 {
196 std::string diam_txt( aPadstack->m_padstack_id,
197 drillStartNdx, drillEndNdx-drillStartNdx );
198
199 double drill_um = strtod( diam_txt.c_str(), 0 );
200
201 drill_diam_iu = int( drill_um * ( pcbIUScale.IU_PER_MM / 1000.0 ) );
202
203 if( drill_diam_iu == aViaDrillDefault )
204 drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
205 }
206 }
207
208 if( shapeCount == 0 )
209 {
210 THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
211 }
212 else if( shapeCount == 1 )
213 {
214 shape = (SHAPE*) (*aPadstack)[0];
215 DSN_T type = shape->shape->Type();
216
217 if( type != T_circle )
218 {
219 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s." ),
220 GetTokenString( type ) ) );
221 }
222
223 CIRCLE* circle = (CIRCLE*) shape->shape;
224 int viaDiam = scale( circle->diameter, m_routeResolution );
225
226 via = new PCB_VIA( m_sessionBoard );
227 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
228 via->SetDrill( drill_diam_iu );
229 via->SetViaType( VIATYPE::THROUGH );
230 via->SetWidth( viaDiam );
231 via->SetLayerPair( F_Cu, B_Cu );
232 }
233 else if( shapeCount == copperLayerCount )
234 {
235 shape = (SHAPE*) (*aPadstack)[0];
236 DSN_T type = shape->shape->Type();
237
238 if( type != T_circle )
239 {
240 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
241 GetTokenString( type ) ) );
242 }
243
244 CIRCLE* circle = (CIRCLE*) shape->shape;
245 int viaDiam = scale( circle->diameter, m_routeResolution );
246
247 via = new PCB_VIA( m_sessionBoard );
248 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
249 via->SetDrill( drill_diam_iu );
250 via->SetViaType( VIATYPE::THROUGH );
251 via->SetWidth( viaDiam );
252 via->SetLayerPair( F_Cu, B_Cu );
253 }
254 else // VIA_MICROVIA or VIA_BLIND_BURIED
255 {
256 int topLayerNdx = -1; // session layer detectors
257 int botLayerNdx = INT_MAX;
258
259 int viaDiam = -1;
260
261 for( int i=0; i<shapeCount; ++i )
262 {
263 shape = (SHAPE*) (*aPadstack)[i];
264 DSN_T type = shape->shape->Type();
265
266 if( type != T_circle )
267 {
268 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
269 GetTokenString( type ) ) );
270 }
271
272 CIRCLE* circle = (CIRCLE*) shape->shape;
273
274 int layerNdx = findLayerName( circle->layer_id );
275 if( layerNdx == -1 )
276 {
277 wxString layerName = From_UTF8( circle->layer_id.c_str() );
278 THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'" ),
279 layerName ) );
280 }
281
282 if( layerNdx > topLayerNdx )
283 topLayerNdx = layerNdx;
284
285 if( layerNdx < botLayerNdx )
286 botLayerNdx = layerNdx;
287
288 if( viaDiam == -1 )
289 viaDiam = scale( circle->diameter, m_routeResolution );
290 }
291
292 via = new PCB_VIA( m_sessionBoard );
293 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
294 via->SetDrill( drill_diam_iu );
295
296 if( ( topLayerNdx == 0 && botLayerNdx == 1 )
297 || ( topLayerNdx == copperLayerCount-2 && botLayerNdx == copperLayerCount-1 ) )
298 {
299 via->SetViaType( VIATYPE::MICROVIA );
300 }
301 else
302 {
303 via->SetViaType( VIATYPE::BLIND_BURIED );
304 }
305
306 via->SetWidth( viaDiam );
307 via->SetLayerPair( m_pcbLayer2kicad[ topLayerNdx ], m_pcbLayer2kicad[ botLayerNdx ] );
308 }
309
310 wxASSERT( via );
311
312 via->SetNetCode( aNetCode );
313
314 // a via can be locked.
315 // However specctra as 4 types, none is exactly the same as our locked option
316 // aVia->via_type = T_fix, T_route, T_normal or T_protect
317 // fix and protect could be used as lock option
318 // but protect is returned for all tracks having initially the route or protect property
319 if( aVia->m_via_type == T_fix )
320 via->SetLocked( true );
321
322 return via;
323}
324
325
326// no UI code in this function, throw exception to report problems to the
327// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
328
330{
331 m_sessionBoard = aBoard; // not owned here
332
333 if( !m_session )
334 THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
335
336 if( !m_session->route )
337 THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
338
339 if( !m_session->route->library )
340 THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
341
342 // delete the old tracks and vias but save locked tracks/vias; they will be re-added later
343 std::vector<PCB_TRACK*> locked;
344 TRACKS tracks = aBoard->Tracks();
345 aBoard->RemoveAll( { PCB_TRACE_T } );
346
347 for( PCB_TRACK* track : tracks )
348 {
349 if( track->IsLocked() )
350 {
351 locked.push_back( track );
352 }
353 else
354 {
355 if( PCB_GROUP* group = track->GetParentGroup() )
356 group->RemoveItem( track );
357
358 delete track;
359 }
360 }
361
362 aBoard->DeleteMARKERs();
363
364 buildLayerMaps( aBoard );
365
366 // Add locked tracks: because they are exported as Fix tracks, they are not
367 // in .ses file.
368 for( PCB_TRACK* track : locked )
369 aBoard->Add( track );
370
371 if( m_session->placement )
372 {
373 // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
374 // each COMPONENT, reposition and re-orient each component and put on
375 // correct side of the board.
377
378 for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
379 {
380 PLACES& places = comp->m_places;
381 for( unsigned i=0; i<places.size(); ++i )
382 {
383 PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
384
385 wxString reference = From_UTF8( place->m_component_id.c_str() );
386 FOOTPRINT* footprint = aBoard->FindFootprintByReference( reference );
387
388 if( !footprint )
389 {
390 THROW_IO_ERROR( wxString::Format( _( "Reference '%s' not found." ),
391 reference ) );
392 }
393
394 if( !place->m_hasVertex )
395 continue;
396
397 UNIT_RES* resolution = place->GetUnits();
398 wxASSERT( resolution );
399
400 VECTOR2I newPos = mapPt( place->m_vertex, resolution );
401 footprint->SetPosition( newPos );
402
403 if( place->m_side == T_front )
404 {
405 // convert from degrees to tenths of degrees used in KiCad.
406 EDA_ANGLE orientation( place->m_rotation, DEGREES_T );
407
408 if( footprint->GetLayer() != F_Cu )
409 {
410 // footprint is on copper layer (back)
411 footprint->Flip( footprint->GetPosition(), false );
412 }
413
414 footprint->SetOrientation( orientation );
415 }
416 else if( place->m_side == T_back )
417 {
418 EDA_ANGLE orientation( place->m_rotation + 180.0, DEGREES_T );
419
420 if( footprint->GetLayer() != B_Cu )
421 {
422 // footprint is on component layer (front)
423 footprint->Flip( footprint->GetPosition(), false );
424 }
425
426 footprint->SetOrientation( orientation );
427 }
428 else
429 {
430 // as I write this, the PARSER *is* catching this, so we should never see below:
431 wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
432 }
433 }
434 }
435 }
436
438
439 // Walk the NET_OUTs and create tracks and vias anew.
440 NET_OUTS& net_outs = m_session->route->net_outs;
441 for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
442 {
443 int netoutCode = 0;
444
445 // page 143 of spec says wire's net_id is optional
446 if( net->net_id.size() )
447 {
448 wxString netName = From_UTF8( net->net_id.c_str() );
449 NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
450
451 if( netinfo )
452 netoutCode = netinfo->GetNetCode();
453 }
454
455 WIRES& wires = net->wires;
456 for( unsigned i = 0; i<wires.size(); ++i )
457 {
458 WIRE* wire = &wires[i];
459 DSN_T shape = wire->m_shape->Type();
460
461 if( shape != T_path )
462 {
463 /*
464 * shape == T_polygon is expected from freerouter if you have a zone on a non-
465 * "power" type layer, i.e. a T_signal layer and the design does a round-trip
466 * back in as session here. We kept our own zones in the BOARD, so ignore this
467 * so called 'wire'.
468
469 wxString netId = From_UTF8( wire->net_id.c_str() );
470 THROW_IO_ERROR( wxString::Format( _( "Unsupported wire shape: '%s' for net: '%s'" ),
471 DLEX::GetTokenString(shape).GetData(),
472 netId.GetData() ) );
473 */
474 }
475 else
476 {
477 PATH* path = (PATH*) wire->m_shape;
478
479 for( unsigned pt=0; pt < path->points.size()-1; ++pt )
480 {
481 PCB_TRACK* track = makeTRACK( wire, path, pt, netoutCode );
482 aBoard->Add( track );
483 }
484 }
485 }
486
487 WIRE_VIAS& wire_vias = net->wire_vias;
489
490 for( unsigned i=0; i<wire_vias.size(); ++i )
491 {
492 int netCode = 0;
493
494 // page 144 of spec says wire_via's net_id is optional
495 if( net->net_id.size() )
496 {
497 wxString netName = From_UTF8( net->net_id.c_str() );
498 NETINFO_ITEM* netvia = aBoard->FindNet( netName );
499
500 if( netvia )
501 netCode = netvia->GetNetCode();
502 }
503
504 WIRE_VIA* wire_via = &wire_vias[i];
505
506 // example: (via Via_15:8_mil 149000 -71000 )
507
508 PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
509 if( !padstack )
510 {
511 // Dick Feb 29, 2008:
512 // Freerouter has a bug where it will not round trip all vias. Vias which have
513 // a (use_via) element will be round tripped. Vias which do not, don't come back
514 // in in the session library, even though they may be actually used in the
515 // pre-routed, protected wire_vias. So until that is fixed, create the padstack
516 // from its name as a work around.
517 wxString psid( From_UTF8( wire_via->GetPadstackId().c_str() ) );
518
519 THROW_IO_ERROR( wxString::Format( _( "A wire_via refers to missing padstack '%s'." ),
520 psid ) );
521 }
522
523 std::shared_ptr<NET_SETTINGS>& netSettings = aBoard->GetDesignSettings().m_NetSettings;
524
525 int via_drill_default = netSettings->m_DefaultNetClass->GetViaDrill();
526
527 for( unsigned v = 0; v < wire_via->m_vertexes.size(); ++v )
528 {
529 PCB_VIA* via = makeVIA( wire_via, padstack, wire_via->m_vertexes[v], netCode,
530 via_drill_default );
531 aBoard->Add( via );
532 }
533 }
534 }
535}
536
537
538bool ImportSpecctraSession( BOARD* aBoard, const wxString& fullFileName )
539{
540 SPECCTRA_DB db;
541 LOCALE_IO toggle;
542
543 db.LoadSESSION( fullFileName );
544 db.FromSESSION( aBoard );
545
546 aBoard->GetConnectivity()->ClearRatsnest();
547 aBoard->BuildConnectivity();
548
549 return true;
550}
551} // namespace DSN
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
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:300
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:260
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:281
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:882
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1810
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:180
int GetCopperLayerCount() const
Definition: board.cpp:656
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:1126
const TRACKS & Tracks() const
Definition: board.h:320
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:1896
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:797
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1239
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:459
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:2297
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2369
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:221
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:2238
VECTOR2I GetPosition() const override
Definition: footprint.h:209
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:66
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
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:51
void SetWidth(int aWidth)
Definition: pcb_track.h:106
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:109
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:112
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:305
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:95
@ 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:72
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
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:85