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
53
54bool PCB_EDIT_FRAME::ImportSpecctraSession( const wxString& fullFileName )
55{
56 // To avoid issues with undo/redo lists (dangling pointers) clear the lists
57 // todo: use undo/redo feature
59
60 // Remove existing tracks from view. They will be readded later after loading new tracks.
61 if( GetCanvas() ) // clear view:
62 {
63 for( PCB_TRACK* track : GetBoard()->Tracks() )
64 GetCanvas()->GetView()->Remove( track );
65 }
66
67 SPECCTRA_DB db;
68 LOCALE_IO toggle;
69
70 try
71 {
72 db.LoadSESSION( fullFileName );
73 db.FromSESSION( GetBoard() );
74 }
75 catch( const IO_ERROR& ioe )
76 {
77 wxString msg = _( "Board may be corrupted, do not save it.\n Fix problem and try again" );
78
79 wxString extra = ioe.What();
80
81 DisplayErrorMessage( this, msg, extra);
82 return false;
83 }
84
85 GetBoard()->GetConnectivity()->ClearRatsnest();
87
88 OnModify();
89
90 if( GetCanvas() ) // Update view:
91 {
92 // Update footprint positions
94
95 // add imported tracks (previous tracks are removed, therefore all are new)
96 for( auto track : GetBoard()->Tracks() )
97 GetCanvas()->GetView()->Add( track );
98 }
99
100 SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );
101
102 Refresh();
103
104 return true;
105}
106
107
108namespace DSN {
109
110
118static int scale( double distance, UNIT_RES* aResolution )
119{
120 double resValue = aResolution->GetValue();
121 double factor;
122
123 switch( aResolution->GetEngUnits() )
124 {
125 default:
126 case T_inch: factor = 25.4e6; break; // nanometers per inch
127 case T_mil: factor = 25.4e3; break; // nanometers per mil
128 case T_cm: factor = 1e7; break; // nanometers per cm
129 case T_mm: factor = 1e6; break; // nanometers per mm
130 case T_um: factor = 1e3; break; // nanometers per um
131 }
132
133 return KiROUND( factor * distance / resValue );
134}
135
136
145static VECTOR2I mapPt( const POINT& aPoint, UNIT_RES* aResolution )
146{
147 VECTOR2I ret( scale( aPoint.x, aResolution ),
148 -scale( aPoint.y, aResolution ) ); // negate y
149
150 return ret;
151}
152
153
154PCB_TRACK* SPECCTRA_DB::makeTRACK( WIRE* wire, PATH* aPath, int aPointIndex, int aNetcode )
155{
156 int layerNdx = findLayerName( aPath->layer_id );
157
158 if( layerNdx == -1 )
159 {
160 THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'." ),
161 From_UTF8( aPath->layer_id.c_str() ) ) );
162 }
163
164 PCB_TRACK* track = new PCB_TRACK( m_sessionBoard );
165
166 track->SetStart( mapPt( aPath->points[aPointIndex+0], m_routeResolution ) );
167 track->SetEnd( mapPt( aPath->points[aPointIndex+1], m_routeResolution ) );
168 track->SetLayer( m_pcbLayer2kicad[layerNdx] );
169 track->SetWidth( scale( aPath->aperture_width, m_routeResolution ) );
170 track->SetNetCode( aNetcode );
171
172 // a track can be locked.
173 // However specctra as 4 types, none is exactly the same as our locked option
174 // wire->wire_type = T_fix, T_route, T_normal or T_protect
175 // fix and protect could be used as lock option
176 // but protect is returned for all tracks having initially the route or protect property
177 if( wire->m_wire_type == T_fix )
178 track->SetLocked( true );
179
180 return track;
181}
182
183
184PCB_VIA* SPECCTRA_DB::makeVIA( WIRE_VIA*aVia, PADSTACK* aPadstack, const POINT& aPoint, int aNetCode,
185 int aViaDrillDefault )
186{
187 PCB_VIA* via = nullptr;
188 SHAPE* shape;
189 int shapeCount = aPadstack->Length();
190 int drill_diam_iu = -1;
191 int copperLayerCount = m_sessionBoard->GetCopperLayerCount();
192
193
194 // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
195 // It is after the colon and before the last '_'
196 int drillStartNdx = aPadstack->m_padstack_id.find( ':' );
197
198 if( drillStartNdx != -1 )
199 {
200 ++drillStartNdx; // skip over the ':'
201
202 int drillEndNdx = aPadstack->m_padstack_id.rfind( '_' );
203 if( drillEndNdx != -1 )
204 {
205 std::string diam_txt( aPadstack->m_padstack_id,
206 drillStartNdx, drillEndNdx-drillStartNdx );
207
208 double drill_um = strtod( diam_txt.c_str(), 0 );
209
210 drill_diam_iu = int( drill_um * ( pcbIUScale.IU_PER_MM / 1000.0 ) );
211
212 if( drill_diam_iu == aViaDrillDefault )
213 drill_diam_iu = UNDEFINED_DRILL_DIAMETER;
214 }
215 }
216
217 if( shapeCount == 0 )
218 {
219 THROW_IO_ERROR( _( "Session via padstack has no shapes" ) );
220 }
221 else if( shapeCount == 1 )
222 {
223 shape = (SHAPE*) (*aPadstack)[0];
224 DSN_T type = shape->shape->Type();
225
226 if( type != T_circle )
227 {
228 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s." ),
229 GetTokenString( type ) ) );
230 }
231
232 CIRCLE* circle = (CIRCLE*) shape->shape;
233 int viaDiam = scale( circle->diameter, m_routeResolution );
234
235 via = new PCB_VIA( m_sessionBoard );
236 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
237 via->SetDrill( drill_diam_iu );
238 via->SetViaType( VIATYPE::THROUGH );
239 via->SetWidth( viaDiam );
240 via->SetLayerPair( F_Cu, B_Cu );
241 }
242 else if( shapeCount == copperLayerCount )
243 {
244 shape = (SHAPE*) (*aPadstack)[0];
245 DSN_T type = shape->shape->Type();
246
247 if( type != T_circle )
248 {
249 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
250 GetTokenString( type ) ) );
251 }
252
253 CIRCLE* circle = (CIRCLE*) shape->shape;
254 int viaDiam = scale( circle->diameter, m_routeResolution );
255
256 via = new PCB_VIA( m_sessionBoard );
257 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
258 via->SetDrill( drill_diam_iu );
259 via->SetViaType( VIATYPE::THROUGH );
260 via->SetWidth( viaDiam );
261 via->SetLayerPair( F_Cu, B_Cu );
262 }
263 else // VIA_MICROVIA or VIA_BLIND_BURIED
264 {
265 int topLayerNdx = -1; // session layer detectors
266 int botLayerNdx = INT_MAX;
267
268 int viaDiam = -1;
269
270 for( int i=0; i<shapeCount; ++i )
271 {
272 shape = (SHAPE*) (*aPadstack)[i];
273 DSN_T type = shape->shape->Type();
274
275 if( type != T_circle )
276 {
277 THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s" ),
278 GetTokenString( type ) ) );
279 }
280
281 CIRCLE* circle = (CIRCLE*) shape->shape;
282
283 int layerNdx = findLayerName( circle->layer_id );
284 if( layerNdx == -1 )
285 {
286 wxString layerName = From_UTF8( circle->layer_id.c_str() );
287 THROW_IO_ERROR( wxString::Format( _( "Session file uses invalid layer id '%s'" ),
288 layerName ) );
289 }
290
291 if( layerNdx > topLayerNdx )
292 topLayerNdx = layerNdx;
293
294 if( layerNdx < botLayerNdx )
295 botLayerNdx = layerNdx;
296
297 if( viaDiam == -1 )
298 viaDiam = scale( circle->diameter, m_routeResolution );
299 }
300
301 via = new PCB_VIA( m_sessionBoard );
302 via->SetPosition( mapPt( aPoint, m_routeResolution ) );
303 via->SetDrill( drill_diam_iu );
304
305 if( ( topLayerNdx == 0 && botLayerNdx == 1 )
306 || ( topLayerNdx == copperLayerCount-2 && botLayerNdx == copperLayerCount-1 ) )
307 {
308 via->SetViaType( VIATYPE::MICROVIA );
309 }
310 else
311 {
312 via->SetViaType( VIATYPE::BLIND_BURIED );
313 }
314
315 via->SetWidth( viaDiam );
316 via->SetLayerPair( m_pcbLayer2kicad[ topLayerNdx ], m_pcbLayer2kicad[ botLayerNdx ] );
317 }
318
319 wxASSERT( via );
320
321 via->SetNetCode( aNetCode );
322
323 // a via can be locked.
324 // However specctra as 4 types, none is exactly the same as our locked option
325 // aVia->via_type = T_fix, T_route, T_normal or T_protect
326 // fix and protect could be used as lock option
327 // but protect is returned for all tracks having initially the route or protect property
328 if( aVia->m_via_type == T_fix )
329 via->SetLocked( true );
330
331 return via;
332}
333
334
335// no UI code in this function, throw exception to report problems to the
336// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
337
339{
340 m_sessionBoard = aBoard; // not owned here
341
342 if( !m_session )
343 THROW_IO_ERROR( _("Session file is missing the \"session\" section") );
344
345 if( !m_session->route )
346 THROW_IO_ERROR( _("Session file is missing the \"routes\" section") );
347
348 if( !m_session->route->library )
349 THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") );
350
351 // delete the old tracks and vias but save locked tracks/vias; they will be re-added later
352 std::vector<PCB_TRACK*> locked;
353
354 while( !aBoard->Tracks().empty() )
355 {
356 PCB_TRACK* track = aBoard->Tracks().back();
357 aBoard->Tracks().pop_back();
358
359 if( track->IsLocked() )
360 {
361 locked.push_back( track );
362 }
363 else
364 {
365 if( PCB_GROUP* group = track->GetParentGroup() )
366 group->RemoveItem( track );
367
368 delete track;
369 }
370 }
371
372 aBoard->DeleteMARKERs();
373
374 buildLayerMaps( aBoard );
375
376 // Add locked tracks: because they are exported as Fix tracks, they are not
377 // in .ses file.
378 for( PCB_TRACK* track: locked )
379 aBoard->Add( track );
380
381 if( m_session->placement )
382 {
383 // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
384 // each COMPONENT, reposition and re-orient each component and put on
385 // correct side of the board.
387
388 for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp )
389 {
390 PLACES& places = comp->m_places;
391 for( unsigned i=0; i<places.size(); ++i )
392 {
393 PLACE* place = &places[i]; // '&' even though places[] holds a pointer!
394
395 wxString reference = From_UTF8( place->m_component_id.c_str() );
396 FOOTPRINT* footprint = aBoard->FindFootprintByReference( reference );
397
398 if( !footprint )
399 {
400 THROW_IO_ERROR( wxString::Format( _( "Reference '%s' not found." ),
401 reference ) );
402 }
403
404 if( !place->m_hasVertex )
405 continue;
406
407 UNIT_RES* resolution = place->GetUnits();
408 wxASSERT( resolution );
409
410 VECTOR2I newPos = mapPt( place->m_vertex, resolution );
411 footprint->SetPosition( newPos );
412
413 if( place->m_side == T_front )
414 {
415 // convert from degrees to tenths of degrees used in KiCad.
416 EDA_ANGLE orientation( place->m_rotation, DEGREES_T );
417
418 if( footprint->GetLayer() != F_Cu )
419 {
420 // footprint is on copper layer (back)
421 footprint->Flip( footprint->GetPosition(), false );
422 }
423
424 footprint->SetOrientation( orientation );
425 }
426 else if( place->m_side == T_back )
427 {
428 EDA_ANGLE orientation( place->m_rotation + 180.0, DEGREES_T );
429
430 if( footprint->GetLayer() != B_Cu )
431 {
432 // footprint is on component layer (front)
433 footprint->Flip( footprint->GetPosition(), false );
434 }
435
436 footprint->SetOrientation( orientation );
437 }
438 else
439 {
440 // as I write this, the PARSER *is* catching this, so we should never see below:
441 wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") );
442 }
443 }
444 }
445 }
446
448
449 // Walk the NET_OUTs and create tracks and vias anew.
450 NET_OUTS& net_outs = m_session->route->net_outs;
451 for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net )
452 {
453 int netoutCode = 0;
454
455 // page 143 of spec says wire's net_id is optional
456 if( net->net_id.size() )
457 {
458 wxString netName = From_UTF8( net->net_id.c_str() );
459 NETINFO_ITEM* netinfo = aBoard->FindNet( netName );
460
461 if( netinfo )
462 netoutCode = netinfo->GetNetCode();
463 }
464
465 WIRES& wires = net->wires;
466 for( unsigned i = 0; i<wires.size(); ++i )
467 {
468 WIRE* wire = &wires[i];
469 DSN_T shape = wire->m_shape->Type();
470
471 if( shape != T_path )
472 {
473 /*
474 * shape == T_polygon is expected from freerouter if you have a zone on a non-
475 * "power" type layer, i.e. a T_signal layer and the design does a round-trip
476 * back in as session here. We kept our own zones in the BOARD, so ignore this
477 * so called 'wire'.
478
479 wxString netId = From_UTF8( wire->net_id.c_str() );
480 THROW_IO_ERROR( wxString::Format( _( "Unsupported wire shape: '%s' for net: '%s'" ),
481 DLEX::GetTokenString(shape).GetData(),
482 netId.GetData() ) );
483 */
484 }
485 else
486 {
487 PATH* path = (PATH*) wire->m_shape;
488
489 for( unsigned pt=0; pt < path->points.size()-1; ++pt )
490 {
491 PCB_TRACK* track = makeTRACK( wire, path, pt, netoutCode );
492 aBoard->Add( track );
493 }
494 }
495 }
496
497 WIRE_VIAS& wire_vias = net->wire_vias;
499
500 for( unsigned i=0; i<wire_vias.size(); ++i )
501 {
502 int netCode = 0;
503
504 // page 144 of spec says wire_via's net_id is optional
505 if( net->net_id.size() )
506 {
507 wxString netName = From_UTF8( net->net_id.c_str() );
508 NETINFO_ITEM* netvia = aBoard->FindNet( netName );
509
510 if( netvia )
511 netCode = netvia->GetNetCode();
512 }
513
514 WIRE_VIA* wire_via = &wire_vias[i];
515
516 // example: (via Via_15:8_mil 149000 -71000 )
517
518 PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
519 if( !padstack )
520 {
521 // Dick Feb 29, 2008:
522 // Freerouter has a bug where it will not round trip all vias. Vias which have
523 // a (use_via) element will be round tripped. Vias which do not, don't come back
524 // in in the session library, even though they may be actually used in the
525 // pre-routed, protected wire_vias. So until that is fixed, create the padstack
526 // from its name as a work around.
527 wxString psid( From_UTF8( wire_via->GetPadstackId().c_str() ) );
528
529 THROW_IO_ERROR( wxString::Format( _( "A wire_via refers to missing padstack '%s'." ),
530 psid ) );
531 }
532
533 std::shared_ptr<NET_SETTINGS>& netSettings = aBoard->GetDesignSettings().m_NetSettings;
534
535 int via_drill_default = netSettings->m_DefaultNetClass->GetViaDrill();
536
537 for( unsigned v = 0; v < wire_via->m_vertexes.size(); ++v )
538 {
539 PCB_VIA* via = makeVIA( wire_via, padstack, wire_via->m_vertexes[v], netCode,
540 via_drill_default );
541 aBoard->Add( via );
542 }
543 }
544 }
545}
546
547
548} // namespace DSN
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
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:278
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:238
virtual bool IsLocked() const
Definition: board_item.cpp:73
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:271
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:820
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1562
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:168
int GetCopperLayerCount() const
Definition: board.cpp:590
TRACKS & Tracks()
Definition: board.h:310
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:1583
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:731
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1054
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:433
std::string layer_id
Definition: specctra.h:775
double diameter
Definition: specctra.h:777
int Length() const
Return the number of ELEMs in this holder.
Definition: specctra.h:317
virtual UNIT_RES * GetUnits() const
Return the units for this section.
Definition: specctra.cpp:3764
DSN_T Type() const
Definition: specctra.h:210
A <library_descriptor> in the specctra dsn specification.
Definition: specctra.h:2252
Hold either a via or a pad definition.
Definition: specctra.h:2121
std::string m_padstack_id
Definition: specctra.h:2220
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
Definition: specctra.h:583
POINTS points
Definition: specctra.h:653
double aperture_width
Definition: specctra.h:651
std::string layer_id
Definition: specctra.h:650
COMPONENTS m_components
Definition: specctra.h:1882
Implement a <placement_reference> in the specctra dsn spec.
Definition: specctra.h:1688
bool m_hasVertex
Definition: specctra.h:1739
POINT m_vertex
Definition: specctra.h:1740
DSN_T m_side
Definition: specctra.h:1735
double m_rotation
Definition: specctra.h:1737
std::string m_component_id
reference designator
Definition: specctra.h:1733
UNIT_RES * GetUnits() const override
Return the units for this section.
Definition: specctra.h:3469
NET_OUTS net_outs
Definition: specctra.h:3512
LIBRARY * library
Definition: specctra.h:3511
PLACEMENT * placement
Definition: specctra.h:3624
ROUTE * route
Definition: specctra.h:3626
A "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1894
A DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3642
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:3989
BOARD * m_sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3992
SESSION * m_session
Definition: specctra.h:3975
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3986
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:403
DSN_T GetEngUnits() const
Definition: specctra.h:419
int GetValue() const
Definition: specctra.h:420
ELEM * shape
Definition: specctra.h:893
A <wire_via_descriptor> in the specctra dsn spec.
Definition: specctra.h:2984
DSN_T m_via_type
Definition: specctra.h:3117
const std::string & GetPadstackId()
Definition: specctra.h:2995
POINTS m_vertexes
Definition: specctra.h:3114
A <wire_shape_descriptor> in the specctra dsn spec.
Definition: specctra.h:2875
DSN_T m_wire_type
Definition: specctra.h:2969
ELEM * m_shape
Definition: specctra.h:2965
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1944
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2016
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:218
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1884
VECTOR2I GetPosition() const override
Definition: footprint.h:206
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
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:59
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:76
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1401
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:67
int GetNetCode() const
Definition: netinfo.h:119
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:38
@ B_Cu
Definition: layer_ids.h:96
@ F_Cu
Definition: layer_ids.h:65
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:3445
static POINT mapPt(const VECTOR2I &pt)
Convert a KiCad point into a DSN file point.
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2977
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1761
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3124
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1812
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:103
double y
Definition: specctra.h:105
double x
Definition: specctra.h:104
const double IU_PER_MM
Definition: base_units.h:77
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