KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew_jobs_handler.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) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <wx/dir.h>
22#include "pcbnew_jobs_handler.h"
23#include <board_commit.h>
25#include <drc/drc_item.h>
26#include <drc/drc_report.h>
30#include <jobs/job_fp_upgrade.h>
40#include <jobs/job_pcb_render.h>
41#include <jobs/job_pcb_drc.h>
42#include <cli/exit_codes.h>
48#include <tool/tool_manager.h>
49#include <tools/drc_tool.h>
54#include <kiface_base.h>
55#include <macros.h>
56#include <pad.h>
57#include <pcb_marker.h>
60#include <kiface_ids.h>
63#include <pcbnew_settings.h>
64#include <pcbplot.h>
65#include <pgm_base.h>
68#include <project_pcb.h>
70#include <reporter.h>
71#include <string_utf8_map.h>
73#include <export_vrml.h>
74#include <wx/wfstream.h>
75#include <wx/zipstrm.h>
76
78
79
80#ifdef _WIN32
81#ifdef TRANSPARENT
82#undef TRANSPARENT
83#endif
84#endif
85
86
88 JOB_DISPATCHER( aKiway )
89{
90 Register( "3d", std::bind( &PCBNEW_JOBS_HANDLER::JobExportStep, this, std::placeholders::_1 ) );
91 Register( "render", std::bind( &PCBNEW_JOBS_HANDLER::JobExportRender, this, std::placeholders::_1 ) );
92 Register( "svg", std::bind( &PCBNEW_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ) );
93 Register( "dxf", std::bind( &PCBNEW_JOBS_HANDLER::JobExportDxf, this, std::placeholders::_1 ) );
94 Register( "pdf", std::bind( &PCBNEW_JOBS_HANDLER::JobExportPdf, this, std::placeholders::_1 ) );
95 Register( "gerber",
96 std::bind( &PCBNEW_JOBS_HANDLER::JobExportGerber, this, std::placeholders::_1 ) );
97 Register( "gerbers",
98 std::bind( &PCBNEW_JOBS_HANDLER::JobExportGerbers, this, std::placeholders::_1 ) );
99 Register( "drill",
100 std::bind( &PCBNEW_JOBS_HANDLER::JobExportDrill, this, std::placeholders::_1 ) );
101 Register( "pos", std::bind( &PCBNEW_JOBS_HANDLER::JobExportPos, this, std::placeholders::_1 ) );
102 Register( "fpupgrade",
103 std::bind( &PCBNEW_JOBS_HANDLER::JobExportFpUpgrade, this, std::placeholders::_1 ) );
104 Register( "fpsvg",
105 std::bind( &PCBNEW_JOBS_HANDLER::JobExportFpSvg, this, std::placeholders::_1 ) );
106 Register( "drc", std::bind( &PCBNEW_JOBS_HANDLER::JobExportDrc, this, std::placeholders::_1 ) );
107 Register( "ipc2581",
108 std::bind( &PCBNEW_JOBS_HANDLER::JobExportIpc2581, this, std::placeholders::_1 ) );
109}
110
111
113{
114 JOB_EXPORT_PCB_3D* aStepJob = dynamic_cast<JOB_EXPORT_PCB_3D*>( aJob );
115
116 if( aStepJob == nullptr )
118
119 if( aJob->IsCli() )
120 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
121
122 BOARD* brd = LoadBoard( aStepJob->m_filename, true );
123 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
124
125 if( aStepJob->m_outputFile.IsEmpty() )
126 {
127 wxFileName fn = brd->GetFileName();
128 fn.SetName( fn.GetName() );
129
130 switch( aStepJob->m_format )
131 {
133 break;
135 break;
137 break;
139 break;
141 break;
142 default:
143 return CLI::EXIT_CODES::ERR_UNKNOWN; // shouldnt have gotten here
144 }
145
146 aStepJob->m_outputFile = fn.GetFullName();
147 }
148
150 {
151
152 double scale = 0.0;
153 switch ( aStepJob->m_vrmlUnits )
154 {
156 case JOB_EXPORT_PCB_3D::VRML_UNITS::METERS: scale = 0.001; break;
157 case JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS: scale = 10.0 / 25.4; break;
158 case JOB_EXPORT_PCB_3D::VRML_UNITS::INCHES: scale = 1.0 / 25.4; break;
159 }
160
161 EXPORTER_VRML vrmlExporter( brd );
162 wxString messages;
163
164 double originX = pcbIUScale.IUTomm( aStepJob->m_xOrigin );
165 double originY = pcbIUScale.IUTomm( aStepJob->m_yOrigin );
166
167 if( !aStepJob->m_hasUserOrigin )
168 {
169 BOX2I bbox = brd->ComputeBoundingBox( true );
170 originX = pcbIUScale.IUTomm( bbox.GetCenter().x );
171 originY = pcbIUScale.IUTomm( bbox.GetCenter().y );
172 }
173
174 bool success = vrmlExporter.ExportVRML_File(
175 brd->GetProject(), &messages, aStepJob->m_outputFile, scale,
176 aStepJob->m_includeUnspecified, aStepJob->m_includeDNP,
177 !aStepJob->m_vrmlModelDir.IsEmpty(), aStepJob->m_vrmlRelativePaths,
178 aStepJob->m_vrmlModelDir, originX, originY );
179
180 if ( success )
181 {
182 m_reporter->Report( wxString::Format( _( "Successfully exported VRML to %s" ),
183 aStepJob->m_outputFile ),
185 }
186 else
187 {
188 m_reporter->Report( _( "Error exporting VRML" ), RPT_SEVERITY_ERROR );
190 }
191 }
192 else
193 {
195 params.m_exportBoardBody = aStepJob->m_exportBoardBody;
196 params.m_exportComponents = aStepJob->m_exportComponents;
197 params.m_exportTracksVias = aStepJob->m_exportTracks;
198 params.m_exportZones = aStepJob->m_exportZones;
199 params.m_exportInnerCopper = aStepJob->m_exportInnerCopper;
200 params.m_fuseShapes = aStepJob->m_fuseShapes;
202 params.m_includeDNP = aStepJob->m_includeDNP;
204 params.m_overwrite = aStepJob->m_overwrite;
205 params.m_substModels = aStepJob->m_substModels;
206 params.m_origin = VECTOR2D( aStepJob->m_xOrigin, aStepJob->m_yOrigin );
207 params.m_useDrillOrigin = aStepJob->m_useDrillOrigin;
208 params.m_useGridOrigin = aStepJob->m_useGridOrigin;
209 params.m_boardOnly = aStepJob->m_boardOnly;
210 params.m_optimizeStep = aStepJob->m_optimizeStep;
211 params.m_netFilter = aStepJob->m_netFilter;
212
213 switch( aStepJob->m_format )
214 {
217 break;
220 break;
223 break;
226 break;
227 default:
228 return CLI::EXIT_CODES::ERR_UNKNOWN; // shouldnt have gotten here
229 }
230
231 EXPORTER_STEP stepExporter( brd, params );
232 stepExporter.m_outputFile = aStepJob->m_outputFile;
233
234 if( !stepExporter.Export() )
236 }
237
238 return CLI::EXIT_CODES::OK;
239}
240
241
243{
244 JOB_PCB_RENDER* aRenderJob = dynamic_cast<JOB_PCB_RENDER*>( aJob );
245
246 if( aRenderJob == nullptr )
248
249 if( aJob->IsCli() )
250 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
251
252 BOARD* brd = LoadBoard( aRenderJob->m_filename, true );
253 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
254
255 BOARD_ADAPTER m_boardAdapter;
256
257 m_boardAdapter.SetBoard( brd );
258 m_boardAdapter.m_IsBoardView = false;
259 m_boardAdapter.m_IsPreviewer =
260 true; // Force display 3D models, regardless the 3D viewer options
261
264
267 && aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ) )
268 {
269 BOARD_ADAPTER::g_DefaultBackgroundTop = COLOR4D( 1.0, 1.0, 1.0, 0.0 );
270 BOARD_ADAPTER::g_DefaultBackgroundBot = COLOR4D( 1.0, 1.0, 1.0, 0.0 );
271 }
272
273 if( aRenderJob->m_quality == JOB_PCB_RENDER::QUALITY::BASIC )
274 {
275 // Silkscreen is pixelated without antialiasing
277
278 cfg->m_Render.raytrace_backfloor = false;
280
282 cfg->m_Render.raytrace_reflections = false;
283 cfg->m_Render.raytrace_shadows = false;
284
285 // Better colors
287
288 // Tracks below soldermask are not visible without refractions
289 cfg->m_Render.raytrace_refractions = true;
291 }
292 else if( aRenderJob->m_quality == JOB_PCB_RENDER::QUALITY::HIGH )
293 {
295 cfg->m_Render.raytrace_backfloor = true;
298 cfg->m_Render.raytrace_reflections = true;
299 cfg->m_Render.raytrace_shadows = true;
300 cfg->m_Render.raytrace_refractions = true;
302 }
303
304 if( aRenderJob->m_floor )
305 {
306 cfg->m_Render.raytrace_backfloor = true;
307 cfg->m_Render.raytrace_shadows = true;
309 }
310
311 cfg->m_CurrentPreset = aRenderJob->m_colorPreset;
312 m_boardAdapter.m_Cfg = cfg;
313
315
316 static std::map<JOB_PCB_RENDER::SIDE, VIEW3D_TYPE> s_viewCmdMap = {
317 { JOB_PCB_RENDER::SIDE::TOP, VIEW3D_TYPE::VIEW3D_TOP },
318 { JOB_PCB_RENDER::SIDE::BOTTOM, VIEW3D_TYPE::VIEW3D_BOTTOM },
319 { JOB_PCB_RENDER::SIDE::LEFT, VIEW3D_TYPE::VIEW3D_LEFT },
320 { JOB_PCB_RENDER::SIDE::RIGHT, VIEW3D_TYPE::VIEW3D_RIGHT },
321 { JOB_PCB_RENDER::SIDE::FRONT, VIEW3D_TYPE::VIEW3D_FRONT },
322 { JOB_PCB_RENDER::SIDE::BACK, VIEW3D_TYPE::VIEW3D_BACK },
323 };
324
325 PROJECTION_TYPE projection =
326 aRenderJob->m_perspective ? PROJECTION_TYPE::PERSPECTIVE : PROJECTION_TYPE::ORTHO;
327
328 wxSize windowSize( aRenderJob->m_width, aRenderJob->m_height );
329 TRACK_BALL camera( 2 * RANGE_SCALE_3D );
330
331 camera.SetProjection( projection );
332 camera.SetCurWindowSize( windowSize );
333
334 RENDER_3D_RAYTRACE_RAM raytrace( m_boardAdapter, camera );
335 raytrace.SetCurWindowSize( windowSize );
336
337 for( bool first = true; raytrace.Redraw( false, m_reporter, m_reporter ); first = false )
338 {
339 if( first )
340 {
341 const float cmTo3D = m_boardAdapter.BiuTo3dUnits() * pcbIUScale.mmToIU( 10.0 );
342
343 // First redraw resets lookat point to the board center, so set up the camera here
344 camera.ViewCommand_T1( s_viewCmdMap[aRenderJob->m_side] );
345
346 camera.SetLookAtPos_T1(
347 camera.GetLookAtPos_T1()
348 + SFVEC3F( aRenderJob->m_pivot.x, aRenderJob->m_pivot.y, aRenderJob->m_pivot.z )
349 * cmTo3D );
350
351 camera.Pan_T1(
352 SFVEC3F( aRenderJob->m_pan.x, aRenderJob->m_pan.y, aRenderJob->m_pan.z ) );
353
354 camera.Zoom_T1( aRenderJob->m_zoom );
355
356 camera.RotateX_T1( DEG2RAD( aRenderJob->m_rotation.x ) );
357 camera.RotateY_T1( DEG2RAD( aRenderJob->m_rotation.y ) );
358 camera.RotateZ_T1( DEG2RAD( aRenderJob->m_rotation.z ) );
359
360 camera.Interpolate( 1.0f );
361 camera.SetT0_and_T1_current_T();
362 camera.ParametersChanged();
363 }
364 }
365
366 GLubyte* rgbaBuffer = raytrace.GetBuffer();
367 wxSize realSize = raytrace.GetRealBufferSize();
368 bool success = !!rgbaBuffer;
369
370 if( rgbaBuffer )
371 {
372 const unsigned int wxh = realSize.x * realSize.y;
373
374 unsigned char* rgbBuffer = (unsigned char*) malloc( wxh * 3 );
375 unsigned char* alphaBuffer = (unsigned char*) malloc( wxh );
376
377 unsigned char* rgbaPtr = rgbaBuffer;
378 unsigned char* rgbPtr = rgbBuffer;
379 unsigned char* alphaPtr = alphaBuffer;
380
381 for( int y = 0; y < realSize.y; y++ )
382 {
383 for( int x = 0; x < realSize.x; x++ )
384 {
385 rgbPtr[0] = rgbaPtr[0];
386 rgbPtr[1] = rgbaPtr[1];
387 rgbPtr[2] = rgbaPtr[2];
388 alphaPtr[0] = rgbaPtr[3];
389
390 rgbaPtr += 4;
391 rgbPtr += 3;
392 alphaPtr += 1;
393 }
394 }
395
396 wxImage image( realSize );
397 image.SetData( rgbBuffer );
398 image.SetAlpha( alphaBuffer );
399 image = image.Mirror( false );
400
401 image.SetOption( wxIMAGE_OPTION_QUALITY, 90 );
402 image.SaveFile( aRenderJob->m_outputFile,
403 aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ? wxBITMAP_TYPE_PNG
404 : wxBITMAP_TYPE_JPEG );
405 }
406
407 m_reporter->Report( wxString::Format( _( "Actual image size: %dx%d" ), realSize.x, realSize.y )
408 + wxS( "\n" ),
410
411 if( success )
412 m_reporter->Report( _( "Successfully created 3D render image" ) + wxS( "\n" ),
414 else
415 m_reporter->Report( _( "Error creating 3D render image" ) + wxS( "\n" ),
417
418 return CLI::EXIT_CODES::OK;
419}
420
421
423{
424 JOB_EXPORT_PCB_SVG* aSvgJob = dynamic_cast<JOB_EXPORT_PCB_SVG*>( aJob );
425
426 if( aSvgJob == nullptr )
428
429 PCB_PLOT_SVG_OPTIONS svgPlotOptions;
430 svgPlotOptions.m_blackAndWhite = aSvgJob->m_blackAndWhite;
431 svgPlotOptions.m_colorTheme = aSvgJob->m_colorTheme;
432 svgPlotOptions.m_outputFile = aSvgJob->m_outputFile;
433 svgPlotOptions.m_mirror = aSvgJob->m_mirror;
434 svgPlotOptions.m_negative = aSvgJob->m_negative;
435 svgPlotOptions.m_pageSizeMode = aSvgJob->m_pageSizeMode;
436 svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
437 svgPlotOptions.m_plotFrame = aSvgJob->m_plotDrawingSheet;
438 svgPlotOptions.m_drillShapeOption = aSvgJob->m_drillShapeOption;
439
440 if( aJob->IsCli() )
441 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
442
443 BOARD* brd = LoadBoard( aSvgJob->m_filename, true );
445 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
446
447 if( aJob->IsCli() )
448 {
449 if( EXPORT_SVG::Plot( brd, svgPlotOptions ) )
450 m_reporter->Report( _( "Successfully created svg file" ) + wxS( "\n" ), RPT_SEVERITY_INFO );
451 else
452 m_reporter->Report( _( "Error creating svg file" ) + wxS( "\n" ), RPT_SEVERITY_ERROR );
453 }
454
455 return CLI::EXIT_CODES::OK;
456}
457
458
460{
461 JOB_EXPORT_PCB_DXF* aDxfJob = dynamic_cast<JOB_EXPORT_PCB_DXF*>( aJob );
462
463 if( aDxfJob == nullptr )
465
466 if( aJob->IsCli() )
467 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
468
469 BOARD* brd = LoadBoard( aDxfJob->m_filename, true );
471 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
472
473 if( aDxfJob->m_outputFile.IsEmpty() )
474 {
475 wxFileName fn = brd->GetFileName();
476 fn.SetName( fn.GetName() );
477 fn.SetExt( GetDefaultPlotExtension( PLOT_FORMAT::DXF ) );
478
479 aDxfJob->m_outputFile = fn.GetFullName();
480 }
481
482 PCB_PLOT_PARAMS plotOpts;
483 plotOpts.SetFormat( PLOT_FORMAT::DXF );
484
486
488 plotOpts.SetDXFPlotUnits( DXF_UNITS::MILLIMETERS );
489 else
490 plotOpts.SetDXFPlotUnits( DXF_UNITS::INCHES );
491
492 plotOpts.SetPlotFrameRef( aDxfJob->m_plotBorderTitleBlocks );
493 plotOpts.SetPlotValue( aDxfJob->m_plotFootprintValues );
494 plotOpts.SetPlotReference( aDxfJob->m_plotRefDes );
495 plotOpts.SetLayerSelection( aDxfJob->m_printMaskLayer );
496
498 brd, &plotOpts, UNDEFINED_LAYER, aDxfJob->m_outputFile, wxEmptyString, wxEmptyString );
499
500 if( plotter )
501 {
502 PlotBoardLayers( brd, plotter, aDxfJob->m_printMaskLayer, plotOpts );
503 plotter->EndPlot();
504 }
505
506 delete plotter;
507
508 return CLI::EXIT_CODES::OK;
509}
510
511
513{
514 JOB_EXPORT_PCB_PDF* aPdfJob = dynamic_cast<JOB_EXPORT_PCB_PDF*>( aJob );
515
516 if( aPdfJob == nullptr )
518
519 if( aJob->IsCli() )
520 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
521
522 BOARD* brd = LoadBoard( aPdfJob->m_filename, true );
524 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
525
526 if( aPdfJob->m_outputFile.IsEmpty() )
527 {
528 wxFileName fn = brd->GetFileName();
529 fn.SetName( fn.GetName() );
530 fn.SetExt( GetDefaultPlotExtension( PLOT_FORMAT::PDF ) );
531
532 aPdfJob->m_outputFile = fn.GetFullName();
533 }
534
535 PCB_PLOT_PARAMS plotOpts;
536 plotOpts.SetFormat( PLOT_FORMAT::PDF );
537
538 plotOpts.SetPlotFrameRef( aPdfJob->m_plotBorderTitleBlocks );
539 plotOpts.SetPlotValue( aPdfJob->m_plotFootprintValues );
540 plotOpts.SetPlotReference( aPdfJob->m_plotRefDes );
541
542 plotOpts.SetLayerSelection( aPdfJob->m_printMaskLayer );
543
545 plotOpts.SetColorSettings( mgr.GetColorSettings( aPdfJob->m_colorTheme ) );
546 plotOpts.SetMirror( aPdfJob->m_mirror );
547 plotOpts.SetBlackAndWhite( aPdfJob->m_blackAndWhite );
548 plotOpts.SetNegative( aPdfJob->m_negative );
549
550 switch( aPdfJob->m_drillShapeOption )
551 {
552 default:
553 case 0: plotOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE ); break;
554 case 1: plotOpts.SetDrillMarksType( DRILL_MARKS::SMALL_DRILL_SHAPE ); break;
555 case 2: plotOpts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE ); break;
556 }
557
559 brd, &plotOpts, UNDEFINED_LAYER, aPdfJob->m_outputFile, wxEmptyString, wxEmptyString );
560
561 if( plotter )
562 {
563 PlotBoardLayers( brd, plotter, aPdfJob->m_printMaskLayer, plotOpts );
564 PlotInteractiveLayer( brd, plotter, plotOpts );
565 plotter->EndPlot();
566 }
567
568 delete plotter;
569
570 return CLI::EXIT_CODES::OK;
571}
572
573
575{
576 int exitCode = CLI::EXIT_CODES::OK;
577 JOB_EXPORT_PCB_GERBERS* aGerberJob = dynamic_cast<JOB_EXPORT_PCB_GERBERS*>( aJob );
578
579 if( aGerberJob == nullptr )
581
582 if( aJob->IsCli() )
583 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
584
585 BOARD* brd = LoadBoard( aGerberJob->m_filename, true );
586 loadOverrideDrawingSheet( brd, aGerberJob->m_drawingSheet );
587 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
588
589 PCB_PLOT_PARAMS boardPlotOptions = brd->GetPlotOptions();
590 LSET plotOnAllLayersSelection = boardPlotOptions.GetPlotOnAllLayersSelection();
591 GERBER_JOBFILE_WRITER jobfile_writer( brd );
592
593 wxString fileExt;
594
595 if( aGerberJob->m_useBoardPlotParams )
596 {
597 // The board plot options are saved with all copper layers enabled, even those that don't
598 // exist in the current stackup. This is done so the layers are automatically enabled in the plot
599 // dialog when the user enables them. We need to filter out these not-enabled layers here so
600 // we don't plot 32 layers when we only have 4, etc.
601 LSET plotLayers = ( boardPlotOptions.GetLayerSelection() & LSET::AllNonCuMask() )
602 | ( brd->GetEnabledLayers() & LSET::AllCuMask() );
603 aGerberJob->m_printMaskLayer = plotLayers.SeqStackupForPlotting();
604 aGerberJob->m_layersIncludeOnAll = boardPlotOptions.GetPlotOnAllLayersSelection();
605 }
606 else
607 {
608 // default to the board enabled layers
609 if( aGerberJob->m_printMaskLayer == 0 )
611
612 if( aGerberJob->m_layersIncludeOnAllSet )
613 aGerberJob->m_layersIncludeOnAll = plotOnAllLayersSelection;
614 }
615
616 for( LSEQ seq = LSET( aGerberJob->m_printMaskLayer ).UIOrder(); seq; ++seq )
617 {
618 LSEQ plotSequence;
619
620 // Base layer always gets plotted first.
621 plotSequence.push_back( *seq );
622
623 // Now all the "include on all" layers
624 for( LSEQ seqAll = aGerberJob->m_layersIncludeOnAll.UIOrder(); seqAll; ++seqAll )
625 {
626 // Don't plot the same layer more than once;
627 if( find( plotSequence.begin(), plotSequence.end(), *seqAll ) != plotSequence.end() )
628 continue;
629
630 plotSequence.push_back( *seqAll );
631 }
632
633 // Pick the basename from the board file
634 wxFileName fn( brd->GetFileName() );
635 PCB_LAYER_ID layer = *seq;
636 PCB_PLOT_PARAMS plotOpts;
637
638 if( aGerberJob->m_useBoardPlotParams )
639 plotOpts = boardPlotOptions;
640 else
641 populateGerberPlotOptionsFromJob( plotOpts, aGerberJob );
642
643 if( plotOpts.GetUseGerberProtelExtensions() )
644 fileExt = GetGerberProtelExtension( layer );
645 else
647
648 BuildPlotFileName( &fn, aGerberJob->m_outputFile, brd->GetLayerName( layer ), fileExt );
649 wxString fullname = fn.GetFullName();
650
651 jobfile_writer.AddGbrFile( layer, fullname );
652
653 // We are feeding it one layer at the start here to silence a logic check
655 brd, &plotOpts, layer, fn.GetFullPath(), wxEmptyString, wxEmptyString );
656
657 if( plotter )
658 {
659 m_reporter->Report( wxString::Format( _( "Plotted to '%s'.\n" ), fn.GetFullPath() ),
661 PlotBoardLayers( brd, plotter, plotSequence, plotOpts );
662 plotter->EndPlot();
663 }
664 else
665 {
666 m_reporter->Report( wxString::Format( _( "Failed to plot to '%s'.\n" ),
667 fn.GetFullPath() ),
670 }
671
672 delete plotter;
673 }
674
675 wxFileName fn( aGerberJob->m_filename );
676
677 // Build gerber job file from basename
678 BuildPlotFileName( &fn, aGerberJob->m_outputFile, wxT( "job" ),
680 jobfile_writer.CreateJobFile( fn.GetFullPath() );
681
682 return exitCode;
683}
684
685
688{
689 aPlotOpts.SetFormat( PLOT_FORMAT::GERBER );
690
691 aPlotOpts.SetPlotFrameRef( aJob->m_plotBorderTitleBlocks );
692 aPlotOpts.SetPlotValue( aJob->m_plotFootprintValues );
693 aPlotOpts.SetPlotReference( aJob->m_plotRefDes );
694
696
697 // Always disable plot pad holes
698 aPlotOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
699
701 aPlotOpts.SetUseGerberX2format( aJob->m_useX2Format );
703 aPlotOpts.SetUseAuxOrigin( aJob->m_useAuxOrigin );
705 aPlotOpts.SetGerberPrecision( aJob->m_precision );
706}
707
708
710{
711 int exitCode = CLI::EXIT_CODES::OK;
712 JOB_EXPORT_PCB_GERBER* aGerberJob = dynamic_cast<JOB_EXPORT_PCB_GERBER*>( aJob );
713
714 if( aGerberJob == nullptr )
716
717 if( aJob->IsCli() )
718 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
719
720 BOARD* brd = LoadBoard( aGerberJob->m_filename, true );
721 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
722
723 if( aGerberJob->m_outputFile.IsEmpty() )
724 {
725 wxFileName fn = brd->GetFileName();
726 fn.SetName( fn.GetName() );
727 fn.SetExt( GetDefaultPlotExtension( PLOT_FORMAT::GERBER ) );
728
729 aGerberJob->m_outputFile = fn.GetFullName();
730 }
731
732 PCB_PLOT_PARAMS plotOpts;
733 populateGerberPlotOptionsFromJob( plotOpts, aGerberJob );
734 plotOpts.SetLayerSelection( aGerberJob->m_printMaskLayer );
735
736 // We are feeding it one layer at the start here to silence a logic check
738 brd, &plotOpts, aGerberJob->m_printMaskLayer.front(), aGerberJob->m_outputFile,
739 wxEmptyString, wxEmptyString );
740
741 if( plotter )
742 {
743 PlotBoardLayers( brd, plotter, aGerberJob->m_printMaskLayer, plotOpts );
744 plotter->EndPlot();
745 }
746 else
747 {
748 m_reporter->Report( wxString::Format( _( "Failed to plot to '%s'.\n" ),
749 aGerberJob->m_outputFile ),
752 }
753
754 delete plotter;
755
756 return exitCode;
757}
758
761
762
764{
765 JOB_EXPORT_PCB_DRILL* aDrillJob = dynamic_cast<JOB_EXPORT_PCB_DRILL*>( aJob );
766
767 if( aDrillJob == nullptr )
769
770 if( aJob->IsCli() )
771 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
772
773 BOARD* brd = LoadBoard( aDrillJob->m_filename, true );
774
775 // ensure output dir exists
776 wxFileName fn( aDrillJob->m_outputDir + wxT( "/" ) );
777
778 if( !fn.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
779 {
780 m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
782 }
783
784 std::unique_ptr<GENDRILL_WRITER_BASE> drillWriter;
785
787 drillWriter = std::make_unique<EXCELLON_WRITER>( brd );
788 else
789 drillWriter = std::make_unique<GERBER_WRITER>( brd );
790
791 VECTOR2I offset;
792
794 offset = VECTOR2I( 0, 0 );
795 else
796 offset = brd->GetDesignSettings().GetAuxOrigin();
797
798 PLOT_FORMAT mapFormat = PLOT_FORMAT::PDF;
799
800 switch( aDrillJob->m_mapFormat )
801 {
802 case JOB_EXPORT_PCB_DRILL::MAP_FORMAT::POSTSCRIPT: mapFormat = PLOT_FORMAT::POST; break;
803 case JOB_EXPORT_PCB_DRILL::MAP_FORMAT::GERBER_X2: mapFormat = PLOT_FORMAT::GERBER; break;
804 case JOB_EXPORT_PCB_DRILL::MAP_FORMAT::DXF: mapFormat = PLOT_FORMAT::DXF; break;
805 case JOB_EXPORT_PCB_DRILL::MAP_FORMAT::SVG: mapFormat = PLOT_FORMAT::SVG; break;
806 default:
807 case JOB_EXPORT_PCB_DRILL::MAP_FORMAT::PDF: mapFormat = PLOT_FORMAT::PDF; break;
808 }
809
811 {
813 switch( aDrillJob->m_zeroFormat )
814 {
817 break;
820 break;
823 break;
825 default:
827 break;
828 }
829
830 DRILL_PRECISION precision;
831
833 precision = precisionListForInches;
834 else
835 precision = precisionListForMetric;
836
837 EXCELLON_WRITER* excellonWriter = dynamic_cast<EXCELLON_WRITER*>( drillWriter.get() );
838
839 if( excellonWriter == nullptr )
841
842 excellonWriter->SetFormat( aDrillJob->m_drillUnits
844 zeroFmt, precision.m_Lhs, precision.m_Rhs );
845 excellonWriter->SetOptions( aDrillJob->m_excellonMirrorY,
846 aDrillJob->m_excellonMinimalHeader,
847 offset, aDrillJob->m_excellonCombinePTHNPTH );
848 excellonWriter->SetRouteModeForOvalHoles( aDrillJob->m_excellonOvalDrillRoute );
849 excellonWriter->SetMapFileFormat( mapFormat );
850
851 if( !excellonWriter->CreateDrillandMapFilesSet( aDrillJob->m_outputDir, true,
852 aDrillJob->m_generateMap, m_reporter ) )
853 {
855 }
856 }
858 {
859 GERBER_WRITER* gerberWriter = dynamic_cast<GERBER_WRITER*>( drillWriter.get() );
860
861 if( gerberWriter == nullptr )
863
864 // Set gerber precision: only 5 or 6 digits for mantissa are allowed
865 // (SetFormat() accept 5 or 6, and any other value set the precision to 5)
866 // the integer part precision is always 4, and units always mm
867 gerberWriter->SetFormat( aDrillJob->m_gerberPrecision );
868 gerberWriter->SetOptions( offset );
869 gerberWriter->SetMapFileFormat( mapFormat );
870
871 if( !gerberWriter->CreateDrillandMapFilesSet( aDrillJob->m_outputDir, true,
872 aDrillJob->m_generateMap, m_reporter ) )
873 {
875 }
876 }
877
878 return CLI::EXIT_CODES::OK;
879}
880
881
883{
884 JOB_EXPORT_PCB_POS* aPosJob = dynamic_cast<JOB_EXPORT_PCB_POS*>( aJob );
885
886 if( aPosJob == nullptr )
888
889 if( aJob->IsCli() )
890 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
891
892 BOARD* brd = LoadBoard( aPosJob->m_filename, true );
893
894 if( aPosJob->m_outputFile.IsEmpty() )
895 {
896 wxFileName fn = brd->GetFileName();
897 fn.SetName( fn.GetName() );
898
901 else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::CSV )
902 fn.SetExt( FILEEXT::CsvFileExtension );
903 else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::GERBER )
904 fn.SetExt( FILEEXT::GerberFileExtension );
905
906 aPosJob->m_outputFile = fn.GetFullName();
907 }
908
911 {
912 FILE* file = nullptr;
913 file = wxFopen( aPosJob->m_outputFile, wxS( "wt" ) );
914
915 if( file == nullptr )
917
918 std::string data;
919
920 bool frontSide = aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::FRONT
922
923 bool backSide = aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BACK
925
926 PLACE_FILE_EXPORTER exporter( brd,
928 aPosJob->m_smdOnly, aPosJob->m_excludeFootprintsWithTh,
929 aPosJob->m_excludeDNP,
930 frontSide, backSide,
933 aPosJob->m_negateBottomX );
934 data = exporter.GenPositionData();
935
936 fputs( data.c_str(), file );
937 fclose( file );
938 }
939 else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::GERBER )
940 {
941 PLACEFILE_GERBER_WRITER exporter( brd );
942
943 PCB_LAYER_ID gbrLayer = F_Cu;
944
945 if( aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BACK )
946 gbrLayer = B_Cu;
947
948 exporter.CreatePlaceFile( aPosJob->m_outputFile, gbrLayer, aPosJob->m_gerberBoardEdge );
949 }
950
951 return CLI::EXIT_CODES::OK;
952}
953
954extern FOOTPRINT* try_load_footprint( const wxFileName& aFileName, PCB_IO_MGR::PCB_FILE_T aFileType,
955 const wxString& aName );
956
957
959{
960 JOB_FP_UPGRADE* upgradeJob = dynamic_cast<JOB_FP_UPGRADE*>( aJob );
961
962 if( upgradeJob == nullptr )
964
966
967 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
968 {
969 if( wxFile::Exists( upgradeJob->m_outputLibraryPath ) ||
970 wxDir::Exists( upgradeJob->m_outputLibraryPath) )
971 {
972 m_reporter->Report( _( "Output path must not conflict with existing path\n" ),
975 }
976 }
977 else if( fileType != PCB_IO_MGR::KICAD_SEXP )
978 {
979 m_reporter->Report( _( "Output path must be specified to convert legacy and non-KiCad libraries\n" ),
981
983 }
984
986 {
987 if( !wxDir::Exists( upgradeJob->m_libraryPath ) )
988 {
989 m_reporter->Report( _( "Footprint library path does not exist or is not accessible\n" ),
992 }
993
994
995 if( aJob->IsCli() )
996 m_reporter->Report( _( "Loading footprint library\n" ), RPT_SEVERITY_INFO );
997
999 FP_CACHE fpLib( &pcb_io, upgradeJob->m_libraryPath );
1000
1001 try
1002 {
1003 fpLib.Load();
1004 }
1005 catch( ... )
1006 {
1007 m_reporter->Report( _( "Unable to load library\n" ), RPT_SEVERITY_ERROR );
1009 }
1010
1011 bool shouldSave = upgradeJob->m_force;
1012
1013 for( const auto& footprint : fpLib.GetFootprints() )
1014 {
1015 if( footprint.second->GetFootprint()->GetFileFormatVersionAtLoad()
1017 {
1018 shouldSave = true;
1019 }
1020 }
1021
1022 if( shouldSave )
1023 {
1024 m_reporter->Report( _( "Saving footprint library\n" ), RPT_SEVERITY_INFO );
1025
1026 try
1027 {
1028 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
1029 {
1030 fpLib.SetPath( upgradeJob->m_outputLibraryPath );
1031 }
1032
1033 fpLib.Save();
1034 }
1035 catch( ... )
1036 {
1037 m_reporter->Report( _( "Unable to save library\n" ), RPT_SEVERITY_ERROR );
1039 }
1040 }
1041 else
1042 {
1043 m_reporter->Report( _( "Footprint library was not updated\n" ), RPT_SEVERITY_INFO );
1044 }
1045 }
1046 else
1047 {
1048 if( !PCB_IO_MGR::ConvertLibrary( nullptr, upgradeJob->m_libraryPath, upgradeJob->m_outputLibraryPath ) )
1049 {
1050 m_reporter->Report( ( "Unable to convert library\n" ), RPT_SEVERITY_ERROR );
1052 }
1053 }
1054
1055 return CLI::EXIT_CODES::OK;
1056}
1057
1058
1060{
1061 JOB_FP_EXPORT_SVG* svgJob = dynamic_cast<JOB_FP_EXPORT_SVG*>( aJob );
1062
1063 if( svgJob == nullptr )
1065
1066 if( aJob->IsCli() )
1067 m_reporter->Report( _( "Loading footprint library\n" ), RPT_SEVERITY_INFO );
1068
1070 FP_CACHE fpLib( &pcb_io, svgJob->m_libraryPath );
1071
1072 try
1073 {
1074 fpLib.Load();
1075 }
1076 catch( ... )
1077 {
1078 m_reporter->Report( _( "Unable to load library\n" ), RPT_SEVERITY_ERROR );
1080 }
1081
1082 if( !svgJob->m_outputDirectory.IsEmpty() && !wxDir::Exists( svgJob->m_outputDirectory ) )
1083 {
1084 wxFileName::Mkdir( svgJob->m_outputDirectory );
1085 }
1086
1087 int exitCode = CLI::EXIT_CODES::OK;
1088
1089 // Just plot all the symbols we can
1090 FP_CACHE_FOOTPRINT_MAP& footprintMap = fpLib.GetFootprints();
1091
1092 bool singleFpPlotted = false;
1093 for( FP_CACHE_FOOTPRINT_MAP::iterator it = footprintMap.begin(); it != footprintMap.end();
1094 ++it )
1095 {
1096 const FOOTPRINT* fp = it->second->GetFootprint();
1097 if( !svgJob->m_footprint.IsEmpty() )
1098 {
1099 if( fp->GetFPID().GetLibItemName().wx_str() != svgJob->m_footprint )
1100 {
1101 // skip until we find the right footprint
1102 continue;
1103 }
1104 else
1105 {
1106 singleFpPlotted = true;
1107 }
1108 }
1109
1110 exitCode = doFpExportSvg( svgJob, fp );
1111 if( exitCode != CLI::EXIT_CODES::OK )
1112 break;
1113 }
1114
1115 if( !svgJob->m_footprint.IsEmpty() && !singleFpPlotted )
1116 {
1117 m_reporter->Report( _( "The given footprint could not be found to export." ) + wxS( "\n" ),
1119 }
1120
1121 return CLI::EXIT_CODES::OK;
1122}
1123
1124
1126{
1127 // the hack for now is we create fake boards containing the footprint and plot the board
1128 // until we refactor better plot api later
1129 std::unique_ptr<BOARD> brd;
1130 brd.reset( CreateEmptyBoard() );
1131 brd->GetProject()->ApplyTextVars( aSvgJob->GetVarOverrides() );
1132
1133 FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aFootprint->Clone() );
1134
1135 if( fp == nullptr )
1137
1138 fp->SetLink( niluuid );
1139 fp->SetFlags( IS_NEW );
1140 fp->SetParent( brd.get() );
1141
1142 for( PAD* pad : fp->Pads() )
1143 {
1144 pad->SetLocalRatsnestVisible( false );
1145 pad->SetNetCode( 0 );
1146 }
1147
1148 fp->SetOrientation( ANGLE_0 );
1149 fp->SetPosition( VECTOR2I( 0, 0 ) );
1150
1151 brd->Add( fp, ADD_MODE::INSERT, true );
1152
1153 wxFileName outputFile;
1154 outputFile.SetPath( aSvgJob->m_outputDirectory );
1155 outputFile.SetName( aFootprint->GetFPID().GetLibItemName().wx_str() );
1156 outputFile.SetExt( FILEEXT::SVGFileExtension );
1157
1158 m_reporter->Report( wxString::Format( _( "Plotting footprint '%s' to '%s'\n" ),
1159 aFootprint->GetFPID().GetLibItemName().wx_str(),
1160 outputFile.GetFullPath() ),
1162
1163
1164 PCB_PLOT_SVG_OPTIONS svgPlotOptions;
1165 svgPlotOptions.m_blackAndWhite = aSvgJob->m_blackAndWhite;
1166 svgPlotOptions.m_colorTheme = aSvgJob->m_colorTheme;
1167 svgPlotOptions.m_outputFile = outputFile.GetFullPath();
1168 svgPlotOptions.m_mirror = false;
1169 svgPlotOptions.m_pageSizeMode = 2; // board bounding box
1170 svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
1171 svgPlotOptions.m_plotFrame = false;
1172
1173 if( !EXPORT_SVG::Plot( brd.get(), svgPlotOptions ) )
1174 m_reporter->Report( _( "Error creating svg file" ) + wxS( "\n" ), RPT_SEVERITY_ERROR );
1175
1176
1177 return CLI::EXIT_CODES::OK;
1178}
1179
1180
1182{
1183 JOB_PCB_DRC* drcJob = dynamic_cast<JOB_PCB_DRC*>( aJob );
1184
1185 if( drcJob == nullptr )
1187
1188 if( aJob->IsCli() )
1189 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
1190
1191 BOARD* brd = LoadBoard( drcJob->m_filename, true );
1192 brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() );
1193
1194 if( drcJob->m_outputFile.IsEmpty() )
1195 {
1196 wxFileName fn = brd->GetFileName();
1197 fn.SetName( fn.GetName() );
1198
1200 fn.SetExt( FILEEXT::JsonFileExtension );
1201 else
1202 fn.SetExt( FILEEXT::ReportFileExtension );
1203
1204 drcJob->m_outputFile = fn.GetFullName();
1205 }
1206
1207 EDA_UNITS units;
1208
1209 switch( drcJob->m_units )
1210 {
1211 case JOB_PCB_DRC::UNITS::INCHES: units = EDA_UNITS::INCHES; break;
1212 case JOB_PCB_DRC::UNITS::MILS: units = EDA_UNITS::MILS; break;
1213 case JOB_PCB_DRC::UNITS::MILLIMETERS: units = EDA_UNITS::MILLIMETRES; break;
1214 default: units = EDA_UNITS::MILLIMETRES; break;
1215 }
1216
1217 std::shared_ptr<DRC_ENGINE> drcEngine = brd->GetDesignSettings().m_DRCEngine;
1218 std::unique_ptr<NETLIST> netlist = std::make_unique<NETLIST>();
1219
1220 drcEngine->SetDrawingSheet( getDrawingSheetProxyView( brd ) );
1221
1222 // BOARD_COMMIT uses TOOL_MANAGER to grab the board internally so we must give it one
1223 TOOL_MANAGER* toolManager = new TOOL_MANAGER;
1224 toolManager->SetEnvironment( brd, nullptr, nullptr, Kiface().KifaceSettings(), nullptr );
1225
1226 BOARD_COMMIT commit( toolManager );
1227
1228 m_reporter->Report( _( "Running DRC...\n" ), RPT_SEVERITY_INFO );
1229
1230 if( drcJob->m_parity )
1231 {
1232 typedef bool (*NETLIST_FN_PTR)( const wxString&, std::string& );
1233
1235 wxFileName schematicPath( drcJob->m_filename );
1236 NETLIST_FN_PTR netlister = (NETLIST_FN_PTR) eeschema->IfaceOrAddress( KIFACE_NETLIST_SCHEMATIC );
1237 std::string netlist_str;
1238
1239 schematicPath.SetExt( FILEEXT::KiCadSchematicFileExtension );
1240
1241 if( !schematicPath.Exists() )
1242 schematicPath.SetExt( FILEEXT::LegacySchematicFileExtension );
1243
1244 if( !schematicPath.Exists() )
1245 {
1246 m_reporter->Report( _( "Failed to find schematic for parity tests.\n" ),
1248 }
1249 else
1250 {
1251 (*netlister)( schematicPath.GetFullPath(), netlist_str );
1252
1253 try
1254 {
1255 auto lineReader = new STRING_LINE_READER( netlist_str, _( "Eeschema netlist" ) );
1256 KICAD_NETLIST_READER netlistReader( lineReader, netlist.get() );
1257 netlistReader.LoadNetlist();
1258 }
1259 catch( const IO_ERROR& )
1260 {
1261 m_reporter->Report( _( "Failed to fetch schematic netlist for parity tests.\n" ),
1263 }
1264
1265 drcEngine->SetSchematicNetlist( netlist.get() );
1266 }
1267 }
1268
1269 drcEngine->SetProgressReporter( nullptr );
1270 drcEngine->SetViolationHandler(
1271 [&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos, int aLayer )
1272 {
1273 PCB_MARKER* marker = new PCB_MARKER( aItem, aPos, aLayer );
1274 commit.Add( marker );
1275 } );
1276
1277 brd->RecordDRCExclusions();
1278 brd->DeleteMARKERs( true, true );
1279 drcEngine->RunTests( units, drcJob->m_reportAllTrackErrors, drcJob->m_parity );
1280 drcEngine->ClearViolationHandler();
1281
1282 commit.Push( _( "DRC" ), SKIP_UNDO | SKIP_SET_DIRTY );
1283
1284 // Update the exclusion status on any excluded markers that still exist.
1285 brd->ResolveDRCExclusions( false );
1286
1287 std::shared_ptr<DRC_ITEMS_PROVIDER> markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
1289
1290 std::shared_ptr<DRC_ITEMS_PROVIDER> ratsnestProvider =
1291 std::make_shared<DRC_ITEMS_PROVIDER>( brd, MARKER_BASE::MARKER_RATSNEST );
1292
1293 std::shared_ptr<DRC_ITEMS_PROVIDER> fpWarningsProvider =
1294 std::make_shared<DRC_ITEMS_PROVIDER>( brd, MARKER_BASE::MARKER_PARITY );
1295
1296 markersProvider->SetSeverities( drcJob->m_severity );
1297 ratsnestProvider->SetSeverities( drcJob->m_severity );
1298 fpWarningsProvider->SetSeverities( drcJob->m_severity );
1299
1300 m_reporter->Report( wxString::Format( _( "Found %d violations\n" ),
1301 markersProvider->GetCount() ),
1303 m_reporter->Report( wxString::Format( _( "Found %d unconnected items\n" ),
1304 ratsnestProvider->GetCount() ),
1306
1307 if( drcJob->m_parity )
1308 {
1309 m_reporter->Report( wxString::Format( _( "Found %d schematic parity issues\n" ),
1310 fpWarningsProvider->GetCount() ),
1312 }
1313
1314 DRC_REPORT reportWriter( brd, units, markersProvider, ratsnestProvider, fpWarningsProvider );
1315
1316 bool wroteReport = false;
1317
1319 wroteReport = reportWriter.WriteJsonReport( drcJob->m_outputFile );
1320 else
1321 wroteReport = reportWriter.WriteTextReport( drcJob->m_outputFile );
1322
1323 if( !wroteReport )
1324 {
1325 m_reporter->Report( wxString::Format( _( "Unable to save DRC report to %s\n" ),
1326 drcJob->m_outputFile ),
1329 }
1330
1331 m_reporter->Report( wxString::Format( _( "Saved DRC Report to %s\n" ),
1332 drcJob->m_outputFile ),
1334
1335 if( drcJob->m_exitCodeViolations )
1336 {
1337 if( markersProvider->GetCount() > 0 || ratsnestProvider->GetCount() > 0
1338 || fpWarningsProvider->GetCount() > 0 )
1339 {
1341 }
1342 }
1343
1345}
1346
1347
1349{
1350 JOB_EXPORT_PCB_IPC2581* job = dynamic_cast<JOB_EXPORT_PCB_IPC2581*>( aJob );
1351
1352 if( job == nullptr )
1354
1355 if( job->IsCli() )
1356 m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
1357
1358 BOARD* brd = LoadBoard( job->m_filename, true );
1359
1360 if( job->m_outputFile.IsEmpty() )
1361 {
1362 wxFileName fn = brd->GetFileName();
1363 fn.SetName( fn.GetName() );
1364 fn.SetExt( FILEEXT::Ipc2581FileExtension );
1365
1366 job->m_outputFile = fn.GetFullName();
1367 }
1368
1369 STRING_UTF8_MAP props;
1370 props["units"] = job->m_units == JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS ? "mm"
1371 : "inch";
1372 props["sigfig"] = wxString::Format( "%d", job->m_units );
1373 props["version"] = job->m_version == JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::C ? "C" : "B";
1374 props["OEMRef"] = job->m_colInternalId;
1375 props["mpn"] = job->m_colMfgPn;
1376 props["mfg"] = job->m_colMfg;
1377 props["dist"] = job->m_colDist;
1378 props["distpn"] = job->m_colDistPn;
1379
1380 wxString tempFile = wxFileName::CreateTempFileName( wxS( "pcbnew_ipc" ) );
1381 try
1382 {
1384 pi->SetProgressReporter( m_progressReporter );
1385 pi->SaveBoard( tempFile, brd, &props );
1386 }
1387 catch( const IO_ERROR& ioe )
1388 {
1389 m_reporter->Report( wxString::Format( _( "Error generating IPC2581 file '%s'.\n%s" ),
1390 job->m_filename, ioe.What() ),
1392
1393 wxRemoveFile( tempFile );
1394
1396 }
1397
1398 if( job->m_compress )
1399 {
1400 wxFileName tempfn = job->m_outputFile;
1401 tempfn.SetExt( FILEEXT::Ipc2581FileExtension );
1402 wxFileName zipfn = tempFile;
1403 zipfn.SetExt( "zip" );
1404
1405 wxFFileOutputStream fnout( zipfn.GetFullPath() );
1406 wxZipOutputStream zip( fnout );
1407 wxFFileInputStream fnin( tempFile );
1408
1409 zip.PutNextEntry( tempfn.GetFullName() );
1410 fnin.Read( zip );
1411 zip.Close();
1412 fnout.Close();
1413
1414 wxRemoveFile( tempFile );
1415 tempFile = zipfn.GetFullPath();
1416 }
1417
1418 // If save succeeded, replace the original with what we just wrote
1419 if( !wxRenameFile( tempFile, job->m_outputFile ) )
1420 {
1421 m_reporter->Report( wxString::Format( _( "Error generating IPC2581 file '%s'.\n"
1422 "Failed to rename temporary file '%s." )
1423 + wxS( "\n" ),
1424 job->m_outputFile, tempFile ),
1426 }
1427
1429}
1430
1431
1433{
1435 &aBrd->GetPageSettings(),
1436 aBrd->GetProject(),
1437 &aBrd->GetTitleBlock(),
1438 &aBrd->GetProperties() );
1439
1440 drawingSheet->SetSheetName( std::string() );
1441 drawingSheet->SetSheetPath( std::string() );
1442 drawingSheet->SetIsFirstPage( true );
1443
1444 drawingSheet->SetFileName( TO_UTF8( aBrd->GetFileName() ) );
1445
1446 return drawingSheet;
1447}
1448
1449
1450void PCBNEW_JOBS_HANDLER::loadOverrideDrawingSheet( BOARD* aBrd, const wxString& aSheetPath )
1451{
1452 // dont bother attempting to load a empty path, if there was one
1453 if( aSheetPath.IsEmpty() )
1454 return;
1455
1456 auto loadSheet =
1457 [&]( const wxString& path ) -> bool
1458 {
1461 aBrd->GetProject()->GetProjectPath() );
1462
1463 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
1464 {
1465 m_reporter->Report( wxString::Format( _( "Error loading drawing sheet '%s'." ) + wxS( "\n" ),
1466 path ),
1468 return false;
1469 }
1470
1471 return true;
1472 };
1473
1474 if( loadSheet( aSheetPath ) )
1475 return;
1476
1477 // failed loading custom path, revert back to default
1478 loadSheet( aBrd->GetProject()->GetProjectFile().m_BoardDrawingSheetFile );
1479}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:66
PROJECTION_TYPE
Definition: camera.h:40
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition: base_screen.h:85
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:73
double BiuTo3dUnits() const noexcept
Board integer units To 3D units.
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
static KIGFX::COLOR4D g_DefaultBackgroundTop
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
void Set3dCacheManager(S3D_CACHE *aCacheMgr) noexcept
Update the cache manager pointer.
Definition: board_adapter.h:84
static KIGFX::COLOR4D g_DefaultBackgroundBot
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
const VECTOR2I & GetAuxOrigin()
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:680
const PAGE_INFO & GetPageSettings() const
Definition: board.h:671
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition: board.cpp:320
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:677
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1555
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:354
const wxString & GetFileName() const
Definition: board.h:319
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition: board.cpp:337
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:674
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:567
PROJECT * GetProject() const
Definition: board.h:476
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:797
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1239
const Vec GetCenter() const
Definition: box2.h:220
void SetProjection(PROJECTION_TYPE aProjection)
Definition: camera.h:206
void RotateY_T1(float aAngleInRadians)
Definition: camera.cpp:677
bool Zoom_T1(float aFactor)
Definition: camera.cpp:628
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
Definition: camera.cpp:570
bool ViewCommand_T1(VIEW3D_TYPE aRequestedView)
Definition: camera.cpp:110
void RotateX_T1(float aAngleInRadians)
Definition: camera.cpp:671
void SetLookAtPos_T1(const SFVEC3F &aLookAtPos)
Definition: camera.h:162
const SFVEC3F & GetLookAtPos_T1() const
Definition: camera.h:167
void RotateZ_T1(float aAngleInRadians)
Definition: camera.cpp:683
bool ParametersChanged()
Definition: camera.cpp:721
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
Definition: commit.h:80
bool WriteJsonReport(const wxString &aFullFileName)
Definition: drc_report.cpp:114
bool WriteTextReport(const wxString &aFullFileName)
Definition: drc_report.cpp:47
Helper to handle drill precision format in excellon files.
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
static const wxString ResolvePath(const wxString &aPath, const wxString &aProjectPath)
Resolve a path which might be project-relative or contain env variable references.
void SetSheetPath(const std::string &aSheetPath)
Set the sheet path displayed in the title block.
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.
virtual bool EndPlot() override
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:126
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:103
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)
double m_BoardOutlinesChainingEpsilon
Definition: exporter_step.h:87
wxString m_outputFile
Wrapper to expose an API for writing VRML files, without exposing all the many structures used in the...
Definition: export_vrml.h:33
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.
static bool Plot(BOARD *aBoard, const PCB_PLOT_SVG_OPTIONS &aSvgPlotOptions)
Definition: export_svg.cpp:30
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2297
void SetLink(const KIID &aLink)
Definition: footprint.h:836
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2369
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:1986
PADS & Pads()
Definition: footprint.h:191
const LIB_ID & GetFPID() const
Definition: footprint.h:233
FP_CACHE_FOOTPRINT_MAP & GetFootprints()
void Save(FOOTPRINT *aFootprint=nullptr)
Save the footprint cache or a single footprint from it to disk.
void SetPath(const wxString &aPath)
void SetMapFileFormat(PLOT_FORMAT aMapFmt)
Initialize the format for the drill map file.
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, 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.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
PROGRESS_REPORTER * m_progressReporter
void Register(const std::string &aJobTypeName, std::function< int(JOB *job)> aHandler)
REPORTER * m_reporter
double m_BoardOutlinesChainingEpsilon
JOB_EXPORT_PCB_3D::FORMAT m_format
wxString m_libraryPath
wxString m_outputLibraryPath
OUTPUT_FORMAT m_format
Definition: job_pcb_drc.h:57
UNITS m_units
Definition: job_pcb_drc.h:47
bool m_parity
Definition: job_pcb_drc.h:60
wxString m_filename
Definition: job_pcb_drc.h:35
int m_severity
Definition: job_pcb_drc.h:49
bool m_reportAllTrackErrors
Definition: job_pcb_drc.h:38
wxString m_outputFile
Definition: job_pcb_drc.h:36
bool m_exitCodeViolations
Definition: job_pcb_drc.h:59
BG_STYLE m_bgStyle
VECTOR3D m_rotation
wxString m_filename
VECTOR3D m_pivot
std::string m_colorPreset
wxString m_outputFile
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:32
bool IsCli() const
Definition: job.h:39
const std::map< wxString, wxString > & GetVarOverrides() const
Definition: job.h:41
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.
Definition: color4d.h:104
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition: kiway.cpp:202
@ FACE_SCH
eeschema DSO
Definition: kiway.h:286
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:521
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:575
LSEQ UIOrder() const
Definition: lset.cpp:1012
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:563
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:884
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:863
@ MARKER_DRAWING_SHEET
Definition: marker_base.h:56
Definition: pad.h:59
void populateGerberPlotOptionsFromJob(PCB_PLOT_PARAMS &aPlotOpts, JOB_EXPORT_PCB_GERBER *aJob)
int JobExportFpUpgrade(JOB *aJob)
int JobExportGerber(JOB *aJob)
DS_PROXY_VIEW_ITEM * getDrawingSheetProxyView(BOARD *aBrd)
void loadOverrideDrawingSheet(BOARD *brd, const wxString &aSheetPath)
PCBNEW_JOBS_HANDLER(KIWAY *aKiway)
int JobExportGerbers(JOB *aJob)
int JobExportRender(JOB *aJob)
int doFpExportSvg(JOB_FP_EXPORT_SVG *aSvgJob, const FOOTPRINT *aFootprint)
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
static PCB_IO * PluginFind(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: pcb_io_mgr.cpp:65
static bool ConvertLibrary(STRING_UTF8_MAP *aOldFileProps, const wxString &aOldFilePath, const wxString &aNewFilePath)
Convert a schematic symbol library to the latest KiCad format.
Definition: pcb_io_mgr.cpp:187
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
Definition: pcb_io_mgr.h:56
@ KICAD_SEXP
S-expression Pcbnew file format.
Definition: pcb_io_mgr.h:58
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a footprint library's libPath.
Definition: pcb_io_mgr.cpp:132
Parameters and options when plotting/printing a board.
void SetDrillMarksType(DRILL_MARKS aVal)
void SetLayerSelection(LSET aSelection)
void SetPlotReference(bool aFlag)
void SetUseGerberX2format(bool aUse)
void SetDXFPlotPolygonMode(bool aFlag)
void SetPlotFrameRef(bool aFlag)
LSET GetLayerSelection() const
LSET GetPlotOnAllLayersSelection() const
void SetDisableGerberMacros(bool aDisable)
void SetMirror(bool aFlag)
void SetBlackAndWhite(bool blackAndWhite)
void SetGerberPrecision(int aPrecision)
void SetSubtractMaskFromSilk(bool aSubtract)
void SetPlotValue(bool aFlag)
void SetUseGerberProtelExtensions(bool aUse)
void SetDXFPlotUnits(DXF_UNITS aUnit)
void SetColorSettings(COLOR_SETTINGS *aSettings)
void SetIncludeGerberNetlistInfo(bool aUse)
void SetNegative(bool aFlag)
void SetUseAuxOrigin(bool aAux)
bool GetUseGerberProtelExtensions() const
void SetFormat(PLOT_FORMAT aFormat)
virtual bool EndPlot() override
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
Used to create Gerber drill files.
int CreatePlaceFile(wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
Create an pnp gerber file.
The ASCII format of the kicad place file is:
std::string GenPositionData()
build a string filled with the position data
wxString m_BoardDrawingSheetFile
PcbNew params.
Definition: project_file.h:154
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Definition: project_pcb.cpp:77
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:135
virtual void ApplyTextVars(const std::map< wxString, wxString > &aVarsMap)
Applies the given var map, it will create or update existing vars.
Definition: project.cpp:90
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:166
bool Redraw(bool aIsMoving, REPORTER *aStatusReporter, REPORTER *aWarningReporter) 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,...
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:253
A name/value tuple with unique names and optional values.
Master controller class:
Definition: tool_manager.h:57
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void Pan_T1(const SFVEC3F &aDeltaOffsetInc) override
Definition: track_ball.cpp:125
void SetT0_and_T1_current_T() override
This will set T0 and T1 with the current values.
Definition: track_ball.cpp:138
void Interpolate(float t) override
It will update the matrix to interpolate between T0 and T1 values.
Definition: track_ball.cpp:152
wxString wx_str() const
Definition: utf8.cpp:45
T y
Definition: vector3.h:63
T z
Definition: vector3.h:64
T x
Definition: vector3.h:62
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
static DRILL_PRECISION precisionListForInches(2, 4)
static DRILL_PRECISION precisionListForMetric(3, 3)
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition: eda_angle.h:435
#define IS_NEW
New item, just created.
EDA_UNITS
Definition: eda_units.h:46
Classes used in drill files, map files and report files generation.
Classes used in drill files, map files and report files generation.
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 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 FootprintPlaceFileExtension
static const std::string JsonFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string CsvFileExtension
static const std::string Ipc2581FileExtension
static const std::string StepFileExtension
static const std::string SVGFileExtension
static const std::string VrmlFileExtension
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition: io_mgr.h:33
@ KIFACE_NETLIST_SCHEMATIC
Definition: kiface_ids.h:56
KIID niluuid(0)
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ F_Cu
Definition: layer_ids.h:64
This file contains miscellaneous commonly used macros and functions.
static const int OK
Definition: exit_codes.h:30
static const int ERR_RC_VIOLATIONS
Definition: exit_codes.h:36
static const int ERR_INVALID_INPUT_FILE
Definition: exit_codes.h:33
static const int SUCCESS
Definition: exit_codes.h:29
static const int ERR_INVALID_OUTPUT_CONFLICT
Rules check violation count was greater than 0.
Definition: exit_codes.h:34
static const int ERR_UNKNOWN
Definition: exit_codes.h:32
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
boost::ptr_map< wxString, FP_CACHE_ITEM > FP_CACHE_FOOTPRINT_MAP
#define CTL_FOR_LIBRARY
Format output for a footprint library instead of clipboard or BOARD.
static DRILL_PRECISION precisionListForInches(2, 4)
static DRILL_PRECISION precisionListForMetric(3, 3)
FOOTPRINT * try_load_footprint(const wxFileName &aFileName, PCB_IO_MGR::PCB_FILE_T aFileType, const wxString &aName)
BOARD * LoadBoard(wxString &aFileName, bool aSetActive)
Loads a board from file This function identifies the file type by extension and determines the correc...
BOARD * CreateEmptyBoard()
Construct a default BOARD with a temporary (no filename) project.
const wxString GetGerberProtelExtension(int aLayer)
Definition: pcbplot.cpp:42
void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
Definition: pcbplot.cpp:361
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath)
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.
void PlotInteractiveLayer(BOARD *aBoard, PLOTTER *aPlotter, const PCB_PLOT_PARAMS &aPlotOpt)
Plot interactive items (hypertext links, properties, etc.).
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:64
Plotting engines similar to ps (PostScript, Gerber, svg)
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
#define SKIP_SET_DIRTY
Definition: sch_commit.h:43
#define SKIP_UNDO
Definition: sch_commit.h:41
const int scale
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
constexpr double IUTomm(int iu) const
Definition: base_units.h:86
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
wxString m_colorTheme
Definition: export_svg.h:27
wxString m_outputFile
Definition: export_svg.h:26
Declaration for a track ball camera.
double DEG2RAD(double deg)
Definition: trigo.h:200
VECTOR2< double > VECTOR2D
Definition: vector2d.h:587
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588
Definition of file extensions used in Kicad.
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44