KiCad PCB EDA Suite
Loading...
Searching...
No Matches
exporter_step.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) 2022 Mark Roszko <[email protected]>
5 * Copyright (C) 2016 Cirilo Bernardo <[email protected]>
6 * Copyright (C) 2016-2024 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include "exporter_step.h"
27#include <advanced_config.h>
28#include <board.h>
30#include <footprint.h>
31#include <pcb_track.h>
32#include <pcb_shape.h>
33#include <pad.h>
34#include <zone.h>
35#include <fp_lib_table.h>
36#include "step_pcb_model.h"
37
38#include <pgm_base.h>
39#include <base_units.h>
40#include <filename_resolver.h>
41#include <trace_helpers.h>
42#include <project_pcb.h>
44
45#include <Message.hxx> // OpenCascade messenger
46#include <Message_PrinterOStream.hxx> // OpenCascade output messenger
47#include <Standard_Failure.hxx> // In open cascade
48
49#include <Standard_Version.hxx>
50
51#include <wx/crt.h>
52#include <wx/log.h>
53#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
54
55#define OCC_VERSION_MIN 0x070500
56
57#if OCC_VERSION_HEX < OCC_VERSION_MIN
58#include <Message_Messenger.hxx>
59#endif
60
61
62void ReportMessage( const wxString& aMessage )
63{
64 wxPrintf( aMessage );
65 fflush( stdout ); // Force immediate printing (needed on mingw)
66}
67
68class KiCadPrinter : public Message_Printer
69{
70public:
71 KiCadPrinter( EXPORTER_STEP* aConverter ) : m_converter( aConverter ) {}
72
73protected:
74#if OCC_VERSION_HEX < OCC_VERSION_MIN
75 virtual void Send( const TCollection_ExtendedString& theString,
76 const Message_Gravity theGravity,
77 const Standard_Boolean theToPutEol ) const override
78 {
79 Send( TCollection_AsciiString( theString ), theGravity, theToPutEol );
80 }
81
82 virtual void Send( const TCollection_AsciiString& theString,
83 const Message_Gravity theGravity,
84 const Standard_Boolean theToPutEol ) const override
85#else
86 virtual void send( const TCollection_AsciiString& theString,
87 const Message_Gravity theGravity ) const override
88#endif
89 {
90 if( theGravity >= Message_Warning
91 || ( wxLog::IsAllowedTraceMask( traceKiCad2Step ) && theGravity == Message_Info ) )
92 {
93 ReportMessage( theString.ToCString() );
94
95#if OCC_VERSION_HEX < OCC_VERSION_MIN
96 if( theToPutEol )
97 ReportMessage( wxT( "\n" ) );
98#else
99 ReportMessage( wxT( "\n" ) );
100#endif
101 }
102
103 if( theGravity == Message_Warning )
105
106 if( theGravity >= Message_Alarm )
108
109 if( theGravity == Message_Fail )
111 }
112
113private:
115};
116
117
119{
120 switch( m_format )
121 {
122 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "step" );
123 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "brep" );
124 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "xao" );
125 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "glb" );
126 default: return wxEmptyString; // shouldn't happen
127 }
128}
129
131{
132 switch( m_format )
133 {
134 // honestly these names shouldn't be translated since they are mostly industry standard acronyms
135 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "STEP" );
136 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "BREP" );
137 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "XAO" );
138 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "Binary GLTF" );
139 default: return wxEmptyString; // shouldn't happen
140 }
141}
142
143
145 m_params( aParams ),
146 m_error( false ),
147 m_fail( false ),
148 m_warn( false ),
149 m_board( aBoard ),
150 m_pcbModel( nullptr )
151{
152 m_solderMaskColor = COLOR4D( 0.08, 0.20, 0.14, 0.83 );
153 m_copperColor = COLOR4D( 0.7, 0.61, 0.0, 1.0 );
154
155 // Init m_pcbBaseName to the board short filename (no path, no ext)
156 // m_pcbName is used later to identify items in step file
157 wxFileName fn( aBoard->GetFileName() );
158 m_pcbBaseName = fn.GetName();
159
160 // Remove the autosave prefix
162
163 m_resolver = std::make_unique<FILENAME_RESOLVER>();
164 m_resolver->Set3DConfigDir( wxT( "" ) );
165 // needed to add the project to the search stack
166 m_resolver->SetProject( aBoard->GetProject() );
167 m_resolver->SetProgramBase( &Pgm() );
168}
169
170
172{
173}
174
175
177{
178 bool hasdata = false;
179 std::vector<PAD*> padsMatchingNetFilter;
180
181 // Dump the pad holes into the PCB
182 for( PAD* pad : aFootprint->Pads() )
183 {
184 if( m_pcbModel->AddPadHole( pad, aOrigin ) )
185 hasdata = true;
186
187 if( !m_params.m_netFilter.IsEmpty() && !pad->GetNetname().Matches( m_params.m_netFilter ) )
188 continue;
189
191 {
192 if( m_pcbModel->AddPadShape( pad, aOrigin, false ) )
193 hasdata = true;
194 }
195
196 padsMatchingNetFilter.push_back( pad );
197 }
198
199 // Build 3D shapes of the footprint graphic items on external layers:
201 {
202 int maxError = m_board->GetDesignSettings().m_MaxError;
203
204 for( PCB_LAYER_ID pcblayer : LSET( aFootprint->GetLayerSet() & LSET::AllCuMask() ).Seq() )
205 {
206 SHAPE_POLY_SET buffer;
207
208 aFootprint->TransformFPShapesToPolySet( buffer, pcblayer, 0, maxError, ERROR_INSIDE,
209 false, /* include text */
210 true, /* include shapes */
211 false /* include private items */ );
212
213 if( m_params.m_netFilter.IsEmpty() )
214 {
215 m_poly_copper_shapes[pcblayer].Append( buffer );
216 }
217 else
218 {
219 // Only add shapes colliding with any matching pads
220 for( const SHAPE_POLY_SET::POLYGON& poly : buffer.CPolygons() )
221 {
222 for( PAD* pad : padsMatchingNetFilter )
223 {
224 if( !pad->IsOnLayer( pcblayer ) )
225 continue;
226
227 std::shared_ptr<SHAPE_POLY_SET> padPoly = pad->GetEffectivePolygon();
228 SHAPE_POLY_SET gfxPoly( poly );
229
230 if( padPoly->Collide( &gfxPoly ) )
231 {
232 m_poly_copper_shapes[pcblayer].Append( gfxPoly );
233 break;
234 }
235 }
236 }
237 }
238 }
239 }
240
241 if( ( !(aFootprint->GetAttributes() & (FP_THROUGH_HOLE|FP_SMD)) ) && !m_params.m_includeUnspecified )
242 {
243 return hasdata;
244 }
245
246 if( ( aFootprint->GetAttributes() & FP_DNP ) && !m_params.m_includeDNP )
247 {
248 return hasdata;
249 }
250
251 // Prefetch the library for this footprint
252 // In case we need to resolve relative footprint paths
253 wxString libraryName = aFootprint->GetFPID().GetLibNickname();
254 wxString footprintBasePath = wxEmptyString;
255
256 double posX = aFootprint->GetPosition().x - aOrigin.x;
257 double posY = (aFootprint->GetPosition().y) - aOrigin.y;
258
259 if( m_board->GetProject() )
260 {
261 try
262 {
263 // FindRow() can throw an exception
264 const FP_LIB_TABLE_ROW* fpRow =
265 PROJECT_PCB::PcbFootprintLibs( m_board->GetProject() )->FindRow( libraryName, false );
266
267 if( fpRow )
268 footprintBasePath = fpRow->GetFullURI( true );
269 }
270 catch( ... )
271 {
272 // Do nothing if the libraryName is not found in lib table
273 }
274 }
275
276 // Exit early if we don't want to include footprint models
278 {
279 return hasdata;
280 }
281
282 VECTOR2D newpos( pcbIUScale.IUTomm( posX ), pcbIUScale.IUTomm( posY ) );
283
284 for( const FP_3DMODEL& fp_model : aFootprint->Models() )
285 {
286 if( !fp_model.m_Show || fp_model.m_Filename.empty() )
287 continue;
288
289 std::vector<wxString> searchedPaths;
290 wxString mname = m_resolver->ResolvePath( fp_model.m_Filename, footprintBasePath );
291
292
293 if( mname.empty() || !wxFileName::FileExists( mname ) )
294 {
295 // the error path will return an empty name sometimes, at least report back the original filename
296 if( mname.empty() )
297 mname = fp_model.m_Filename;
298
299 ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n"
300 "File not found: %s\n" ),
301 aFootprint->GetReference(), mname ) );
302 continue;
303 }
304
305 std::string fname( mname.ToUTF8() );
306 std::string refName( aFootprint->GetReference().ToUTF8() );
307 try
308 {
309 bool bottomSide = aFootprint->GetLayer() == B_Cu;
310
311 // the rotation is stored in degrees but opencascade wants radians
312 VECTOR3D modelRot = fp_model.m_Rotation;
313 modelRot *= M_PI;
314 modelRot /= 180.0;
315
316 if( m_pcbModel->AddComponent( fname, refName, bottomSide,
317 newpos,
318 aFootprint->GetOrientation().AsRadians(),
319 fp_model.m_Offset, modelRot,
320 fp_model.m_Scale, m_params.m_substModels ) )
321 {
322 hasdata = true;
323 }
324 }
325 catch( const Standard_Failure& e )
326 {
327 ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n"
328 "OpenCASCADE error: %s\n" ),
329 aFootprint->GetReference(), e.GetMessageString() ) );
330 }
331
332 }
333
334 return hasdata;
335}
336
337
339{
340 if( !m_params.m_netFilter.IsEmpty() && !aTrack->GetNetname().Matches( m_params.m_netFilter ) )
341 return true;
342
343 if( aTrack->Type() == PCB_VIA_T )
344 {
345 return m_pcbModel->AddViaShape( static_cast<const PCB_VIA*>( aTrack ), aOrigin );
346 }
347
348 PCB_LAYER_ID pcblayer = aTrack->GetLayer();
349
350 if( !IsCopperLayer( pcblayer ) )
351 return false;
352
353 if( aTrack->Type() == PCB_ARC_T )
354 {
355 int maxError = m_board->GetDesignSettings().m_MaxError;
356
357 aTrack->TransformShapeToPolygon( m_poly_copper_shapes[pcblayer], pcblayer, 0, maxError,
358 ERROR_INSIDE );
359 }
360 else
361 m_pcbModel->AddTrackSegment( aTrack, aOrigin );
362
363 return true;
364}
365
366
368{
369 for( ZONE* zone : m_board->Zones() )
370 {
371 if( !m_params.m_netFilter.IsEmpty() && !zone->GetNetname().Matches( m_params.m_netFilter ) )
372 continue;
373
374 for( PCB_LAYER_ID layer : zone->GetLayerSet().CuStack() )
375 {
376 SHAPE_POLY_SET copper_shape;
377 zone->TransformSolidAreasShapesToPolygon( layer, copper_shape );
379
380 copper_shape.SimplifyOutlines(
381 ADVANCED_CFG::GetCfg().m_TriangulateSimplificationLevel );
382
383 m_pcbModel->AddCopperPolygonShapes( &copper_shape, layer, aOrigin, false );
384 }
385 }
386}
387
388
390{
391 PCB_SHAPE* graphic = dynamic_cast<PCB_SHAPE*>( aItem );
392
393 if( !graphic )
394 return false;
395
396 if( !m_params.m_netFilter.IsEmpty() && !graphic->GetNetname().Matches( m_params.m_netFilter ) )
397 return true;
398
399 PCB_LAYER_ID pcblayer = graphic->GetLayer();
400
401 if( !IsCopperLayer( pcblayer ) )
402 return false;
403
404 int maxError = m_board->GetDesignSettings().m_MaxError;
405
406 graphic->TransformShapeToPolygon( m_poly_copper_shapes[pcblayer], pcblayer, 0, maxError,
407 ERROR_INSIDE );
408
409 return true;
410}
411
412
414{
415 if( m_pcbModel )
416 return true;
417
418 SHAPE_POLY_SET pcbOutlines; // stores the board main outlines
419
420 if( !m_board->GetBoardPolygonOutlines( pcbOutlines,
421 /* error handler */ nullptr,
422 /* allows use arcs in outlines */ true ) )
423 {
424 wxLogWarning( _( "Board outline is malformed. Run DRC for a full analysis." ) );
425 }
426
427 LSET layersToExport = LSET::ExternalCuMask();
428
430 layersToExport |= LSET::InternalCuMask();
431
432 layersToExport &= m_board->GetEnabledLayers();
433
434 VECTOR2D origin;
435
436 // Determine the coordinate system reference:
437 // Precedence of reference point is Drill Origin > Grid Origin > User Offset
440 else if( m_params.m_useGridOrigin )
442 else
443 origin = m_params.m_origin;
444
445 m_pcbModel = std::make_unique<STEP_PCB_MODEL>( m_pcbBaseName );
446
447 // TODO: Handle when top & bottom soldermask colours are different...
450
451 m_pcbModel->SetStackup( m_board->GetStackupOrDefault() );
452 m_pcbModel->SetEnabledLayers( layersToExport );
453 m_pcbModel->SetFuseShapes( m_params.m_fuseShapes );
454 m_pcbModel->SetNetFilter( m_params.m_netFilter );
455
456 // Note: m_params.m_BoardOutlinesChainingEpsilon is used only to build the board outlines,
457 // not to set OCC chaining epsilon (much smaller)
458 //
459 // Set the min distance between 2 points for OCC to see these 2 points as merged
460 // OCC_MAX_DISTANCE_TO_MERGE_POINTS is acceptable for OCC, otherwise there are issues
461 // to handle the shapes chaining on copper layers, because the Z dist is 0.035 mm and the
462 // min dist must be much smaller (we use 0.001 mm giving good results)
463 m_pcbModel->OCCSetMergeMaxDistance( OCC_MAX_DISTANCE_TO_MERGE_POINTS );
464
466
467 // For copper layers, only pads and tracks are added, because adding everything on copper
468 // generate unreasonable file sizes and take a unreasonable calculation time.
469 for( FOOTPRINT* fp : m_board->Footprints() )
470 buildFootprint3DShapes( fp, origin );
471
473 {
474 for( PCB_TRACK* track : m_board->Tracks() )
475 buildTrack3DShape( track, origin );
476
477 for( BOARD_ITEM* item : m_board->Drawings() )
478 buildGraphic3DShape( item, origin );
479 }
480
481 for( PCB_LAYER_ID pcblayer : layersToExport.Seq() )
482 {
483 m_pcbModel->AddCopperPolygonShapes( &m_poly_copper_shapes[pcblayer], pcblayer, origin,
484 true );
485 }
486
488 {
489 buildZones3DShape( origin );
490 }
491
492 ReportMessage( wxT( "Create PCB solid model\n" ) );
493
494 wxString msg;
495 msg.Printf( wxT( "Board outline: find %d initial points\n" ), pcbOutlines.FullPointCount() );
496 ReportMessage( msg );
497
498 if( !m_pcbModel->CreatePCB( pcbOutlines, origin, m_params.m_exportBoardBody ) )
499 {
500 ReportMessage( wxT( "could not create PCB solid model\n" ) );
501 return false;
502 }
503
504 return true;
505}
506
507
509{
510 // Display the export time, for statistics
511 int64_t stats_startExportTime = GetRunningMicroSecs();
512
513 // setup opencascade message log
514 Message::DefaultMessenger()->RemovePrinters( STANDARD_TYPE( Message_PrinterOStream ) );
515 Message::DefaultMessenger()->AddPrinter( new KiCadPrinter( this ) );
516
517 ReportMessage( _( "Determining PCB data\n" ) );
518
519 if( m_params.m_outputFile.IsEmpty() )
520 {
521 wxFileName fn = m_board->GetFileName();
522 fn.SetName( fn.GetName() );
523 fn.SetExt( m_params.GetDefaultExportExtension() );
524
525 m_params.m_outputFile = fn.GetFullName();
526 }
527
528 try
529 {
530 ReportMessage( wxString::Format( _( "Build %s data\n" ), m_params.GetFormatName() ) );
531
532 if( !buildBoard3DShapes() )
533 {
534 ReportMessage( _( "\n** Error building STEP board model. Export aborted. **\n" ) );
535 return false;
536 }
537
538 ReportMessage( wxString::Format( _( "Writing %s file\n" ), m_params.GetFormatName() ) );
539
540 bool success = true;
542 success = m_pcbModel->WriteSTEP( m_outputFile, m_params.m_optimizeStep );
544 success = m_pcbModel->WriteBREP( m_outputFile );
546 success = m_pcbModel->WriteXAO( m_outputFile );
548 success = m_pcbModel->WriteGLTF( m_outputFile );
549
550 if( !success )
551 {
552 ReportMessage( wxString::Format( _( "\n** Error writing %s file. **\n" ),
554 return false;
555 }
556 else
557 {
558 ReportMessage( wxString::Format( _( "%s file '%s' created.\n" ),
560 }
561 }
562 catch( const Standard_Failure& e )
563 {
564 ReportMessage( e.GetMessageString() );
565 ReportMessage( wxString::Format( _( "\n** Error exporting %s file. Export aborted. **\n" ),
567 return false;
568 }
569 catch( ... )
570 {
571 ReportMessage( wxString::Format( _( "\n** Error exporting %s file. Export aborted. **\n" ),
573 return false;
574 }
575
576 if( m_fail || m_error )
577 {
578 wxString msg;
579
580 if( m_fail )
581 {
582 msg = wxString::Format( _( "Unable to create %s file.\n"
583 "Check that the board has a valid outline and models." ),
585 }
586 else if( m_error || m_warn )
587 {
588 msg = wxString::Format( _( "%s file has been created, but there are warnings." ),
590 }
591
592 ReportMessage( msg );
593 }
594
595 // Display calculation time in seconds
596 double calculation_time = (double)( GetRunningMicroSecs() - stats_startExportTime) / 1e6;
597 ReportMessage( wxString::Format( _( "\nExport time %.3f s\n" ), calculation_time ) );
598
599 return true;
600}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
const VECTOR2I & GetGridOrigin()
const VECTOR2I & GetAuxOrigin()
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:226
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:231
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
BOARD_STACKUP GetStackupOrDefault() const
Definition: board.cpp:2177
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
Definition: board.cpp:2380
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:680
const ZONES & Zones() const
Definition: board.h:327
const FOOTPRINTS & Footprints() const
Definition: board.h:323
const TRACKS & Tracks() const
Definition: board.h:321
const wxString & GetFileName() const
Definition: board.h:319
PROJECT * GetProject() const
Definition: board.h:476
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:797
const DRAWINGS & Drawings() const
Definition: board.h:325
double AsRadians() const
Definition: eda_angle.h:159
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
wxString GetDefaultExportExtension()
void buildZones3DShape(VECTOR2D aOrigin)
KIGFX::COLOR4D m_solderMaskColor
wxString m_outputFile
bool buildGraphic3DShape(BOARD_ITEM *aItem, VECTOR2D aOrigin)
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_poly_copper_shapes
EXPORTER_STEP_PARAMS m_params
EXPORTER_STEP(BOARD *aBoard, const EXPORTER_STEP_PARAMS &aParams)
wxString m_pcbBaseName
the name of the project (board short filename (no path, no ext) used to identify items in step file
bool buildFootprint3DShapes(FOOTPRINT *aFootprint, VECTOR2D aOrigin)
std::unique_ptr< FILENAME_RESOLVER > m_resolver
bool buildBoard3DShapes()
std::unique_ptr< STEP_PCB_MODEL > m_pcbModel
bool buildTrack3DShape(PCB_TRACK *aTrack, VECTOR2D aOrigin)
KIGFX::COLOR4D m_copperColor
EDA_ANGLE GetOrientation() const
Definition: footprint.h:212
int GetAttributes() const
Definition: footprint.h:276
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:221
PADS & Pads()
Definition: footprint.h:191
void TransformFPShapesToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIncludeText=true, bool aIncludeShapes=true, bool aIncludePrivateItems=false) const
Generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aB...
Definition: footprint.cpp:3646
const LIB_ID & GetFPID() const
Definition: footprint.h:233
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:205
const wxString & GetReference() const
Definition: footprint.h:588
VECTOR2I GetPosition() const override
Definition: footprint.h:209
Hold a record identifying a library accessed by the appropriate footprint library #PLUGIN object in t...
Definition: fp_lib_table.h:42
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double r
Red component.
Definition: color4d.h:392
double g
Green component.
Definition: color4d.h:393
double b
Blue component.
Definition: color4d.h:394
EXPORTER_STEP * m_converter
KiCadPrinter(EXPORTER_STEP *aConverter)
virtual void Send(const TCollection_ExtendedString &theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const override
virtual void Send(const TCollection_AsciiString &theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const override
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:575
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:891
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:418
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:823
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:863
Definition: pad.h:59
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
Definition: pcb_shape.cpp:786
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:70
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the track shape to a closed polygon.
Definition: pcb_track.cpp:1641
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
Represent a set of closed polygons.
int FullPointCount() const
Return the number of points in the shape poly set.
std::vector< SHAPE_LINE_CHAIN > POLYGON
represents a single polygon outline with holes.
void Unfracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
void SimplifyOutlines(int aMaxError=0)
Simplifies the lines in the polyset.
const std::vector< POLYGON > & CPolygons() const
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
#define _(s)
void ReportMessage(const wxString &aMessage)
@ FP_SMD
Definition: footprint.h:73
@ FP_DNP
Definition: footprint.h:80
@ FP_THROUGH_HOLE
Definition: footprint.h:72
@ ERROR_INSIDE
static const std::string AutoSaveFilePrefix
const wxChar *const traceKiCad2Step
Flag to enable KiCad2Step debug tracing.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:881
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ B_Cu
Definition: layer_ids.h:95
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
int64_t GetRunningMicroSecs()
An alternate way to calculate an elapsed time (in microsecondes) to class PROF_COUNTER.
static constexpr double OCC_MAX_DISTANCE_TO_MERGE_POINTS
Default distance between points to treat them as separate ones (mm) 0.001 mm or less is a reasonable ...
constexpr double IUTomm(int iu) const
Definition: base_units.h:86
wxLogTrace helper definitions.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
Definition of file extensions used in Kicad.