KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema_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-2023 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
22#include <common.h>
23#include <pgm_base.h>
24#include <cli/exit_codes.h>
25#include <sch_plotter.h>
31#include <jobs/job_sch_erc.h>
34#include <schematic.h>
35#include <wx/dir.h>
36#include <wx/file.h>
37#include <memory>
38#include <connection_graph.h>
39#include "eeschema_helpers.h"
40#include <sch_painter.h>
41#include <locale_io.h>
42#include <erc.h>
43#include <erc_report.h>
47#include <reporter.h>
48#include <string_utils.h>
49
51
52#include <sch_file_versions.h>
54
55#include <netlist.h>
63
64#include <fields_data_model.h>
65
66
68{
69 Register( "bom",
70 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportBom, this, std::placeholders::_1 ) );
71 Register( "pythonbom",
73 std::placeholders::_1 ) );
74 Register( "netlist",
75 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportNetlist, this, std::placeholders::_1 ) );
76 Register( "plot",
77 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPlot, this, std::placeholders::_1 ) );
78 Register( "symupgrade",
79 std::bind( &EESCHEMA_JOBS_HANDLER::JobSymUpgrade, this, std::placeholders::_1 ) );
80 Register( "symsvg",
81 std::bind( &EESCHEMA_JOBS_HANDLER::JobSymExportSvg, this, std::placeholders::_1 ) );
82 Register( "erc",
83 std::bind( &EESCHEMA_JOBS_HANDLER::JobSchErc, this, std::placeholders::_1 ) );
84}
85
86
88 const wxString& aTheme, SCHEMATIC* aSch,
89 const wxString& aDrawingSheetOverride )
90{
91 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( aTheme );
92 aRenderSettings->LoadColors( cs );
93
94 aRenderSettings->SetDefaultPenWidth( aSch->Settings().m_DefaultLineWidth );
95 aRenderSettings->m_LabelSizeRatio = aSch->Settings().m_LabelSizeRatio;
96 aRenderSettings->m_TextOffsetRatio = aSch->Settings().m_TextOffsetRatio;
97 aRenderSettings->m_PinSymbolSize = aSch->Settings().m_PinSymbolSize;
98
99 aRenderSettings->SetDashLengthRatio( aSch->Settings().m_DashedLineDashRatio );
100 aRenderSettings->SetGapLengthRatio( aSch->Settings().m_DashedLineGapRatio );
101
102 // Load the drawing sheet from the filename stored in BASE_SCREEN::m_DrawingSheetFileName.
103 // If empty, or not existing, the default drawing sheet is loaded.
104
105 auto loadSheet = [&]( const wxString& path ) -> bool
106 {
107 wxString resolvedSheetPath =
109
110 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( resolvedSheetPath ) )
111 {
112 m_reporter->Report( wxString::Format( _( "Error loading drawing sheet '%s'." ), path ),
114 return false;
115 }
116
117 return true;
118 };
119
120 // try to load the override first
121 if( !aDrawingSheetOverride.IsEmpty() && loadSheet( aDrawingSheetOverride ) )
122 {
123 return;
124 }
125
126 // no override or failed override continues here
127 loadSheet( aSch->Settings().m_SchDrawingSheetFileName );
128}
129
130
132{
133 JOB_EXPORT_SCH_PLOT* aPlotJob = dynamic_cast<JOB_EXPORT_SCH_PLOT*>( aJob );
134
135 if( !aPlotJob )
137
138 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPlotJob->m_filename, SCH_IO_MGR::SCH_KICAD );
139
140 if( sch == nullptr )
141 {
142 m_reporter->Report( _( "Failed to load schematic file\n" ), RPT_SEVERITY_ERROR );
144 }
145
146 sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
147
148 std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
149 std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
150 InitRenderSettings( renderSettings.get(), aPlotJob->m_theme, sch, aPlotJob->m_drawingSheet );
151
152 std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
153
154 PLOT_FORMAT format = PLOT_FORMAT::PDF;
155 switch( aPlotJob->m_plotFormat )
156 {
157 case SCH_PLOT_FORMAT::DXF: format = PLOT_FORMAT::DXF; break;
158 case SCH_PLOT_FORMAT::PDF: format = PLOT_FORMAT::PDF; break;
159 case SCH_PLOT_FORMAT::SVG: format = PLOT_FORMAT::SVG; break;
160 case SCH_PLOT_FORMAT::POST: format = PLOT_FORMAT::POST; break;
161 case SCH_PLOT_FORMAT::HPGL: format = PLOT_FORMAT::HPGL; break;
162 case SCH_PLOT_FORMAT::GERBER: format = PLOT_FORMAT::GERBER; break;
163 }
164
165 HPGL_PAGE_SIZE hpglPageSize = HPGL_PAGE_SIZE::DEFAULT;
166 switch( aPlotJob->m_HPGLPaperSizeSelect )
167 {
168 case JOB_HPGL_PAGE_SIZE::DEFAULT: hpglPageSize = HPGL_PAGE_SIZE::DEFAULT; break;
169 case JOB_HPGL_PAGE_SIZE::SIZE_A: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A; break;
170 case JOB_HPGL_PAGE_SIZE::SIZE_A0: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A0; break;
171 case JOB_HPGL_PAGE_SIZE::SIZE_A1: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A1; break;
172 case JOB_HPGL_PAGE_SIZE::SIZE_A2: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A2; break;
173 case JOB_HPGL_PAGE_SIZE::SIZE_A3: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A3; break;
174 case JOB_HPGL_PAGE_SIZE::SIZE_A4: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A4; break;
175 case JOB_HPGL_PAGE_SIZE::SIZE_A5: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A5; break;
176 case JOB_HPGL_PAGE_SIZE::SIZE_B: hpglPageSize = HPGL_PAGE_SIZE::SIZE_B; break;
177 case JOB_HPGL_PAGE_SIZE::SIZE_C: hpglPageSize = HPGL_PAGE_SIZE::SIZE_C; break;
178 case JOB_HPGL_PAGE_SIZE::SIZE_D: hpglPageSize = HPGL_PAGE_SIZE::SIZE_D; break;
179 case JOB_HPGL_PAGE_SIZE::SIZE_E: hpglPageSize = HPGL_PAGE_SIZE::SIZE_E; break;
180 }
181
182 HPGL_PLOT_ORIGIN_AND_UNITS hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
183 switch( aPlotJob->m_HPGLPlotOrigin )
184 {
185 case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
186 hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT;
187 break;
188
189 case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
190 hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER;
191 break;
192 case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
193 hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT;
194 break;
195 case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
196 hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
197 break;
198 }
199
200 int pageSizeSelect = PageFormatReq::PAGE_SIZE_AUTO;
201
202 switch( aPlotJob->m_pageSizeSelect )
203 {
204 case JOB_PAGE_SIZE::PAGE_SIZE_A: pageSizeSelect = PageFormatReq::PAGE_SIZE_A; break;
205 case JOB_PAGE_SIZE::PAGE_SIZE_A4: pageSizeSelect = PageFormatReq::PAGE_SIZE_A4; break;
206 case JOB_PAGE_SIZE::PAGE_SIZE_AUTO: pageSizeSelect = PageFormatReq::PAGE_SIZE_AUTO; break;
207 }
208
209 SCH_PLOT_SETTINGS settings;
210 settings.m_blackAndWhite = aPlotJob->m_blackAndWhite;
211 settings.m_HPGLPaperSizeSelect = hpglPageSize;
212 settings.m_HPGLPenSize = aPlotJob->m_HPGLPenSize;
213 settings.m_HPGLPlotOrigin = hpglOrigin;
214 settings.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
215 settings.m_outputDirectory = aPlotJob->m_outputDirectory;
216 settings.m_outputFile = aPlotJob->m_outputFile;
217 settings.m_pageSizeSelect = pageSizeSelect;
218 settings.m_plotAll = aPlotJob->m_plotAll;
219 settings.m_plotDrawingSheet = aPlotJob->m_plotDrawingSheet;
220 settings.m_plotPages = aPlotJob->m_plotPages;
221 settings.m_theme = aPlotJob->m_theme;
222 settings.m_useBackgroundColor = aPlotJob->m_useBackgroundColor;
223
224 schPlotter->Plot( format, settings, renderSettings.get(), m_reporter );
225
226 return CLI::EXIT_CODES::OK;
227}
228
229
231{
232 JOB_EXPORT_SCH_NETLIST* aNetJob = dynamic_cast<JOB_EXPORT_SCH_NETLIST*>( aJob );
233
234 if( !aNetJob )
236
237 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
238
239 if( sch == nullptr )
240 {
241 m_reporter->Report( _( "Failed to load schematic file\n" ), RPT_SEVERITY_ERROR );
243 }
244
245 // Annotation warning check
246 SCH_REFERENCE_LIST referenceList;
247 sch->GetSheets().GetSymbols( referenceList );
248
249 if( referenceList.GetCount() > 0 )
250 {
251 if( referenceList.CheckAnnotation(
252 []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
253 {
254 // We're only interested in the end result -- either errors or not
255 } )
256 > 0 )
257 {
258 m_reporter->Report( _( "Warning: schematic has annotation errors, please use the "
259 "schematic editor to fix them\n" ),
261 }
262 }
263
264 // Test duplicate sheet names:
265 ERC_TESTER erc( sch );
266
267 if( erc.TestDuplicateSheetNames( false ) > 0 )
268 {
269 m_reporter->Report( _( "Warning: duplicate sheet names.\n" ), RPT_SEVERITY_WARNING );
270 }
271
272
273 std::unique_ptr<NETLIST_EXPORTER_BASE> helper;
274 unsigned netlistOption = 0;
275
276 wxString fileExt;
277
278 switch( aNetJob->format )
279 {
281 fileExt = NetlistFileExtension;
282 helper = std::make_unique<NETLIST_EXPORTER_KICAD>( sch );
283 break;
284
287 helper = std::make_unique<NETLIST_EXPORTER_ORCADPCB2>( sch );
288 break;
289
292 helper = std::make_unique<NETLIST_EXPORTER_CADSTAR>( sch );
293 break;
294
296 fileExt = SpiceFileExtension;
298 helper = std::make_unique<NETLIST_EXPORTER_SPICE>( sch );
299 break;
300
302 fileExt = SpiceFileExtension;
303 helper = std::make_unique<NETLIST_EXPORTER_SPICE_MODEL>( sch );
304 break;
305
307 fileExt = wxS( "xml" );
308 helper = std::make_unique<NETLIST_EXPORTER_XML>( sch );
309 break;
310 default:
311 m_reporter->Report( _( "Unknown netlist format.\n" ), RPT_SEVERITY_ERROR );
313 }
314
315 if( aNetJob->m_outputFile.IsEmpty() )
316 {
317 wxFileName fn = sch->GetFileName();
318 fn.SetName( fn.GetName() );
319 fn.SetExt( fileExt );
320
321 aNetJob->m_outputFile = fn.GetFullName();
322 }
323
324 bool res = helper->WriteNetlist( aNetJob->m_outputFile, netlistOption, *m_reporter );
325
326 if( !res )
327 {
329 }
330
331 return CLI::EXIT_CODES::OK;
332}
333
334
336{
337 JOB_EXPORT_SCH_BOM* aBomJob = dynamic_cast<JOB_EXPORT_SCH_BOM*>( aJob );
338
339 if( !aBomJob )
341
342 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aBomJob->m_filename, SCH_IO_MGR::SCH_KICAD );
343
344 if( sch == nullptr )
345 {
346 m_reporter->Report( _( "Failed to load schematic file\n" ), RPT_SEVERITY_ERROR );
348 }
349
350 sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
351
352 // Annotation warning check
353 SCH_REFERENCE_LIST referenceList;
354 sch->GetSheets().GetSymbols( referenceList, false, false );
355
356 if( referenceList.GetCount() > 0 )
357 {
358 SCH_REFERENCE_LIST copy = referenceList;
359
360 // Check annotation splits references...
361 if( copy.CheckAnnotation(
362 []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
363 {
364 // We're only interested in the end result -- either errors or not
365 } )
366 > 0 )
367 {
369 _( "Warning: schematic has annotation errors, please use the schematic "
370 "editor to fix them\n" ),
372 }
373 }
374
375 // Test duplicate sheet names:
376 ERC_TESTER erc( sch );
377
378 if( erc.TestDuplicateSheetNames( false ) > 0 )
379 {
380 m_reporter->Report( _( "Warning: duplicate sheet names.\n" ), RPT_SEVERITY_WARNING );
381 }
382
383 // Build our data model
384 FIELDS_EDITOR_GRID_DATA_MODEL dataModel( referenceList );
385
386 // Mandatory fields + quantity virtual field first
387 for( int i = 0; i < MANDATORY_FIELDS; ++i )
389 TEMPLATE_FIELDNAME::GetDefaultFieldName( i, true ), false );
390
391 // User field names in symbols second
392 std::set<wxString> userFieldNames;
393
394 for( size_t i = 0; i < referenceList.GetCount(); ++i )
395 {
396 SCH_SYMBOL* symbol = referenceList[i].GetSymbol();
397
398 for( int j = MANDATORY_FIELDS; j < symbol->GetFieldCount(); ++j )
399 userFieldNames.insert( symbol->GetFields()[j].GetName() );
400 }
401
402 for( const wxString& fieldName : userFieldNames )
403 dataModel.AddColumn( fieldName, GetTextVars( fieldName ), true );
404
405 // Add any templateFieldNames which aren't already present in the userFieldNames
406 for( const TEMPLATE_FIELDNAME& templateFieldname :
408 {
409 if( userFieldNames.count( templateFieldname.m_Name ) == 0 )
410 dataModel.AddColumn( templateFieldname.m_Name, GetTextVars( templateFieldname.m_Name ),
411 false );
412 }
413
414 BOM_PRESET preset;
415
416 // Load a preset if one is specified
417 if( !aBomJob->m_bomPresetName.IsEmpty() )
418 {
419 // Make sure the built-in presets are loaded
420 for( const BOM_PRESET& p : BOM_PRESET::BuiltInPresets() )
421 sch->Settings().m_BomPresets.emplace_back( p );
422
423 // Find the preset
424 BOM_PRESET* schPreset = nullptr;
425
426 for( BOM_PRESET& p : sch->Settings().m_BomPresets )
427 {
428 if( p.name == aBomJob->m_bomPresetName )
429 {
430 schPreset = &p;
431 break;
432 }
433 }
434
435 if( !schPreset )
436 {
438 wxString::Format( _( "BOM preset '%s' not found" ), aBomJob->m_bomPresetName ),
440
442 }
443
444 preset = *schPreset;
445 }
446 else
447 {
448 size_t i = 0;
449
450 for( wxString fieldName : aBomJob->m_fieldsOrdered )
451 {
452 // Handle wildcard. We allow the wildcard anywhere in the list, but it needs to respect
453 // fields that come before and after the wildcard.
454 if( fieldName == wxS( "*" ) )
455 {
456 for( const BOM_FIELD& modelField : dataModel.GetFieldsOrdered() )
457 {
458 struct BOM_FIELD field;
459
460 field.name = modelField.name;
461 field.show = true;
462 field.groupBy = false;
463 field.label = field.name;
464
465 bool fieldAlreadyPresent = false;
466 for( BOM_FIELD& presetField : preset.fieldsOrdered )
467 {
468 if( presetField.name == field.name )
469 {
470 fieldAlreadyPresent = true;
471 break;
472 }
473 }
474
475 bool fieldLaterInList = false;
476 for( const wxString& fieldInList : aBomJob->m_fieldsOrdered )
477 {
478 if( fieldInList == field.name )
479 {
480 fieldLaterInList = true;
481 break;
482 }
483 }
484
485 if( !fieldAlreadyPresent && !fieldLaterInList )
486 preset.fieldsOrdered.emplace_back( field );
487 }
488
489 continue;
490 }
491
492 struct BOM_FIELD field;
493
494 field.name = fieldName;
495 field.show = true;
496 field.groupBy = std::find( aBomJob->m_fieldsGroupBy.begin(),
497 aBomJob->m_fieldsGroupBy.end(), field.name )
498 != aBomJob->m_fieldsGroupBy.end();
499 if( ( aBomJob->m_fieldsLabels.size() > i ) && !aBomJob->m_fieldsLabels[i].IsEmpty() )
500 field.label = aBomJob->m_fieldsLabels[i];
501 else if( IsTextVar( field.name ) )
502 field.label = GetTextVars( field.name );
503 else
504 field.label = field.name;
505
506 preset.fieldsOrdered.emplace_back( field );
507 i++;
508 }
509
510 preset.sortAsc = aBomJob->m_sortAsc;
511 preset.sortField = aBomJob->m_sortField;
512 preset.filterString = aBomJob->m_filterString;
513 preset.groupSymbols = ( aBomJob->m_fieldsGroupBy.size() > 0 );
514 preset.excludeDNP = aBomJob->m_excludeDNP;
515 }
516
517 dataModel.ApplyBomPreset( preset );
518
519 if( aBomJob->m_outputFile.IsEmpty() )
520 {
521 wxFileName fn = sch->GetFileName();
522 fn.SetName( fn.GetName() );
523 fn.SetExt( CsvFileExtension );
524
525 aBomJob->m_outputFile = fn.GetFullName();
526 }
527
528 wxFile f;
529
530 if( !f.Open( aBomJob->m_outputFile, wxFile::write ) )
531 {
533 wxString::Format( _( "Unable to open destination '%s'" ), aBomJob->m_outputFile ),
535 );
536
538 }
539
540 BOM_FMT_PRESET fmt;
541
542 // Load a format preset if one is specified
543 if( !aBomJob->m_bomFmtPresetName.IsEmpty() )
544 {
545 // Make sure the built-in presets are loaded
547 sch->Settings().m_BomFmtPresets.emplace_back( p );
548
549 // Find the preset
550 BOM_FMT_PRESET* schFmtPreset = nullptr;
551
552 for( BOM_FMT_PRESET& p : sch->Settings().m_BomFmtPresets )
553 {
554 if( p.name == aBomJob->m_bomFmtPresetName )
555 {
556 schFmtPreset = &p;
557 break;
558 }
559 }
560
561 if( !schFmtPreset )
562 {
563 m_reporter->Report( wxString::Format( _( "BOM format preset '%s' not found" ),
564 aBomJob->m_bomFmtPresetName ),
566
568 }
569
570 fmt = *schFmtPreset;
571 }
572 else
573 {
574 fmt.fieldDelimiter = aBomJob->m_fieldDelimiter;
575 fmt.stringDelimiter = aBomJob->m_stringDelimiter;
576 fmt.refDelimiter = aBomJob->m_refDelimiter;
578 fmt.keepTabs = aBomJob->m_keepTabs;
579 fmt.keepLineBreaks = aBomJob->m_keepLineBreaks;
580 }
581
582 bool res = f.Write( dataModel.Export( fmt ) );
583
584 if( !res )
585 {
587 }
588
589 return CLI::EXIT_CODES::OK;
590}
591
592
594{
595 JOB_EXPORT_SCH_PYTHONBOM* aNetJob = dynamic_cast<JOB_EXPORT_SCH_PYTHONBOM*>( aJob );
596
597 if( !aNetJob )
599
600 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
601
602 if( sch == nullptr )
603 {
604 m_reporter->Report( _( "Failed to load schematic file\n" ), RPT_SEVERITY_ERROR );
606 }
607
608 // Annotation warning check
609 SCH_REFERENCE_LIST referenceList;
610 sch->GetSheets().GetSymbols( referenceList );
611
612 if( referenceList.GetCount() > 0 )
613 {
614 if( referenceList.CheckAnnotation(
615 []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
616 {
617 // We're only interested in the end result -- either errors or not
618 } )
619 > 0 )
620 {
622 _( "Warning: schematic has annotation errors, please use the schematic "
623 "editor to fix them\n" ),
625 }
626 }
627
628 // Test duplicate sheet names:
629 ERC_TESTER erc( sch );
630
631 if( erc.TestDuplicateSheetNames( false ) > 0 )
632 m_reporter->Report( _( "Warning: duplicate sheet names.\n" ), RPT_SEVERITY_WARNING );
633
634 std::unique_ptr<NETLIST_EXPORTER_XML> xmlNetlist =
635 std::make_unique<NETLIST_EXPORTER_XML>( sch );
636
637 if( aNetJob->m_outputFile.IsEmpty() )
638 {
639 wxFileName fn = sch->GetFileName();
640 fn.SetName( fn.GetName() + "-bom" );
641 fn.SetExt( XmlFileExtension );
642
643 aNetJob->m_outputFile = fn.GetFullName();
644 }
645
646 bool res = xmlNetlist->WriteNetlist( aNetJob->m_outputFile, GNL_OPT_BOM, *m_reporter );
647
648 if( !res )
650
651 return CLI::EXIT_CODES::OK;
652}
653
654
656 KIGFX::SCH_RENDER_SETTINGS* aRenderSettings,
657 LIB_SYMBOL* symbol )
658{
659 wxASSERT( symbol != nullptr );
660
661 if( symbol == nullptr )
663
664 LIB_SYMBOL* symbolToPlot = symbol;
665
666 // if the symbol is an alias, then the draw items are stored in the root symbol
667 if( symbol->IsAlias() )
668 {
669 if( LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol() )
670 {
671 symbolToPlot = parent.get();
672 }
673 else
674 {
675 wxCHECK( false, CLI::EXIT_CODES::ERR_UNKNOWN );
676 }
677 }
678
679 if( aSvgJob->m_includeHiddenPins )
680 {
681 // horrible hack, TODO overhaul the Plot method to handle this
682 for( LIB_ITEM& item : symbolToPlot->GetDrawItems() )
683 {
684 if( item.Type() != LIB_PIN_T )
685 continue;
686
687 LIB_PIN& pin = static_cast<LIB_PIN&>( item );
688 pin.SetVisible( true );
689 }
690 }
691
692 // iterate from unit 1, unit 0 would be "all units" which we don't want
693 for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ )
694 {
695 for( int convert = 1; convert < ( symbol->HasConversion() ? 2 : 1 ) + 1; ++convert )
696 {
697 wxString filename;
698 wxFileName fn;
699 size_t forbidden_char;
700
701 fn.SetPath( aSvgJob->m_outputDirectory );
702 fn.SetExt( SVGFileExtension );
703
704 filename = symbol->GetName().Lower();
705
706 while( wxString::npos
707 != ( forbidden_char = filename.find_first_of(
708 wxFileName::GetForbiddenChars( wxPATH_DOS ) ) ) )
709 {
710 filename = filename.replace( forbidden_char, 1, wxS( '_' ) );
711 }
712
713 //simplify the name if its single unit
714 if( symbol->IsMulti() )
715 {
716 filename += wxString::Format( "_%d", unit );
717
718 if( convert == 2 )
719 filename += wxS( "_demorgan" );
720
721 fn.SetName( filename );
722 m_reporter->Report( wxString::Format( _( "Plotting symbol '%s' unit %d to '%s'\n" ),
723 symbol->GetName(), unit, fn.GetFullPath() ),
725 }
726 else
727 {
728 if( convert == 2 )
729 filename += wxS( "_demorgan" );
730
731 fn.SetName( filename );
732 m_reporter->Report( wxString::Format( _( "Plotting symbol '%s' to '%s'\n" ),
733 symbol->GetName(), fn.GetFullPath() ),
735 }
736
737 // Get the symbol bounding box to fit the plot page to it
738 BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, convert, false );
739 PAGE_INFO pageInfo( PAGE_INFO::Custom );
740 pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
741 pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
742
743 SVG_PLOTTER* plotter = new SVG_PLOTTER();
744 plotter->SetRenderSettings( aRenderSettings );
745 plotter->SetPageSettings( pageInfo );
746 plotter->SetColorMode( !aSvgJob->m_blackAndWhite );
747
748 VECTOR2I plot_offset;
749 const double scale = 1.0;
750
751 // Currently, plot units are in decimal
752 plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
753
754 plotter->SetCreator( wxT( "Eeschema-SVG" ) );
755
756 if( !plotter->OpenFile( fn.GetFullPath() ) )
757 {
758 m_reporter->Report( wxString::Format( _( "Unable to open destination '%s'" ),
759 fn.GetFullPath() ),
761
762 delete plotter;
764 }
765
766 LOCALE_IO toggle;
767
768 plotter->StartPlot( wxT( "1" ) );
769
770 bool background = true;
771 TRANSFORM temp; // Uses default transform
772 VECTOR2I plotPos;
773
774 plotPos.x = pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
775 plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
776
777 // note, we want the fields from the original symbol pointer (in case of non-alias)
778 symbolToPlot->Plot( plotter, unit, convert, background, plotPos, temp, false );
779 symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false,
780 aSvgJob->m_includeHiddenFields );
781
782 symbolToPlot->Plot( plotter, unit, convert, !background, plotPos, temp, false );
783 symbol->PlotLibFields( plotter, unit, convert, !background, plotPos, temp, false,
784 aSvgJob->m_includeHiddenFields );
785
786 plotter->EndPlot();
787 delete plotter;
788 }
789 }
790
791 return CLI::EXIT_CODES::OK;
792}
793
794
796{
797 JOB_SYM_EXPORT_SVG* svgJob = dynamic_cast<JOB_SYM_EXPORT_SVG*>( aJob );
798
799 if( !svgJob )
801
802 wxFileName fn( svgJob->m_libraryPath );
803 fn.MakeAbsolute();
804
805 SCH_SEXPR_PLUGIN_CACHE schLibrary( fn.GetFullPath() );
806
807 try
808 {
809 schLibrary.Load();
810 }
811 catch( ... )
812 {
813 m_reporter->Report( _( "Unable to load library\n" ), RPT_SEVERITY_ERROR );
815 }
816
817 LIB_SYMBOL* symbol = nullptr;
818
819 if( !svgJob->m_symbol.IsEmpty() )
820 {
821 // See if the selected symbol exists
822 symbol = schLibrary.GetSymbol( svgJob->m_symbol );
823
824 if( !symbol )
825 {
826 m_reporter->Report( _( "There is no symbol selected to save." ), RPT_SEVERITY_ERROR );
828 }
829 }
830
831 if( !svgJob->m_outputDirectory.IsEmpty() && !wxDir::Exists( svgJob->m_outputDirectory ) )
832 {
833 wxFileName::Mkdir( svgJob->m_outputDirectory );
834 }
835
836 KIGFX::SCH_RENDER_SETTINGS renderSettings;
837 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( svgJob->m_colorTheme );
838 renderSettings.LoadColors( cs );
840
841 int exitCode = CLI::EXIT_CODES::OK;
842
843 if( symbol )
844 {
845 exitCode = doSymExportSvg( svgJob, &renderSettings, symbol );
846 }
847 else
848 {
849 // Just plot all the symbols we can
850 const LIB_SYMBOL_MAP& libSymMap = schLibrary.GetSymbolMap();
851
852 for( const std::pair<const wxString, LIB_SYMBOL*>& entry : libSymMap )
853 {
854 exitCode = doSymExportSvg( svgJob, &renderSettings, entry.second );
855
856 if( exitCode != CLI::EXIT_CODES::OK )
857 break;
858 }
859 }
860
861 return exitCode;
862}
863
864
866{
867 JOB_SYM_UPGRADE* upgradeJob = dynamic_cast<JOB_SYM_UPGRADE*>( aJob );
868
869 if( !upgradeJob )
871
872 wxFileName fn( upgradeJob->m_libraryPath );
873 fn.MakeAbsolute();
874
875 SCH_SEXPR_PLUGIN_CACHE schLibrary( fn.GetFullPath() );
876
877 try
878 {
879 schLibrary.Load();
880 }
881 catch( ... )
882 {
883 m_reporter->Report( _( "Unable to load library\n" ), RPT_SEVERITY_ERROR );
885 }
886
887 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
888 {
889 if( wxFile::Exists( upgradeJob->m_outputLibraryPath ) )
890 {
891 m_reporter->Report( _( "Output path must not conflict with existing path\n" ),
893
895 }
896 }
897
898 bool shouldSave = upgradeJob->m_force
900
901 if( shouldSave )
902 {
903 m_reporter->Report( _( "Saving symbol library in updated format\n" ), RPT_SEVERITY_ACTION );
904
905 try
906 {
907 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
908 {
909 schLibrary.SetFileName( upgradeJob->m_outputLibraryPath );
910 }
911
912 schLibrary.SetModified();
913 schLibrary.Save();
914 }
915 catch( ... )
916 {
917 m_reporter->Report( ( "Unable to save library\n" ), RPT_SEVERITY_ERROR );
919 }
920 }
921 else
922 {
923 m_reporter->Report( _( "Symbol library was not updated\n" ), RPT_SEVERITY_INFO );
924 }
925
926 return CLI::EXIT_CODES::OK;
927}
928
929
930
932{
933 JOB_SCH_ERC* ercJob = dynamic_cast<JOB_SCH_ERC*>( aJob );
934
935 if( !ercJob )
937
938 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( ercJob->m_filename, SCH_IO_MGR::SCH_KICAD );
939
940 if( sch == nullptr )
941 {
942 m_reporter->Report( _( "Failed to load schematic file\n" ), RPT_SEVERITY_ERROR );
944 }
945
946 sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
947
948 if( ercJob->m_outputFile.IsEmpty() )
949 {
950 wxFileName fn = sch->GetFileName();
951 fn.SetName( fn.GetName() );
952
954 fn.SetExt( JsonFileExtension );
955 else
956 fn.SetExt( ReportFileExtension );
957
958 ercJob->m_outputFile = fn.GetFullName();
959 }
960
961 EDA_UNITS units;
962
963 switch( ercJob->m_units )
964 {
966 units = EDA_UNITS::INCHES;
967 break;
969 units = EDA_UNITS::MILS;
970 break;
972 default:
973 units = EDA_UNITS::MILLIMETRES; break;
974 }
975
976 std::shared_ptr<SHEETLIST_ERC_ITEMS_PROVIDER> markersProvider =
977 std::make_shared<SHEETLIST_ERC_ITEMS_PROVIDER>( sch );
978
979 ERC_TESTER ercTester( sch );
980
981 m_reporter->Report( _( "Running ERC...\n" ), RPT_SEVERITY_INFO );
982
983 std::unique_ptr<DS_PROXY_VIEW_ITEM> drawingSheet( getDrawingSheetProxyView( sch ) );
984 ercTester.RunTests( drawingSheet.get(), nullptr, m_progressReporter );
985
986 markersProvider->SetSeverities( ercJob->m_severity );
987
989 wxString::Format( _( "Found %d violations\n" ), markersProvider->GetCount() ),
991
992 ERC_REPORT reportWriter( sch, units );
993
994 bool wroteReport = false;
995
997 wroteReport = reportWriter.WriteJsonReport( ercJob->m_outputFile );
998 else
999 wroteReport = reportWriter.WriteTextReport( ercJob->m_outputFile );
1000
1001 if( !wroteReport )
1002 {
1004 wxString::Format( _( "Unable to save ERC report to %s\n" ), ercJob->m_outputFile ),
1007 }
1008
1009 m_reporter->Report( wxString::Format( _( "Saved ERC Report to %s\n" ), ercJob->m_outputFile ),
1011
1012 if( ercJob->m_exitCodeViolations )
1013 {
1014 if( markersProvider->GetCount() > 0 )
1015 {
1017 }
1018 }
1019
1021}
1022
1023
1025{
1026 DS_PROXY_VIEW_ITEM* drawingSheet =
1028 &aSch->Prj(), &aSch->RootScreen()->GetTitleBlock(),
1029 aSch->GetProperties() );
1030
1031 drawingSheet->SetPageNumber( TO_UTF8( aSch->RootScreen()->GetPageNumber() ) );
1032 drawingSheet->SetSheetCount( aSch->RootScreen()->GetPageCount() );
1033 drawingSheet->SetFileName( TO_UTF8( aSch->RootScreen()->GetFileName() ) );
1036 drawingSheet->SetIsFirstPage( aSch->RootScreen()->GetVirtualPageNumber() == 1 );
1037
1038 drawingSheet->SetSheetName( "" );
1039 drawingSheet->SetSheetPath( "" );
1040
1041 return drawingSheet;
1042}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
int GetPageCount() const
Definition: base_screen.h:72
int GetVirtualPageNumber() const
Definition: base_screen.h:75
const wxString & GetPageNumber() const
Definition: base_screen.cpp:71
coord_type GetHeight() const
Definition: box2.h:189
coord_type GetWidth() const
Definition: box2.h:188
Color settings are a bit different than most of the settings objects in that there can be more than o...
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 SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
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.
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
static SCHEMATIC * LoadSchematic(wxString &aFileName)
void InitRenderSettings(KIGFX::SCH_RENDER_SETTINGS *aRenderSettings, const wxString &aTheme, SCHEMATIC *aSch, const wxString &aDrawingSheetOverride=wxEmptyString)
Configure the SCH_RENDER_SETTINGS object with the correct data to be used with plotting.
DS_PROXY_VIEW_ITEM * getDrawingSheetProxyView(SCHEMATIC *aSch)
int doSymExportSvg(JOB_SYM_EXPORT_SVG *aSvgJob, KIGFX::SCH_RENDER_SETTINGS *aRenderSettings, LIB_SYMBOL *symbol)
bool WriteJsonReport(const wxString &aFullFileName)
Definition: erc_report.cpp:107
bool WriteTextReport(const wxString &aFullFileName)
Definition: erc_report.cpp:44
Definition: erc.h:46
void RunTests(DS_PROXY_VIEW_ITEM *aDrawingSheet, SCH_EDIT_FRAME *aEditFrame, PROGRESS_REPORTER *aProgressReporter)
Definition: erc.cpp:1131
void ApplyBomPreset(const BOM_PRESET &preset)
wxString Export(const BOM_FMT_PRESET &settings)
void AddColumn(const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser)
const std::vector< BOM_FIELD > GetFieldsOrdered()
PROGRESS_REPORTER * m_progressReporter
void Register(const std::string &aJobTypeName, std::function< int(JOB *job)> aHandler)
REPORTER * m_reporter
std::vector< wxString > m_fieldsLabels
std::vector< wxString > m_fieldsOrdered
std::vector< wxString > m_fieldsGroupBy
JOB_PAGE_SIZE m_pageSizeSelect
SCH_PLOT_FORMAT m_plotFormat
JOB_HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
std::vector< wxString > m_plotPages
JOB_HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
wxString m_filename
Definition: job_sch_erc.h:35
int m_severity
Definition: job_sch_erc.h:47
OUTPUT_FORMAT m_format
Definition: job_sch_erc.h:55
UNITS m_units
Definition: job_sch_erc.h:45
bool m_exitCodeViolations
Definition: job_sch_erc.h:57
wxString m_outputFile
Definition: job_sch_erc.h:36
wxString m_outputLibraryPath
wxString m_libraryPath
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:32
const std::map< wxString, wxString > & GetVarOverrides() const
Definition: job.h:41
void SetDefaultPenWidth(int aWidth)
void SetGapLengthRatio(double aRatio)
void SetDashLengthRatio(double aRatio)
Store schematic specific render settings.
Definition: sch_painter.h:71
void LoadColors(const COLOR_SETTINGS *aSettings) override
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
Define a library symbol object.
Definition: lib_symbol.h:99
void Plot(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
Definition: lib_symbol.cpp:865
bool IsMulti() const
Definition: lib_symbol.h:599
bool IsAlias() const
Definition: lib_symbol.h:215
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:544
wxString GetName() const override
Definition: lib_symbol.h:160
void PlotLibFields(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed, bool aPlotHidden=true)
Plot Lib Fields only of the symbol to plotter.
Definition: lib_symbol.cpp:906
int GetUnitCount() const override
For items with units, return the number of units.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:605
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
Definition: lib_symbol.cpp:527
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:49
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:58
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition: page_info.h:161
static const wxChar Custom[]
"User" defined page type
Definition: page_info.h:81
void SetHeightMils(double aHeightInMils)
Definition: page_info.cpp:261
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition: page_info.h:152
void SetWidthMils(double aWidthInMils)
Definition: page_info.cpp:247
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:74
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:137
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:134
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:153
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:131
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:143
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 REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxString m_SchDrawingSheetFileName
std::vector< BOM_PRESET > m_BomPresets
std::vector< BOM_FMT_PRESET > m_BomFmtPresets
Holds all the data relating to one schematic.
Definition: schematic.h:75
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:281
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:287
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:197
const std::map< wxString, wxString > * GetProperties()
Definition: schematic.h:93
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:90
virtual LIB_SYMBOL * GetSymbol(const wxString &aName)
const LIB_SYMBOL_MAP & GetSymbolMap() const
void SetFileName(const wxString &aFileName)
void SetModified(bool aModified=true)
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
size_t GetCount() const
int CheckAnnotation(ANNOTATION_ERROR_HANDLER aErrorHandler)
Check for annotations errors.
A helper to define a symbol's reference designator in a schematic.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:131
const wxString & GetFileName() const
Definition: sch_screen.h:144
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:155
A cache assistant for the KiCad s-expression symbol libraries.
void Save(const std::optional< bool > &aOpt=std::nullopt) override
Save the entire library to file m_libFileName;.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Schematic symbol object.
Definition: sch_symbol.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:476
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:988
virtual bool StartPlot(const wxString &aPageNumber) override
Create SVG file header.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
bool IsTextVar(const wxString &aSource)
Returns true if the string is a text var, e.g starts with ${.
Definition: common.cpp:127
wxString GetTextVars(const wxString &aSource)
Returns any variables unexpanded, e.g.
Definition: common.cpp:115
The common library.
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _(s)
EDA_UNITS
Definition: eda_units.h:46
ERCE_T
ERC error codes.
Definition: erc_settings.h:37
const std::string SpiceFileExtension
const std::string CadstarNetlistFileExtension
const std::string SVGFileExtension
const std::string CsvFileExtension
const std::string NetlistFileExtension
const std::string OrCadPcb2NetlistFileExtension
const std::string XmlFileExtension
const std::string JsonFileExtension
const std::string ReportFileExtension
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:388
@ LAYER_SCHEMATIC_PAGE_LIMITS
Definition: layer_ids.h:389
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:45
static const int ERR_ARGS
Definition: exit_codes.h:31
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
@ GNL_OPT_BOM
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_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
#define SEXPR_SYMBOL_LIB_FILE_VERSION
This file contains the file format version information for the s-expression schematic and symbol libr...
HPGL_PAGE_SIZE
Definition: sch_plotter.h:63
HPGL_PLOT_ORIGIN_AND_UNITS
Definition: sch_plotter.h:46
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:119
const int scale
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
wxString label
Definition: bom_settings.h:33
bool groupBy
Definition: bom_settings.h:35
wxString name
Definition: bom_settings.h:32
wxString fieldDelimiter
Definition: bom_settings.h:81
static std::vector< BOM_FMT_PRESET > BuiltInPresets()
wxString stringDelimiter
Definition: bom_settings.h:82
wxString refRangeDelimiter
Definition: bom_settings.h:84
wxString refDelimiter
Definition: bom_settings.h:83
wxString sortField
Definition: bom_settings.h:54
bool groupSymbols
Definition: bom_settings.h:57
std::vector< BOM_FIELD > fieldsOrdered
Definition: bom_settings.h:53
static std::vector< BOM_PRESET > BuiltInPresets()
bool excludeDNP
Definition: bom_settings.h:58
bool sortAsc
Definition: bom_settings.h:55
wxString filterString
Definition: bom_settings.h:56
constexpr int IUToMils(int iu) const
Definition: base_units.h:100
const double IU_PER_MILS
Definition: base_units.h:78
bool m_PDFPropertyPopups
Definition: sch_plotter.h:90
double m_HPGLPenSize
Definition: sch_plotter.h:88
wxString m_theme
Definition: sch_plotter.h:91
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
Definition: sch_plotter.h:89
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
Definition: sch_plotter.h:96
bool m_useBackgroundColor
Definition: sch_plotter.h:87
std::vector< wxString > m_plotPages
Definition: sch_plotter.h:83
wxString m_outputDirectory
Definition: sch_plotter.h:93
wxString m_outputFile
Definition: sch_plotter.h:94
Hold a name of a symbol's field, field value, and default visibility.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
VECTOR3I res
@ LIB_PIN_T
Definition: typeinfo.h:202
Definition of file extensions used in Kicad.