26#include <wx/zipstrm.h>
27#include <wx/filename.h>
28#include <wx/tokenzr.h>
29#include <wx/wfstream.h>
31#include <nlohmann/json.hpp>
143#include <api/board/board.pb.h>
144#include <google/protobuf/util/json_util.h>
167 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
173 wxCHECK( bomJob && editFrame,
false );
183 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
190 wxCHECK( svgJob && editFrame,
false );
196 [](
JOB* job, wxWindow* aParent ) ->
bool
200 wxCHECK( renderJob,
false );
206 [](
JOB* job, wxWindow* aParent ) ->
bool
211 [](
JOB* job, wxWindow* aParent ) ->
bool
216 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
223 wxCHECK( svgJob && editFrame,
false );
229 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
236 wxCHECK( gencadJob && editFrame,
false );
242 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
249 wxCHECK( dxfJob && editFrame,
false );
255 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
262 wxCHECK( pdfJob && editFrame,
false );
268 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
275 wxCHECK( pngJob && editFrame,
false );
281 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
288 wxCHECK( psJob && editFrame,
false );
294 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
301 wxCHECK( statsJob && editFrame,
false );
306 statsJob->
m_filename = boardName.GetFullPath();
309 wxWindow* parent = aParent ? aParent :
static_cast<wxWindow*
>( editFrame );
316 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
323 wxCHECK( stackupJob && editFrame,
false );
328 stackupJob->
m_filename = boardName.GetFullPath();
331 wxWindow* parent = aParent ? aParent :
static_cast<wxWindow*
>( editFrame );
338 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
345 wxCHECK( gJob && editFrame,
false );
351 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
358 wxCHECK( gJob && editFrame,
false );
367 m_reporter->Report(
_(
"Plotting to HPGL is no longer supported as of KiCad 10.0.\n" ),
371 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
375 wxCHECK( editFrame,
false );
377 DisplayErrorMessage( editFrame,
_(
"Plotting to HPGL is no longer supported as of KiCad 10.0." ) );
381 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
388 wxCHECK( drillJob && editFrame,
false );
394 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
401 wxCHECK( posJob && editFrame,
false );
407 [](
JOB* job, wxWindow* aParent ) ->
bool
412 [](
JOB* job, wxWindow* aParent ) ->
bool
417 [](
JOB* job, wxWindow* aParent ) ->
bool
422 [](
JOB* job, wxWindow* aParent ) ->
bool
427 [](
JOB* job, wxWindow* aParent ) ->
bool
431 wxCHECK( drcJob,
false );
437 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
444 wxCHECK( ipcJob && editFrame,
false );
450 [](
JOB* job, wxWindow* aParent ) ->
bool
455 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
462 wxCHECK( odbJob && editFrame,
false );
468 [aKiway](
JOB* job, wxWindow* aParent ) ->
bool
475 wxCHECK( idfJob && editFrame,
false );
523 BOARD* brd =
nullptr;
527 auto getProjectForBoard = [&](
const wxString& aBoardPath ) ->
PROJECT*
529 wxFileName pro = aBoardPath;
537 settingsManager.
LoadProject( pro.GetFullPath(),
true );
544 auto loadBoardFromPath = [&](
const wxString& aBoardPath ) ->
BOARD*
556 return loadedBoard.release();
560 loadError = ioe.
What();
569 if( !
Pgm().IsGUI() &&
Pgm().GetSettingsManager().IsProjectOpen() )
571 wxString pcbPath = aPath;
573 if( pcbPath.IsEmpty() )
578 pcbPath =
path.GetFullPath();
582 m_cliBoard.reset( loadBoardFromPath( pcbPath ) );
586 else if(
Pgm().IsGUI() &&
Pgm().GetSettingsManager().IsProjectOpen() )
595 m_cliBoard.reset( loadBoardFromPath( aPath ) );
601 wxString msg =
_(
"Failed to load board" );
603 if( !loadError.IsEmpty() )
604 msg += wxString::Format( wxS(
": %s" ), loadError );
615 std::map<wxString, LSET> layerUserMasks;
616 std::map<wxString, LSET> layerMasks;
617 std::map<wxString, LSET> layerGuiMasks;
651 auto pushLayers = [&](
const LSET& layerSet )
654 layerMask.push_back( layer );
657 if( !aLayerString.IsEmpty() )
659 wxStringTokenizer layerTokens( aLayerString,
"," );
661 while( layerTokens.HasMoreTokens() )
663 std::string token =
TO_UTF8( layerTokens.GetNextToken().Trim(
true ).Trim(
false ) );
665 if( layerUserMasks.contains( token ) )
666 pushLayers( layerUserMasks.at( token ) );
667 else if( layerMasks.count( token ) )
668 pushLayers( layerMasks.at( token ) );
669 else if( layerGuiMasks.count( token ) )
670 pushLayers( layerGuiMasks.at( token ) );
672 m_reporter->Report( wxString::Format(
_(
"Invalid layer name '%s'\n" ), token ) );
696 if( !currentVariant.IsEmpty() && currentVariant != wxS(
"all" ) )
702 bool hasWarned =
false;
707 if( !fp->IsAnnotated() && !hasWarned )
709 m_reporter->Report(
_(
"Warning: board has unannotated footprints, please use the PCB "
710 "editor to annotate them\n" ),
743 std::set<wxString> userFieldNames;
745 for(
size_t i = 0; i < referenceList.size(); ++i )
747 FOOTPRINT& footprint = referenceList[i].GetFootprint();
751 if( !field->IsMandatory() && !field->IsPrivate() )
752 userFieldNames.insert( field->GetName() );
756 for(
const wxString& fieldName : userFieldNames )
768 std::optional<BOM_PRESET> boardPreset;
770 for(
const BOM_PRESET& p : BOM_PRESET::BuiltInPresets() )
791 wxString::Format(
_(
"BOM preset '%s' not found" ) + wxS(
"\n" ), aBomJob->
m_bomPresetName ),
797 preset = *boardPreset;
805 auto normalizeFieldName = [&dataModel](
const wxString& aName ) -> wxString
807 if( aName.IsEmpty() )
808 return wxEmptyString;
813 wxString wrapped = wxS(
"${" ) + aName + wxS(
"}" );
825 wxString fieldName = normalizeFieldName( rawFieldName );
827 if( fieldName.IsEmpty() )
835 if( fieldName == wxS(
"*" ) )
841 field.
name = modelField.name;
846 bool fieldAlreadyPresent =
false;
848 for(
BOM_FIELD& presetField : preset.fieldsOrdered )
850 if( presetField.
name == field.
name )
852 fieldAlreadyPresent =
true;
857 bool fieldLaterInList =
false;
861 if( normalizeFieldName( fieldInList ) == field.
name )
863 fieldLaterInList =
true;
868 if( !fieldAlreadyPresent && !fieldLaterInList )
869 preset.fieldsOrdered.emplace_back( field );
877 field.
name = fieldName;
878 field.
show = !fieldName.StartsWith( wxT(
"__" ), &field.
name );
879 field.
name = normalizeFieldName( field.
name );
888 preset.fieldsOrdered.emplace_back( field );
894 wxString fieldName = rawFieldName;
895 fieldName.StartsWith( wxT(
"__" ), &fieldName );
896 fieldName = normalizeFieldName( fieldName );
898 if( fieldName.IsEmpty() )
901 bool fieldAlreadyPresent =
false;
903 for(
BOM_FIELD& field : preset.fieldsOrdered )
905 if( field.
name == fieldName )
908 fieldAlreadyPresent =
true;
913 if( !fieldAlreadyPresent )
918 preset.sortField = normalizeFieldName( aBomJob->
m_sortField );
930 std::optional<BOM_FMT_PRESET> boardFmtPreset;
950 if( !boardFmtPreset )
952 m_reporter->Report( wxString::Format(
_(
"BOM format preset '%s' not found" ) + wxS(
"\n" ),
959 fmt = *boardFmtPreset;
975 fn.SetName( fn.GetName() );
982 bool hasVariantPlaceholder = configuredPath.Contains( wxS(
"${VARIANT}" ) );
985 std::vector<wxString> variantsToProcess;
993 variantsToProcess.push_back( currentVariant );
996 for(
const wxString& variantName : variantsToProcess )
998 std::vector<wxString> singleVariant = { variantName };
1006 if( hasVariantPlaceholder )
1026 if( !f.Open( outPath, wxFile::write ) )
1028 m_reporter->Report( wxString::Format(
_(
"Unable to open destination '%s'" ), outPath ),
1034 bool res = f.Write( dataModel.
Export( fmt ) );
1052 if( aStepJob ==
nullptr )
1066 fn.SetName( fn.GetName() );
1126 m_reporter->Report( wxString::Format(
_(
"Successfully exported VRML to %s" ), outPath ),
1158 if( !stepExporter.
Export() )
1170 if( aRenderJob ==
nullptr )
1205 fn.SetName( wxString::Format(
"%s-%d", fn.GetName(),
static_cast<int>( aRenderJob->
m_side ) ) );
1295 lightColor, lightColor, lightColor, lightColor, lightColor, lightColor, lightColor, lightColor,
1301 sideElevation, sideElevation, sideElevation, sideElevation,
1302 -sideElevation, -sideElevation, -sideElevation, -sideElevation,
1306 45, 135, 225, 315, 45, 135, 225, 315,
1311 boardAdapter.
m_Cfg = &cfg;
1327 if( preset->name.Lower() ==
_(
"legacy colors" ) )
1342 static std::map<JOB_PCB_RENDER::SIDE, VIEW3D_TYPE> s_viewCmdMap = {
1365 for(
bool first =
true; raytrace.
Redraw(
false ); first = false )
1392 uint8_t* rgbaBuffer = raytrace.
GetBuffer();
1394 bool success = !!rgbaBuffer;
1398 const unsigned int wxh = realSize.x * realSize.y;
1400 unsigned char* rgbBuffer = (
unsigned char*) malloc( wxh * 3 );
1401 unsigned char* alphaBuffer = (
unsigned char*) malloc( wxh );
1403 unsigned char* rgbaPtr = rgbaBuffer;
1404 unsigned char* rgbPtr = rgbBuffer;
1405 unsigned char* alphaPtr = alphaBuffer;
1407 for(
int y = 0; y < realSize.y; y++ )
1409 for(
int x = 0; x < realSize.x; x++ )
1411 rgbPtr[0] = rgbaPtr[0];
1412 rgbPtr[1] = rgbaPtr[1];
1413 rgbPtr[2] = rgbaPtr[2];
1414 alphaPtr[0] = rgbaPtr[3];
1422 wxImage
image( realSize );
1423 image.SetData( rgbBuffer );
1424 image.SetAlpha( alphaBuffer );
1427 image.SetOption( wxIMAGE_OPTION_QUALITY, 90 );
1428 image.SaveFile( outPath,
1488 bool aSingleOutput,
bool aUseOverrides )
1490 std::optional<wxString> layerName;
1491 std::optional<wxString> sheetName;
1492 std::optional<wxString> sheetPath;
1506 std::vector<wxString> outputPaths;
1509 aSingleOutput, layerName, sheetName, sheetPath, &outputPaths ) )
1514 for(
const wxString& outputPath : outputPaths )
1525 if( aSvgJob ==
nullptr )
1555 return plotJob( aSvgJob, plotter, outPath, isSingle, isSingle );
1563 if( aDxfJob ==
nullptr )
1594 return plotJob( aDxfJob, plotter, outPath, isSingle, isSingle );
1600 bool plotAllLayersOneFile =
false;
1603 if( pdfJob ==
nullptr )
1620 plotAllLayersOneFile =
true;
1622 const bool outputIsSingle = plotAllLayersOneFile || pdfJob->
m_pdfSingle;
1637 return plotJob( pdfJob, pcbPlotter, outPath, outputIsSingle, plotAllLayersOneFile );
1645 if( pngJob ==
nullptr )
1676 return plotJob( pngJob, pcbPlotter, outPath, isSingle,
false );
1684 if( psJob ==
nullptr )
1715 return plotJob( psJob, pcbPlotter, outPath, isSingle, isSingle );
1724 if( aGerberJob ==
nullptr )
1753 bool hasLayerListSpecified =
false;
1760 hasLayerListSpecified =
true;
1800 LSET preflightLayers = layersToPlot;
1803 preflightLayers.
set( commonLayer );
1812 plotSequence.push_back( layer );
1818 if(
find( plotSequence.begin(), plotSequence.end(), layer_all ) != plotSequence.end() )
1821 plotSequence.push_back( layer_all );
1832 plotOpts = boardPlotOptions;
1842 wxString fullname = fn.GetFullName();
1850 jobfile_writer.
AddGbrFile( layer, fullname );
1876 m_reporter->Report( wxString::Format(
_(
"Failed to plot to '%s'.\n" ), fn.GetFullPath() ),
1902 if( aGencadJob ==
nullptr )
1926 fn.SetName( fn.GetName() );
1958 if( statsJob ==
nullptr )
1976 wxString projectName;
1983 if( boardFile.GetName().IsEmpty() )
1984 boardFile = wxFileName( statsJob->
m_filename );
2007 FILE* outFile = wxFopen( outPath, wxS(
"wt" ) );
2015 if( fprintf( outFile,
"%s",
TO_UTF8( report ) ) < 0 )
2036 if( stackupJob ==
nullptr )
2046 if( boardFile.GetName().IsEmpty() )
2047 boardFile = wxFileName( stackupJob->
m_filename );
2055 kiapi::board::BoardStackup stackupMsg;
2058 google::protobuf::util::JsonPrintOptions jsonOptions;
2059 jsonOptions.add_whitespace =
true;
2063 if( !google::protobuf::util::MessageToJsonString( stackupMsg, &
json, jsonOptions ).ok() )
2069 output = wxString::FromUTF8(
json );
2082 item->SetLayerName( brd->
GetLayerName( item->GetBrdLayerId() ) );
2123 const bool writeOk =
static_cast<bool>( outFile );
2145 if( aGerberJob ==
nullptr )
2173 fn.SetName( fn.GetName() );
2227 PLOTTER* plotter =
StartPlotBoard( brd, &plotOpts, layer, layerName, outPath, sheetName, sheetPath );
2253 if( aDrillJob ==
nullptr )
2269 std::unique_ptr<GENDRILL_WRITER_BASE> drillWriter;
2272 drillWriter = std::make_unique<EXCELLON_WRITER>( brd );
2274 drillWriter = std::make_unique<GERBER_WRITER>( brd );
2298 wxFileName fn = outPath;
2300 fn.SetName( fn.GetName() +
"-drill" );
2331 if( excellonWriter ==
nullptr )
2346 for(
const wxString& outputFile : drillWriter->GetCreatedFiles() )
2365 if( gerberWriter ==
nullptr )
2381 for(
const wxString& outputFile : drillWriter->GetCreatedFiles() )
2405 if( aPosJob ==
nullptr )
2416 fn.SetName( fn.GetName() );
2438 wxFileName fn( outPath );
2439 wxString baseName = fn.GetName();
2441 auto exportPlaceFile = [&](
bool frontSide,
bool backSide,
const wxString& curr_outPath ) ->
bool
2443 FILE* file = wxFopen( curr_outPath, wxS(
"wt" ) );
2444 wxCHECK( file,
false );
2456 fputs( data.c_str(), file );
2469 if( exportPlaceFile(
true,
false, fn.GetFullPath() ) )
2471 m_reporter->Report( wxString::Format(
_(
"Wrote front position data to '%s'.\n" ), fn.GetFullPath() ),
2486 if( exportPlaceFile(
false,
true, fn.GetFullPath() ) )
2488 m_reporter->Report( wxString::Format(
_(
"Wrote back position data to '%s'.\n" ), fn.GetFullPath() ),
2514 if( exportPlaceFile( front, back, fn.GetFullPath() ) )
2516 m_reporter->Report( wxString::Format(
_(
"Wrote position data to '%s'.\n" ), fn.GetFullPath() ),
2535 wxString outPath_base = outPath;
2546 m_reporter->Report( wxString::Format(
_(
"Wrote front position data to '%s'.\n" ), outPath ),
2561 outPath = outPath_base;
2570 m_reporter->Report( wxString::Format(
_(
"Wrote back position data to '%s'.\n" ), outPath ),
2590 if( upgradeJob ==
nullptr )
2605 m_reporter->Report(
_(
"Output path must be specified to convert legacy and non-KiCad libraries\n" ),
2615 m_reporter->Report(
_(
"Footprint library path does not exist or is not accessible\n" ),
2636 bool shouldSave = upgradeJob->
m_force;
2682 if( svgJob ==
nullptr )
2715 bool singleFpPlotted =
false;
2717 for(
const auto& [fpName, fpCacheEntry] : fpLib.
GetFootprints() )
2731 singleFpPlotted =
true;
2734 exitCode =
doFpExportSvg( svgJob, fpCacheEntry->GetFootprint().get() );
2740 if( !svgJob->
m_footprint.IsEmpty() && !singleFpPlotted )
2742 m_reporter->Report(
_(
"The given footprint could not be found to export." ) + wxS(
"\n" ),
2752 wxFileName outputFile;
2757 m_reporter->Report( wxString::Format(
_(
"Plotting footprint '%s' to '%s'\n" ),
2777 aSvgJob->
AddOutput( outputFile.GetFullPath() );
2787 if( drcJob ==
nullptr )
2803 fn.SetName( fn.GetName() + wxS(
"-drc" ) );
2832 std::unique_ptr<NETLIST>
netlist = std::make_unique<NETLIST>();
2834 if( !drcEngine->RulesValid() )
2842 m_reporter->Report(
_(
"DRC incomplete: could not compile custom design rules." )
2843 + wxS(
"\n" ) + error.
What() + wxS(
"\n" ),
2856 std::string netlist_str;
2860 wxString annotateMsg =
_(
"Schematic parity tests require a fully annotated schematic." );
2861 netlist_str = annotateMsg;
2873 wxFileName schematicPath( drcJob->
m_filename );
2874 schematicPath.MakeAbsolute();
2877 if( !schematicPath.Exists() )
2880 if( !schematicPath.Exists() )
2887 typedef bool ( *NETLIST_FN_PTR )(
const wxString&, std::string&,
KIWAY* );
2890 ( *netlister )( schematicPath.GetFullPath(), netlist_str,
m_kiway );
2898 else if( netlist_str == annotateMsg )
2920 drcEngine->SetSchematicNetlist(
netlist.get() );
2932 drcEngine->SetViolationHandler(
2933 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
2934 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
2937 aPathGenerator( marker );
2938 commit.
Add( marker );
2944 drcEngine->ClearViolationHandler();
2951 std::shared_ptr<DRC_ITEMS_PROVIDER> markersProvider =
2954 std::shared_ptr<DRC_ITEMS_PROVIDER> ratsnestProvider =
2957 std::shared_ptr<DRC_ITEMS_PROVIDER> fpWarningsProvider =
2960 markersProvider->SetSeverities( drcJob->
m_severity );
2961 ratsnestProvider->SetSeverities( drcJob->
m_severity );
2962 fpWarningsProvider->SetSeverities( drcJob->
m_severity );
2964 m_reporter->Report( wxString::Format(
_(
"Found %d violations\n" ), markersProvider->GetCount() ),
2966 m_reporter->Report( wxString::Format(
_(
"Found %d unconnected items\n" ), ratsnestProvider->GetCount() ),
2972 wxString::Format(
_(
"Found %d schematic parity issues\n" ), fpWarningsProvider->GetCount() ),
2976 DRC_REPORT reportWriter( brd, units, markersProvider, ratsnestProvider, fpWarningsProvider );
2978 bool wroteReport =
false;
3011 if( markersProvider->GetCount() > 0 || ratsnestProvider->GetCount() > 0 || fpWarningsProvider->GetCount() > 0 )
3043 if( job ==
nullptr )
3051 struct VARIANT_RESTORE
3091 if( job ==
nullptr )
3102 fn.SetName( fn.GetName() );
3118 bool success = exporter.
Write( outPath );
3138 if( job ==
nullptr )
3172 if( !exporter.
Export( outPath ) )
3185 if( job ==
nullptr )
3203 fn.SetName( fn.GetName() + wxS(
"-odb" ) );
3228 for(
const wxString&
path :
result.m_outputs )
3242 if( job ==
nullptr )
3245 bool shouldSave = job->
m_force;
3272 wxString::Format(
_(
"Error saving board file '%s'.\n%s" ), job->
m_filename, ioe.
What().GetData() );
3286 if( aDrawingSheet && !aDrawingSheet->IsEmpty() )
3316 return drawingSheet;
3323 if( aSheetPath.IsEmpty() )
3326 auto loadSheet = [&](
const wxString&
path ) ->
bool
3339 m_reporter->Report( wxString::Format(
_(
"Error loading drawing sheet '%s'." ),
path ) + wxS(
"\n" ) + msg
3348 if( loadSheet( aSheetPath ) )
3380 m_reporter->Report( wxString::Format(
_(
"Input file not found: '%s'\n" ),
3422 m_reporter->Report( wxString::Format(
_(
"No PCB importer recognizes the file format of "
3435 m_reporter->Report( wxString::Format(
_(
"No plugin found for file type '%s'\n" ),
3447 m_reporter->Report( wxString::Format(
_(
"Failed to inspect board project: %s\n" ), ioe.
What() ),
3459 if( outputPath.IsEmpty() )
3467 PROJECT* projectPtr =
nullptr;
3468 bool createdTransientProject =
false;
3472 projectPtr = &mgr.
Prj();
3476 wxFileName projectFn( outputPath );
3480 projectFn.MakeAbsolute();
3483 projectPtr = mgr.
GetProject( projectFn.GetFullPath() );
3484 createdTransientProject = ( projectPtr != nullptr );
3489 m_reporter->Report(
_(
"Could not establish a project for the import\n" ),
3495 struct TRANSIENT_PROJECT_GUARD
3501 ~TRANSIENT_PROJECT_GUARD()
3506 } transientProjectGuard{ mgr, projectPtr, createdTransientProject };
3508 std::unique_ptr<BOARD> board;
3510 struct BOARD_PROJECT_GUARD
3512 std::unique_ptr<BOARD>& board;
3514 ~BOARD_PROJECT_GUARD()
3517 board->ClearProject();
3519 } boardProjectGuard{ board };
3522 std::vector<wxString> warnings;
3526 struct CAPTURED_LAYER
3533 std::vector<CAPTURED_LAYER> capturedLayers;
3534 std::set<wxString> seenSourceLayers;
3535 bool layersCaptured =
false;
3545 m_reporter->Report( wxString::Format(
_(
"No plugin found for file type '%s'\n" ), formatName ),
3551 pi->SetReporter( &importMessages );
3560 mappable->RegisterCallback(
3561 [&](
const std::vector<INPUT_LAYER_DESC>& aDescs )
3562 -> std::map<wxString, PCB_LAYER_ID>
3564 std::map<wxString, PCB_LAYER_ID>
result;
3569 wxString method = wxS(
"auto" );
3571 if(
auto it = job->
m_layerMap.find( desc.Name );
3578 warnings.push_back( wxString::Format(
3579 _(
"Layer map entry '%s' -> '%s' names an unknown "
3580 "KiCad layer; using automatic mapping instead" ),
3581 desc.Name, it->second ) );
3583 else if( !desc.PermittedLayers.Contains( resolved ) )
3585 warnings.push_back( wxString::Format(
3586 _(
"Layer map entry '%s' -> '%s' is not a permitted "
3587 "target for this layer; using automatic mapping "
3589 desc.Name, it->second ) );
3594 method = wxS(
"explicit" );
3600 warnings.push_back( wxString::Format(
3601 _(
"No KiCad layer mapping for required source layer "
3602 "'%s'; its items will not be imported" ),
3606 result.emplace( desc.Name, target );
3607 capturedLayers.push_back( { desc.Name, target, method } );
3608 seenSourceLayers.insert( desc.Name );
3611 layersCaptured =
true;
3618 warnings.push_back(
_(
"A layer map was provided, but this importer does not support "
3619 "layer remapping; it will be ignored" ) );
3623 wxString::Format(
_(
"Importing '%s' using %s format...\n" ), job->
m_inputFile, formatName ),
3632 const std::map<std::string, UTF8>* importProperties =
nullptr;
3633 std::map<std::string, UTF8> easyEdaProProperties;
3638 easyEdaProProperties.emplace(
"pcb_id", std::string( job->
m_importPcbId.ToUTF8() ) );
3639 importProperties = &easyEdaProProperties;
3642 board = pi->LoadBoard( job->
m_inputFile, importProperties, projectPtr );
3649 m_reporter->Report( wxString::Format(
_(
"Unexpected cancellation: %s\n" ), ioce.
What() ),
3670 const wxString reconciliationPath =
3677 if( layersCaptured )
3681 if( !seenSourceLayers.contains(
source ) )
3683 warnings.push_back( wxString::Format(
3684 _(
"Layer map entry '%s' does not match any source layer in the "
3685 "imported file; it will be ignored" ),
3694 kicadPlugin->SaveBoard( outputPath, *board );
3695 wxString importedRules = pi->GetImportedDesignRules();
3697 if( !importedRules.IsEmpty() )
3699 wxFileName rulesPath( outputPath );
3702 wxFile rulesFile( rulesPath.GetFullPath(), wxFile::write );
3704 if( rulesFile.IsOpened() )
3706 rulesFile.Write( importedRules );
3710 m_reporter->Report( wxString::Format(
_(
"Could not write imported design rules to '%s'\n" ),
3711 rulesPath.GetFullPath() ),
3716 m_reporter->Report( wxString::Format(
_(
"Successfully saved imported board to '%s'\n" ), outputPath ),
3720 IMPORT_REPORT_DATA reportData;
3725 reportData.m_sourceFile = wxFileName( job->
m_inputFile ).GetFullName();
3726 reportData.m_sourceFormat = formatName;
3727 reportData.m_outputFile = wxFileName( outputPath ).GetFullName();
3729 size_t trackCount = 0;
3730 size_t viaCount = 0;
3732 for(
PCB_TRACK* track : board->Tracks() )
3740 reportData.m_statistics = {
3741 { wxS(
"footprints" ), board->Footprints().size() },
3742 { wxS(
"tracks" ), trackCount },
3743 { wxS(
"vias" ), viaCount },
3744 { wxS(
"zones" ), board->Zones().size() }
3750 nlohmann::json layerMappings = nlohmann::json::object();
3752 if( layersCaptured )
3754 for(
const CAPTURED_LAYER& mapped : capturedLayers )
3758 :
LSET::Name( mapped.m_target ).ToStdString();
3760 layerMappings[mapped.m_source.ToStdString()] = {
3761 {
"kicad_layer", kicadLayer },
3762 {
"method", mapped.m_method.ToStdString() }
3768 for(
PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
3770 wxString layerName = board->GetLayerName( layer );
3772 layerMappings[layerName.ToStdString()] = {
3773 {
"kicad_layer",
LSET::Name( layer ).ToStdString() },
3774 {
"method",
"auto" }
3779 reportData.m_extraJson[
"layer_mapping"] = layerMappings;
3780 reportData.m_warnings.insert( reportData.m_warnings.end(), warnings.begin(), warnings.end() );
3788 for(
const wxString& warning : warnings )
3819 bool aInitializeAfterLoad =
true )
3823 [aPath, aInitializeAfterLoad](
PROJECT* aProject ) -> std::unique_ptr<BOARD>
3846 aBoard->ClearProject();
3867 BOARD* boardA = aScratch.
doc.get();
3868 BOARD* boardB = bScratch.
doc.get();
3888 return diffExitCode;
3914 const wxString& aOurs,
const wxString& aTheirs,
3915 const wxString& aOutput,
bool aInteractive,
bool aSingleFile,
3924 return runFpLibMerge( aAncestor, aOurs, aTheirs, aOutput, aSingleFile );
3926 return runPcbMerge( aAncestor, aOurs, aTheirs, aOutput, aInteractive );
3931 const wxString& aTheirs,
const wxString& aOutput,
3948 BOARD* ancestor = ancestorScratch.
doc.get();
3949 BOARD* ours = oursScratch.
doc.get();
3950 BOARD* theirs = theirsScratch.
doc.get();
3952 if( !ancestor || !ours || !theirs )
3969 if( aInteractive && !
plan.Resolved() )
3971 if( !
Pgm().IsGUI() )
3973 m_reporter->Report(
_(
"--interactive requires a GUI KiCad process; the console "
3974 "kicad-cli cannot open dialogs.\n" ),
4003 std::unique_ptr<BOARD> merged = applier.
Apply();
4020 m_reporter->Report( wxString::Format(
_(
"Failed to save merged board: %s\n" ), ioe.
What() ),
4053 wxFileName proFn( aOutput );
4076 std::set<wxString> touched;
4094 wxString::Format(
_(
"Failed to save merged project file: %s\n" ), proFn.GetFullPath() ),
4103 auto writeStagedFile = [&](
const wxString& aPath,
const wxString& aContent,
const wxString& aLabel ) ->
bool
4105 if( aContent.IsEmpty() )
4107 if( wxFileExists( aPath ) )
4108 wxRemoveFile( aPath );
4115 if( !out.Open( aPath, wxFile::write ) || !out.Write( aContent ) )
4117 m_reporter->Report( wxString::Format(
_(
"Failed to save merged %s: %s\n" ), aLabel, aPath ),
4129 wxFileName druFn( aOutput );
4142 wxFileName fpFn( aOutput );
4145 if( !writeStagedFile( fpFn.GetFullPath(), applier.
GetReport().
fpLibTable,
_(
"footprint library table" ) ) )
4153 wxFileName symFn( aOutput );
4156 if( !writeStagedFile( symFn.GetFullPath(), applier.
GetReport().
symLibTable,
_(
"symbol library table" ) ) )
4167 m_reporter->Report( wxString::Format( wxS(
"%s: %s\n" ), f.validator, f.message ), f.severity );
4174 m_reporter->Report( wxString::Format(
_(
"Merge completed with %zu unresolved conflict(s) in %s\n" ),
4195 std::vector<std::unique_ptr<FOOTPRINT>>& aOwners,
4199 if( aAllowEmpty && aPath.IsEmpty() )
4205 aOwners = std::move( loaded.first );
4206 aMap = std::move( loaded.second );
4211 aReporter.
Report( wxString::Format(
_(
"Failed to load %s: %s\n" ), aPath, ioe.
What() ),
4214 catch(
const std::exception& e )
4217 wxString::Format(
_(
"Failed to load %s: %s\n" ), aPath, wxString::FromUTF8( e.what() ) ),
4232 for(
const auto& [
name, footprint] : aMap )
4249 wxFileName dirA( diffJob->
m_inputA );
4250 dirA.MakeAbsolute();
4251 wxFileName dirB( diffJob->
m_inputB );
4252 dirB.MakeAbsolute();
4254 std::vector<std::unique_ptr<FOOTPRINT>> ownersA;
4255 std::vector<std::unique_ptr<FOOTPRINT>> ownersB;
4277 return diffExitCode;
4302 const wxString& aFileB,
const wxString& aLabelA,
4303 const wxString& aLabelB, wxWindow* aParent,
4311 wxWindow* parent = aParent ? aParent : ( wxTheApp ? wxTheApp->GetTopWindow() :
nullptr );
4315 auto loadBoardScratch = [&](
const wxString& aPath )
4324 auto loadFootprintFile = [&](
const wxString& aPath ) -> std::unique_ptr<FOOTPRINT>
4326 if( aPath.IsEmpty() )
4329 wxFileName fn( aPath );
4354 if( !a.
doc && !aFileA.IsEmpty() )
4360 if( !b.
doc && !aFileB.IsEmpty() )
4379 const wxString labelA = aLabelA.IsEmpty() ? aFileA : aLabelA;
4380 const wxString labelB = aLabelB.IsEmpty() ? aFileB : aLabelB;
4383 parent, labelA, labelB,
result, std::move( refGeometry ), std::move( compGeometry ),
4386 KICAD_DIFF::ConfigurePcbDiffCanvasContext( aCanvas, boardA, boardB, color );
4394 std::vector<std::unique_ptr<FOOTPRINT>> ownersA;
4395 std::vector<std::unique_ptr<FOOTPRINT>> ownersB;
4421 std::unique_ptr<FOOTPRINT> footprintA;
4422 std::unique_ptr<FOOTPRINT> footprintB;
4426 footprintA = loadFootprintFile( aFileA );
4430 m_reporter->Report( wxString::Format(
_(
"Failed to load %s: %s\n" ), aFileA, ioe.
What() ),
4437 footprintB = loadFootprintFile( aFileB );
4441 m_reporter->Report( wxString::Format(
_(
"Failed to load %s: %s\n" ), aFileB, ioe.
What() ),
4448 const wxString nameA = wxFileName( aFileA ).GetName();
4449 const wxString nameB = wxFileName( aFileB ).GetName();
4450 const wxString itemName = !nameB.IsEmpty() ? nameB : nameA;
4453 mapA[itemName] = footprintA.get();
4456 mapB[itemName] = footprintB.get();
4476 const wxString labelA = aLabelA.IsEmpty() ? aFileA : aLabelA;
4477 const wxString labelB = aLabelB.IsEmpty() ? aFileB : aLabelB;
4494 const wxString& aTheirs,
const wxString& aOutput,
4497 if( aOutput.IsEmpty() )
4505 std::vector<std::unique_ptr<FOOTPRINT>> owners;
4509 LIB_SIDE ancestor, ours, theirs;
4516 auto isSingleFile = [&](
const wxString& aPath )
4524 auto loadSide = [&](
const wxString& aPath, LIB_SIDE& aSide ) ->
int
4528 if( isSingleFile( aPath ) )
4540 const UTF8& itemName = fp->GetFPID().GetLibItemName();
4543 aSide.map[key] = fp.get();
4544 aSide.owners.push_back( std::move( fp ) );
4549 aSide.owners = std::move( loaded.first );
4550 aSide.map = std::move( loaded.second );
4555 m_reporter->Report( wxString::Format(
_(
"Failed to load %s: %s\n" ), aPath, ioe.
What() ),
4558 catch(
const std::exception& e )
4561 wxString::Format(
_(
"Failed to load %s: %s\n" ), aPath, wxString::FromUTF8( e.what() ) ),
4589 std::vector<std::unique_ptr<FOOTPRINT>> merged = applier.
Apply();
4594 const bool hadSilentFallback = applier.
GetReport().mergePropsFallback > 0;
4596 const bool singleFileOutput = isSingleFile( aOutput );
4605 if( singleFileOutput )
4606 outFn = wxFileName( aOutput );
4608 outFn = wxFileName::DirName( aOutput );
4610 outFn.MakeAbsolute();
4616 const wxString outDir = outFn.GetPath();
4618 if( !wxFileName::DirExists( outDir ) && !wxFileName::Mkdir( outDir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
4620 m_reporter->Report( wxString::Format(
_(
"Cannot create output directory %s\n" ), outDir ),
4629 if( singleFileOutput )
4635 if( merged.size() > 1 )
4637 m_reporter->Report(
_(
"Single-file fp merge produced multiple footprints; refusing to "
4638 "collapse into one .kicad_mod\n" ),
4643 if( merged.empty() )
4648 if( wxFileName::FileExists( outFn.GetFullPath() ) )
4649 wxRemoveFile( outFn.GetFullPath() );
4655 io.
FootprintSave( outFn.GetFullPath(), merged.front().get(),
nullptr );
4666 io.
Format( merged.front().get() );
4678 std::set<wxString> mergedNames;
4680 for(
const auto& fp : merged )
4683 mergedNames.insert( fp->GetFPID().GetLibItemName() );
4686 wxArrayString existing;
4689 for(
const wxString&
name : existing )
4691 if( !mergedNames.count(
name ) )
4695 for(
const auto& fp : merged )
4700 const wxString
name = fp->GetFPID().GetLibItemName();
4711 m_reporter->Report( wxString::Format(
_(
"Failed to save merged footprint library: %s\n" ), ioe.
What() ),
4717 if( !planSnapshot.
Resolved() || hadSilentFallback )
4721 std::set<KIID_PATH> conflicts( planSnapshot.
unresolved.begin(), planSnapshot.
unresolved.end() );
4724 conflicts.insert(
id );
4726 m_reporter->Report( wxString::Format(
_(
"Footprint library merge completed with %zu unresolved "
4727 "conflict(s) in %s\n" ),
4728 conflicts.size(), aOutput ),
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
wxString BuildStackupCsv(BOARD_STACKUP &aStackup, EDA_UNITS aUnits, const STACKUP_CSV_OPTIONS &aOptions)
wxString FormatBoardStatisticsJson(const BOARD_STATISTICS_DATA &aData, BOARD *aBoard, const UNITS_PROVIDER &aUnitsProvider, const wxString &aProjectName, const wxString &aBoardName)
void ComputeBoardStatistics(BOARD *aBoard, const BOARD_STATISTICS_OPTIONS &aOptions, BOARD_STATISTICS_DATA &aData)
wxString FormatBoardStatisticsReport(const BOARD_STATISTICS_DATA &aData, BOARD *aBoard, const UNITS_PROVIDER &aUnitsProvider, const wxString &aProjectName, const wxString &aBoardName)
void InitializeBoardStatisticsData(BOARD_STATISTICS_DATA &aData)
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
BASE_SET & set(size_t pos)
Helper class to handle information needed to display 3D board.
double BiuTo3dUnits() const noexcept
Board integer units To 3D units.
void SetVisibleLayers(const std::bitset< LAYER_3D_END > &aLayers)
std::bitset< LAYER_3D_END > GetVisibleLayers() const
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
void SetLayerColors(const std::map< int, COLOR4D > &aColors)
EDA_3D_VIEWER_SETTINGS * m_Cfg
std::map< int, COLOR4D > m_ColorOverrides
allows to override color scheme colors
void Set3dCacheManager(S3D_CACHE *aCacheMgr) noexcept
Update the cache manager pointer.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
const VECTOR2I & GetAuxOrigin() const
BOARD_STACKUP & GetStackupDescriptor()
static bool SaveBoard(wxString &aFileName, BOARD &aBoard, PCB_IO_MGR::PCB_FILE_T aFormat)
static std::unique_ptr< BOARD > Load(const wxString &aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, PROJECT *aProject, const OPTIONS &aOptions)
Manage one layer needed to make a physical board.
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
bool SynchronizeWithBoard(const BOARD_DESIGN_SETTINGS *aSettings)
Synchronize the BOARD_STACKUP_ITEM* list with the board.
Information pertinent to a Pcbnew printed circuit board.
void SetCurrentVariant(const wxString &aVariant)
const PAGE_INFO & GetPageSettings() const
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
TITLE_BLOCK & GetTitleBlock()
const std::map< wxString, wxString > & GetProperties() const
const FOOTPRINTS & Footprints() const
const wxString & GetFileName() const
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
wxString GetVariantDescription(const wxString &aVariantName) const
int GetFileFormatVersionAtLoad() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
wxString GetCurrentVariant() const
PROJECT * GetProject() const
wxString GetDesignRulesPath() const
Return the absolute path to the design rules file for this board.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
void DeleteMARKERs()
Delete all MARKERS from the board.
constexpr const Vec GetCenter() const
void SetProjection(PROJECTION_TYPE aProjection)
void RotateY_T1(float aAngleInRadians)
bool Zoom_T1(float aFactor)
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
bool ViewCommand_T1(VIEW3D_TYPE aRequestedView)
void RotateX_T1(float aAngleInRadians)
void SetLookAtPos_T1(const SFVEC3F &aLookAtPos)
const SFVEC3F & GetLookAtPos_T1() const
void RotateZ_T1(float aAngleInRadians)
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
File-compare dialog (Phase 7).
3-way merge resolution dialog (Phase 8).
const KICAD_DIFF::MERGE_PLAN & GetResolvedPlan() const
Returns the plan with the user's resolutions applied.
A dialog to set the plot options and create plot files in various formats.
bool WriteJsonReport(const wxString &aFullFileName)
bool WriteTextReport(const wxString &aFullFileName)
Helper to handle drill precision format in excellon files.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
void SetSheetPath(const std::string &aSheetPath)
Set the sheet path displayed in the title block.
void SetVariantName(const std::string &aVariant)
Set the current variant name and description to be shown on the drawing sheet.
void SetVariantDesc(const std::string &aVariantDesc)
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
LAYER_PRESET_3D * FindPreset(const wxString &aName)
std::vector< LAYER_PRESET_3D > m_LayerPresets
Create Excellon drill, drill map, and drill report files.
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board.
void SetOptions(bool aMirror, bool aMinimalHeader, const VECTOR2I &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
bool m_IncludeUnspecified
Wrapper to expose an API for writing VRML files, without exposing all the many structures used in the...
bool ExportVRML_File(PROJECT *aProject, wxString *aMessages, const wxString &aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified, bool aIncludeDNP, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Exports the board and its footprint shapes 3D (vrml files only) as a vrml file.
void SetVariantNames(const std::vector< wxString > &aVariantNames)
std::vector< BOM_FIELD > GetFieldsOrdered()
static const wxString QUANTITY_VARIABLE
static const wxString ITEM_NUMBER_VARIABLE
wxString Export(const BOM_FMT_PRESET &aSettings)
int GetFieldNameCol(const wxString &aFieldName) const
void ApplyBomPreset(const BOM_PRESET &aPreset)
void AddColumn(const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser) override
void SetCurrentVariant(const wxString &aVariantName) override
Select the displayed variant, retaining un-applied edits in every variant.
Provide an extensible class to resolve 3D model paths.
wxString ResolvePath(const wxString &aFileName, const wxString &aWorkingPath, std::vector< const EMBEDDED_FILES * > aEmbeddedFilesStack)
Determine the full path of the given file name.
void SetProgramBase(PGM_BASE *aBase)
Set a pointer to the application's PGM_BASE instance used to extract the local env vars.
bool SetProject(const PROJECT *aProject, bool *flgChanged=nullptr)
Set the current KiCad project directory as the first entry in the model path list.
void SetPath(const wxString &aPath)
void Save(FOOTPRINT *aFootprintFilter=nullptr)
Save the footprint cache or a single footprint from it to disk.
boost::ptr_map< wxString, FP_CACHE_ENTRY > & GetFootprints()
Export board to GenCAD file format.
void UseIndividualShapes(bool aUnique)
Make pad shapes unique.
void UsePinNamesUnique(bool aUnique)
Make pin names unique.
void StoreOriginCoordsInFile(bool aStore)
Store origin coordinate in GenCAD file.
void FlipBottomPads(bool aFlip)
Flip pad shapes on the bottom side.
void SetPlotOffet(VECTOR2I aOffset)
Set the coordinates offset when exporting items.
bool WriteFile(const wxString &aFullFileName)
Export a GenCAD file.
void SetMapFileFormat(PLOT_FORMAT aMapFmt)
Initialize the format for the drill map file.
bool GenDrillReportFile(const wxString &aFullFileName, REPORTER *aReporter=nullptr)
Create a plain text report file giving a list of drill values and drill count for through holes,...
GERBER_JOBFILE_WRITER is a class used to create Gerber job file a Gerber job file stores info to make...
bool CreateJobFile(const wxString &aFullFilename)
Creates a Gerber job file.
void AddGbrFile(PCB_LAYER_ID aLayer, wxString &aFilename)
add a gerber file name and type in job file list
virtual bool EndPlot() override
Used to create Gerber drill files.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, bool aGenTenting, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board filenames are computed from the board name,...
void SetOptions(const VECTOR2I &aOffset)
Initialize internal parameters to match drill options.
void SetFormat(int aRightDigits=6)
Initialize internal parameters to match the given format.
bool Export(const wxString &aFullFileName) const
Generate IDFv3 compliant board (*.emn) and library (*.emp) files for aPcb.
Reporter handed to an importer during an import job.
void Flush(IMPORT_REPORT_FORMAT aFormat, IMPORT_REPORT_DATA &aData)
Move the collected messages into aData when a report will be written, otherwise forward them to the j...
An exception saying that the user cancelled an interactive part of a load, import,...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
Wrapper to expose an API for writing IPC-D356 files.
bool Write(const wxString &aFilename)
Generates and writes the netlist to a given path.
wxString m_inputB
Comparison document (file or directory)
wxString m_inputA
Reference document (file or directory)
void Register(const std::string &aJobTypeName, std::function< int(JOB *job)> aHandler, std::function< bool(JOB *job, wxWindow *aParent)> aConfigHandler)
JOB_DISPATCHER(KIWAY *aKiway)
PROGRESS_REPORTER * m_progressReporter
wxString GetSelectedVariant() const
std::vector< wxString > m_variantNames
wxString m_stringDelimiter
wxString m_fieldDelimiter
bool m_includeByteOrderMark
std::vector< wxString > m_fieldsOrdered
wxString m_refRangeDelimiter
std::vector< wxString > m_fieldsLabels
std::vector< wxString > m_fieldsGroupBy
wxString m_bomFmtPresetName
BOM_FILTER_SCOPE m_filterScope
JOB_EXPORT_PCB_3D::FORMAT m_format
EXPORTER_STEP_PARAMS m_3dparams
Despite the name; also used for other formats.
ZEROS_FORMAT m_zeroFormat
bool m_excellonOvalDrillRoute
DRILL_ORIGIN m_drillOrigin
bool m_excellonCombinePTHNPTH
bool m_excellonMinimalHeader
std::vector< wxString > m_variantNames
bool m_checkZonesBeforeExport
wxString GetSettingsDialogTitle() const override
bool m_useIndividualShapes
bool m_useBoardPlotParams
ODB_COMPRESSION m_compressionMode
@ ALL_LAYERS_ONE_FILE
DEPRECATED MODE.
GEN_MODE m_pdfGenMode
uused by the cli, will be removed when the other behavior is deprecated
LSEQ m_plotOnAllLayersSequence
Layers to include on all individual layer prints.
bool m_checkZonesBeforePlot
std::optional< wxString > m_argLayers
std::optional< wxString > m_argCommonLayers
wxString m_variant
Variant name for variant-aware filtering.
bool m_useDrillPlaceFileOrigin
bool m_excludeFootprintsWithTh
bool m_includeBoardOptions
bool m_includeLossTangent
void SetDefaultOutputPath(const wxString &aReferenceName)
bool m_subtractHolesFromBoardArea
void SetDefaultOutputPath(const wxString &aReferenceName)
bool m_excludeFootprintsWithoutPads
bool m_subtractHolesFromCopperAreas
wxString m_outputLibraryPath
Job: diff two PCB files end-to-end via PCB_DIFFER.
bool m_reportAllTrackErrors
Job to import a non-KiCad PCB file to KiCad format.
wxString m_importPcbId
EasyEDA Pro PCB document identifier selected by project-level import.
std::map< wxString, wxString > m_layerMap
Explicit overrides from source layer name to KiCad layer name (canonical board-file name,...
std::map< wxString, wxString > m_netNameMap
bool m_isPartOfMultiBoardProject
Avoid promoting an individual board's source settings into shared project settings.
std::vector< std::pair< wxString, wxString > > m_projectBoards
PCB document identifier and source name pairs found during a probe.
IMPORT_REPORT_FORMAT m_reportFormat
VECTOR3D m_lightBottomIntensity
VECTOR3D m_lightTopIntensity
VECTOR3D m_lightCameraIntensity
bool m_proceduralTextures
bool m_useBoardStackupColors
VECTOR3D m_lightSideIntensity
std::string m_appearancePreset
bool m_exitCodeViolations
An simple container class that lets us dispatch output jobs to kifaces.
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
wxString ResolveOutputPath(const wxString &aPath, bool aPathIsDirectory, PROJECT *aProject) const
void AddOutput(wxString aOutputPath)
wxString GetFullOutputPath(PROJECT *aProject) const
Returns the full output path for the job, taking into account the configured output path,...
wxString GetWorkingOutputPath() const
Returns the working output path for the job, if one has been set.
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
void SetWorkingOutputPath(const wxString &aPath)
Sets a transient output path for the job, it takes priority over the configured output path when GetF...
const std::map< wxString, wxString > & GetVarOverrides() const
JSON_SETTINGS_INTERNALS * Internals()
Diff two .pretty footprint library directories.
static std::pair< std::vector< std::unique_ptr< FOOTPRINT > >, FOOTPRINT_MAP > LoadLibrary(const wxString &aPrettyPath)
Load a .pretty directory into a FOOTPRINT_MAP.
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
std::map< wxString, const FOOTPRINT * > FOOTPRINT_MAP
Three-way merge plan generator.
MERGE_PLAN Plan(const DOCUMENT_DIFF &aAncestorOurs, const DOCUMENT_DIFF &aAncestorTheirs) const
Plan the merge given the canonical pair of diffs.
const REPORT & GetReport() const
std::vector< std::unique_ptr< ITEM > > Apply()
Diff two already-parsed BOARDs and produce a DOCUMENT_DIFF.
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
Materialize a MERGE_PLAN into a real merged BOARD.
std::unique_ptr< BOARD > Apply()
Produce the merged board.
const REPORT & GetReport() const
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
A color representation with 4 components: red, green, blue, alpha.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Plugin class for import plugins that support remappable layers.
void AsyncLoad()
Loads all available libraries for this adapter type in the background.
const UTF8 & GetLibItemName() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then saves the JSON document contents into the parent JSON_SETTINGS.
void CopyFrom(NET_SETTINGS &aOther)
Deep-copy the persisted contents of aOther into this instance.
static bool EnsurePathExists(const wxString &aPath, bool aPathToFile=false)
Attempts to create a given path if it does not exist.
int JobExportStep(JOB *aJob)
int RunMerge(KICAD_DIFF::DOC_KIND aKind, const wxString &aAncestor, const wxString &aOurs, const wxString &aTheirs, const wxString &aOutput, bool aInteractive, bool aSingleFile, REPORTER *aReporter)
Non-job entry points (reached via the kiface KIFACE_MERGE_DOCUMENT / KIFACE_OPEN_DIFF_DIALOG function...
int JobExportPs(JOB *aJob)
int JobExportPos(JOB *aJob)
bool preparePlotLayers(JOB_EXPORT_PCB_PLOT *aJob, BOARD *aBoard, TOOL_MANAGER *aToolManager)
int JobExportFpSvg(JOB *aJob)
int JobExportStackup(JOB *aJob)
void refillFabZones(const JOB_EXPORT_PCB_FAB &aJob, BOARD *aBoard)
int JobExportOdb(JOB *aJob)
int JobExportDrc(JOB *aJob)
int JobUpgrade(JOB *aJob)
int JobExportFpUpgrade(JOB *aJob)
int JobExportGerber(JOB *aJob)
DS_PROXY_VIEW_ITEM * getDrawingSheetProxyView(BOARD *aBrd)
wxString resolveJobOutputPath(JOB *aJob, BOARD *aBoard, const wxString *aDrawingSheet=nullptr)
int JobExportPng(JOB *aJob)
int JobExportDxf(JOB *aJob)
int JobExportPdf(JOB *aJob)
int runPcbMerge(const wxString &aAncestor, const wxString &aOurs, const wxString &aTheirs, const wxString &aOutput, bool aInteractive)
int JobExportDrill(JOB *aJob)
int JobExportSvg(JOB *aJob)
void loadOverrideDrawingSheet(BOARD *brd, const wxString &aSheetPath)
PCBNEW_JOBS_HANDLER(KIWAY *aKiway)
TOOL_MANAGER * getToolManager(BOARD *aBrd)
int JobExportGerbers(JOB *aJob)
int JobExportBom(JOB *aJob)
int JobExportIdf(JOB *aJob)
std::unique_ptr< BOARD > m_cliBoard
int JobExportGencad(JOB *aJob)
BOARD * getBoard(const wxString &aPath=wxEmptyString)
wxString resolvePlotOutputPath(JOB_EXPORT_PCB_PLOT *aJob, BOARD *aBoard, PLOT_FORMAT aFormat, bool aSingleOutput)
int JobExportIpc2581(JOB *aJob)
virtual ~PCBNEW_JOBS_HANDLER()
int runFpLibMerge(const wxString &aAncestor, const wxString &aOurs, const wxString &aTheirs, const wxString &aOutput, bool aSingleFile)
std::unique_ptr< TOOL_MANAGER > m_toolManager
int OpenDiffDialog(KICAD_DIFF::DOC_KIND aKind, const wxString &aFileA, const wxString &aFileB, const wxString &aLabelA, const wxString &aLabelB, wxWindow *aParent, REPORTER *aReporter)
LSEQ convertLayerArg(wxString &aLayerString, BOARD *aBoard) const
void ClearCachedBoard()
Clear the cached CLI board so the next job reloads from the current project.
int JobExportRender(JOB *aJob)
int JobExportIpcD356(JOB *aJob)
int doFpExportSvg(JOB_FP_EXPORT_SVG *aSvgJob, const FOOTPRINT *aFootprint)
int JobExportStats(JOB *aJob)
The main frame for Pcbnew.
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Delete aFootprintName from the library at aLibraryPath.
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Return a list of footprint names contained within the library at aLibraryPath.
std::unique_ptr< FOOTPRINT > ImportFootprint(const wxString &aFootprintPath, wxString &aFootprintNameOut, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.
bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Check for the existence of a footprint.
void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aFootprint to an existing library located at aLibraryPath.
void SaveBoard(const wxString &aFileName, BOARD &aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
void Format(const BOARD_ITEM *aItem) const
Output aItem to aFormatter in s-expression format.
void SetOutputFormatter(OUTPUTFORMATTER *aFormatter)
static bool ConvertLibrary(const std::map< std::string, UTF8 > &aOldFileProps, const wxString &aOldFilePath, const wxString &aNewFilePath, REPORTER *aReporter)
Convert a schematic symbol library to the latest KiCad format.
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
@ EASYPC
Easy-PC / DesignSpark PCB.
@ PCB_FILE_UNKNOWN
0 is not a legal menu id on Mac
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a PCB_IO which the caller can use to import, export, save, or load design documents.
static PCB_FILE_T FindPluginTypeFromBoardPath(const wxString &aFileName, int aCtl=0)
Return a plugin type given a path for a board file.
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a footprint library's libPath.
static bool ImportGeneratesProjectLibrary(PCB_FILE_T aFileType)
Return true when importing aFileType should materialize a project footprint library.
static const wxString ShowType(PCB_FILE_T aFileType)
Return a brief name for a plugin given aFileType enum.
static void PlotJobToPlotOpts(PCB_PLOT_PARAMS &aOpts, JOB_EXPORT_PCB_PLOT *aJob, REPORTER &aReporter)
True when the board's out-of-date-chart policy regenerated charts during the last Plot().
bool Plot(const wxString &aOutputPath, const LSEQ &aLayersToPlot, const LSEQ &aCommonLayers, bool aUseGerberFileExtensions, bool aOutputPathIsSingle=false, std::optional< wxString > aLayerName=std::nullopt, std::optional< wxString > aSheetName=std::nullopt, std::optional< wxString > aSheetPath=std::nullopt, std::vector< wxString > *aOutputFiles=nullptr)
static void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
Parameters and options when plotting/printing a board.
LSEQ GetPlotOnAllLayersSequence() const
void SetLayerSelection(const LSET &aSelection)
void SetPlotOnAllLayersSequence(LSEQ aSeq)
void SetPlotPadNumbers(bool aFlag)
LSET GetLayerSelection() const
bool GetSketchPadsOnFabLayers() const
bool GetUseGerberProtelExtensions() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
Used to create Gerber drill files.
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
void SetVariant(const wxString &aVariant)
Set the variant name for variant-aware filtering.
int CreatePlaceFile(const wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges, bool aExcludeDNP, bool aExcludeBOM)
Create an pnp gerber file.
The ASCII format of the kicad place file is:
static wxString DecorateFilename(const wxString &aBaseName, bool aFront, bool aBack)
std::string GenPositionData()
build a string filled with the position data
void SetVariant(const wxString &aVariant)
Set the variant name for variant-aware export.
Base plotter engine class.
The backing store for a PROJECT, in JSON format.
wxString m_BoardDrawingSheetFile
PcbNew params.
bool Store() override
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
static FILENAME_RESOLVER * Get3DFilenameResolver(PROJECT *aProject)
Accessor for 3D path resolver.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
Container for project specific data.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual void ApplyTextVars(const std::map< wxString, wxString > &aVarsMap)
Applies the given var map, it will create or update existing vars.
virtual PROJECT_FILE & GetProjectFile() const
void SetReporters(std::shared_ptr< REPORTER > aActivityReporter, std::shared_ptr< REPORTER > aWarningReporter)
Set the reporters for activity and warning messages.
wxSize GetRealBufferSize()
bool Redraw(bool aIsMoving) override
Redraw the view.
void SetCurWindowSize(const wxSize &aSize) override
Before each render, the canvas will tell the render what is the size of its windows,...
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
RAII class that sets an value at construction and resets it to the original value at destruction.
bool SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Save a copy of the current project under the given path.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
PROJECT * GetProject(const wxString &aFullPath) const
Retrieve a loaded project by name.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
bool IsProjectOpenNotDummy() const
Helper for checking if we have a project open that is not a dummy project.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
void Pan_T1(const SFVEC3F &aDeltaOffsetInc) override
void SetT0_and_T1_current_T() override
This will set T0 and T1 with the current values.
void Interpolate(float t) override
It will update the matrix to interpolate between T0 and T1 values.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
wxString GetGeneratedFieldDisplayName(const wxString &aSource)
Returns any variables unexpanded, e.g.
bool IsGeneratedField(const wxString &aFieldName)
Returns true if the entire string is generated, e.g is a single text var reference.
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Return the default plot extension for a format.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
static DRILL_PRECISION precisionListForInches(2, 4)
static DRILL_PRECISION precisionListForMetric(3, 3)
#define FOLLOW_PLOT_SETTINGS
Classes used in drill files, map files and report files generation.
Classes used in drill files, map files and report files generation.
int RefreshGeneratedTables(BOARD &aBoard)
Bring every generated table on the board up to date and return how many were rebuilt.
Classes used to generate a Gerber job file in JSON.
Classes used in place file generation.
static const std::string LegacySchematicFileExtension
static const std::string BrepFileExtension
static const std::string SymbolLibraryTableFileName
static const std::string JpegFileExtension
static const std::string GerberJobFileExtension
static const std::string GerberFileExtension
static const std::string XaoFileExtension
static const std::string ReportFileExtension
static const std::string GltfBinaryFileExtension
static const std::string ProjectFileExtension
static const std::string PngFileExtension
static const std::string FootprintPlaceFileExtension
static const std::string JsonFileExtension
static const std::string IdfV3BoardFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string CsvFileExtension
static const std::string U3DFileExtension
static const std::string PdfFileExtension
static const std::string Ipc2581FileExtension
static const std::string FootprintLibraryTableFileName
static const std::string GencadFileExtension
static const std::string StlFileExtension
static const std::string IpcD356FileExtension
static const std::string PlyFileExtension
static const std::string StepFileExtension
static const std::string SVGFileExtension
static const std::string DesignRulesFileExtension
static const std::string VrmlFileExtension
static const std::string KiCadFootprintFileExtension
static const std::string ArchiveFileExtension
static const std::string KiCadPcbFileExtension
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
bool ApplyImportedNetNameMap(BOARD &aBoard, const std::map< wxString, wxString > &aNames, REPORTER &aReporter)
Apply caller-selected imported net names without changing net identity or connectivity.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
bool GenerateIpc2581File(JOB_EXPORT_PCB_IPC2581 &aJob, BOARD *aBoard, PROGRESS_REPORTER *aProgressReporter, REPORTER *aReporter)
Write the IPC-2581 file or archive of aJob and record it as a job output.
wxString DefaultImportOutputPath(const wxString &aInputFile, const wxString &aKiCadExt)
Build the default output path for an import by swapping the input file's extension for the given KiCa...
bool WriteImportReport(REPORTER *aReporter, IMPORT_REPORT_FORMAT aFormat, const wxString &aReportFile, const IMPORT_REPORT_DATA &aData)
Emit an import report in the requested format to aReportFile, or to aReporter (at INFO severity) when...
@ KIFACE_NETLIST_SCHEMATIC
#define KICTL_KICAD_ONLY
chosen file is from KiCad according to user
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
@ LAYER_3D_BACKGROUND_TOP
@ LAYER_3D_BACKGROUND_BOTTOM
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define MAIL_SCH_GET_NETLIST_CANCELLED
Reply payload for MAIL_SCH_GET_NETLIST when the user deliberately aborts netlist generation (for exam...
static std::vector< PENDING_PROPERTY > plan(const EDA_ITEM &aSource, const EDA_ITEM &aTarget, const std::set< wxString > &aEnabledKeys)
Target properties to write, paired with values read off the source.
static const int ERR_ARGS
static const int ERR_RC_VIOLATIONS
Rules check violation count was greater than 0.
static const int ERR_INVALID_INPUT_FILE
static const int ERR_INVALID_OUTPUT_CONFLICT
static const int ERR_UNKNOWN_FILE_FORMAT
No plugin for the requested face recognized the input file format.
static const int ERR_UNKNOWN
void CollectChangeBBoxes(const DOCUMENT_DIFF &aDiff, std::map< KIID_PATH, BOX2I > &aOut)
Walk a DOCUMENT_DIFF and populate a (KIID_PATH → BOX2I) map with each changed item's bbox,...
const wxString DOC_PROP_NET_CLASSES
LIB_MERGE_APPLIER< FOOTPRINT > FP_LIB_MERGE_APPLIER
Footprint-library 3-way merge applier. See LIB_MERGE_APPLIER for behavior.
void AppendGeometry(DOCUMENT_GEOMETRY &aDst, DOCUMENT_GEOMETRY &&aSrc)
Move all primitives from aSrc into aDst.
DOCUMENT_GEOMETRY ExtractFootprintGeometry(const FOOTPRINT &aFootprint, const KIGFX::COLOR4D &aColor)
Extract drawable context geometry from a single FOOTPRINT.
DIFF_EMIT_OPTIONS MakeEmitOptions(const JOB_DIFF_BASE &aJob, const wxString &aLabelA, const wxString &aLabelB)
Build a DIFF_EMIT_OPTIONS pre-filled from the job's format, resolved output path and the supplied per...
const wxString DOC_PROP_DRAWING_SHEET
DOC_KIND
Document type a diff/merge entry point should route to, derived from a file path's extension.
int EmitDiffResult(const DOCUMENT_DIFF &aResult, const DIFF_EMIT_OPTIONS &aOptions, int aDiffExitCode, REPORTER &aReporter)
Emit a computed DOCUMENT_DIFF in the requested format.
const wxString DOC_PROP_DRC_SEVERITIES
DOCUMENT_GEOMETRY ExtractBoardGeometry(const BOARD &aBoard, const KIGFX::COLOR4D &aColor)
Extract a coarse outline of a BOARD into a DOCUMENT_GEOMETRY for use as background context in DIFF_SC...
bool ApplyProjectFilePatches(const wxString &aOutputProPath, const nlohmann::json &aSource, const std::set< wxString > &aDocProps, DOC_KIND aKind)
Higher-level orchestrator: load the existing aOutputProPath as JSON (or start from aSource if the fil...
int DiffExitCode(const DOCUMENT_DIFF &aResult)
Map a computed diff onto its CLI exit code – SUCCESS when empty, otherwise ERR_RC_VIOLATIONS.
void PackBoardStackup(const BOARD &aBoard, BoardStackup &aOut)
ODB_EXPORT_RESULT GenerateODBPPFiles(const JOB_EXPORT_PCB_ODB &aJob, BOARD *aBoard, PCB_EDIT_FRAME *aParentFrame, PROGRESS_REPORTER *aProgressReporter, REPORTER *aReporter)
Generate the ODB++ tree or archive and return the write status and the paths written.
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
#define CTL_FOR_LIBRARY
Format output for a footprint library instead of clipboard or BOARD.
bool PlotFootprintToSVG(const FOOTPRINT &aFootprint, PROJECT &aProject, const std::map< wxString, wxString > *aVarOverrides, PCB_PLOT_PARAMS &aPlotOpts, const LSEQ &aLayersToPlot, const LSEQ &aLayersOnAll, const wxString &aFileName, REPORTER *aReporter)
Plot a footprint to an SVG file, with the footprint origin at the SVG origin and the page/viewBox siz...
static PCB_LAYER_ID resolveKiCadLayerName(const wxString &aName)
static int loadFootprintLibrarySide(const wxString &aPath, std::vector< std::unique_ptr< FOOTPRINT > > &aOwners, KICAD_DIFF::FP_LIB_DIFFER::FOOTPRINT_MAP &aMap, bool aAllowEmpty, REPORTER &aReporter)
static DRILL_PRECISION precisionListForInches(2, 4)
static int plotJob(JOB_EXPORT_PCB_PLOT *aJob, PCB_PLOTTER &aPlotter, const wxString &aOutPath, bool aSingleOutput, bool aUseOverrides)
static DRILL_PRECISION precisionListForMetric(3, 3)
static SCRATCH_DOC< BOARD > loadScratchBoard(SETTINGS_MANAGER &aMgr, const wxString &aPath, bool aInitializeAfterLoad=true)
static KICAD_DIFF::DOCUMENT_GEOMETRY footprintLibraryGeometry(const KICAD_DIFF::FP_LIB_DIFFER::FOOTPRINT_MAP &aMap, const KIGFX::COLOR4D &aColor)
const wxString GetGerberProtelExtension(int aLayer)
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aLayerName, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aPageName=wxT("1"), const wxString &aPageNumber=wxEmptyString, const int aPageCount=1)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
void PlotBoardLayers(BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayerSequence, const PCB_PLOT_PARAMS &aPlotOptions)
Plot a sequence of board layer IDs.
PGM_BASE & Pgm()
The global program "get" accessor.
PLOT_FORMAT
The set of supported output plot formats.
Plotting engines similar to ps (PostScript, Gerber, svg)
SCRATCH_DOC< DOC > LoadScratchDoc(SETTINGS_MANAGER &aMgr, const wxString &aDocPath, Loader aLoader, ClearFn aClearFn)
Construct a SCRATCH_DOC by loading a project non-active and then handing it to the caller's document ...
T * GetAppSettings(const char *aFilename)
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
#define OPEN_OSTREAM(var, name)
#define CLOSE_STREAM(var)
wxString ExpandVariantOutputPath(const wxString &aPath, const wxString &aVariantToken)
bool initialize_after_load
bool subtractHolesFromCopperAreas
bool subtractHolesFromBoardArea
bool excludeFootprintsWithoutPads
bool includeByteOrderMark
static std::vector< BOM_FMT_PRESET > BuiltInPresets()
wxString refRangeDelimiter
Phase 8 context for the conflict canvas.
KICAD_DIFF::DOCUMENT_GEOMETRY ancestorGeometry
std::map< KIID_PATH, BOX2I > theirsBBoxes
KICAD_DIFF::DOCUMENT_GEOMETRY oursGeometry
std::map< KIID_PATH, BOX2I > oursBBoxes
KICAD_DIFF::DOCUMENT_GEOMETRY theirsGeometry
std::vector< int > raytrace_lightElevation
bool show_footprints_normal
KIGFX::COLOR4D raytrace_lightColorCamera
bool raytrace_post_processing
std::vector< KIGFX::COLOR4D > raytrace_lightColor
KIGFX::COLOR4D raytrace_lightColorBottom
bool raytrace_reflections
bool show_footprints_virtual
bool differentiate_plated_copper
std::vector< int > raytrace_lightAzimuth
bool raytrace_refractions
bool show_footprints_not_in_posfile
bool raytrace_procedural_textures
bool show_footprints_insert
int raytrace_recursivelevel_refractions
KIGFX::COLOR4D raytrace_lightColorTop
bool raytrace_anti_aliasing
std::vector< BOM_PRESET > m_BomPresets
std::vector< BOM_FMT_PRESET > m_BomFmtPresets
KIGFX::COLOR4D reference
Default color for source-document context geometry.
KIGFX::COLOR4D comparison
Describes how a computed DOCUMENT_DIFF should be emitted by a diff job.
std::function< DOCUMENT_GEOMETRY(const KIGFX::COLOR4D &)> comparisonGeometry
DOC_KIND docKind
Source document type, propagated onto the scene so the PNG/SVG renderer sizes its viewport with the m...
std::function< DOCUMENT_GEOMETRY(const KIGFX::COLOR4D &)> referenceGeometry
The full set of changes between two parsed documents of one type.
Aggregate of background geometry extracted from one source document.
Result of planning a 3-way merge.
std::size_t ConflictCount() const
std::vector< KIID_PATH > unresolved
Report on the application after Apply() runs.
wxString fpLibTable
fp-lib-table content the applier resolved.
VALIDATION_REPORT validation
Post-apply validator pipeline result (refdes uniqueness, connectivity-rebuild-ack,...
bool drcSeveritiesTouched
bool projectFileTouched
True iff the applier resolved state that lives in the .kicad_pro or a project sibling file.
wxString customDrcRules
Custom DRC rules (.kicad_dru) content the applier resolved.
wxString symLibTable
sym-lib-table content the applier resolved.
wxString drawingSheetFile
Drawing sheet path the applier resolved (from a doc-level resolution).
Outcome of a single validator run.
std::vector< VALIDATION_FAILURE > failures
Implement a participant in the KIWAY alchemy.
A filename or source description, a problem input line, a line number, a byte offset,...
Move-only RAII wrapper for "load a KiCad document into a non-active scratch PROJECT and clean up afte...
std::unique_ptr< DOC > doc
Options controlling which stackup fields are included in CSV exports.
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
static void checkParity(CREEPAGE_PARITY_FIXTURE &aFixture, const std::string &aBoard)
IbisParser parser & reporter
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.
Declaration for a track ball camera.
double DEG2RAD(double deg)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.