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