KiCad PCB EDA Suite
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-2022 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 <cli/exit_codes.h>
29#include <pgm_base.h>
30#include <sch_plotter.h>
31#include <schematic.h>
32#include <wx/crt.h>
33#include <wx/dir.h>
34#include <wx/file.h>
35#include <memory>
36#include <connection_graph.h>
37#include "eeschema_helpers.h"
38#include <sch_painter.h>
39#include <locale_io.h>
40#include <erc.h>
44
46
47#include <sch_file_versions.h>
49
50#include <netlist.h>
58
59
61{
62 Register( "pythonbom",
63 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPythonBom, this, std::placeholders::_1 ) );
64 Register( "netlist",
65 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportNetlist, this, std::placeholders::_1 ) );
66 Register( "pdf",
67 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPdf, this, std::placeholders::_1 ) );
68 Register( "svg",
69 std::bind( &EESCHEMA_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ) );
70 Register( "symupgrade",
71 std::bind( &EESCHEMA_JOBS_HANDLER::JobSymUpgrade, this, std::placeholders::_1 ) );
72 Register( "symsvg",
73 std::bind( &EESCHEMA_JOBS_HANDLER::JobSymExportSvg, this, std::placeholders::_1 ) );
74}
75
76
78 const wxString& aTheme, SCHEMATIC* aSch )
79{
80 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( aTheme );
81 aRenderSettings->LoadColors( cs );
82
83 aRenderSettings->SetDefaultPenWidth( aSch->Settings().m_DefaultLineWidth );
84 aRenderSettings->m_LabelSizeRatio = aSch->Settings().m_LabelSizeRatio;
85 aRenderSettings->m_TextOffsetRatio = aSch->Settings().m_TextOffsetRatio;
86 aRenderSettings->m_PinSymbolSize = aSch->Settings().m_PinSymbolSize;
87
88 aRenderSettings->SetDashLengthRatio( aSch->Settings().m_DashedLineDashRatio );
89 aRenderSettings->SetGapLengthRatio( aSch->Settings().m_DashedLineGapRatio );
90
91 // Load the drawing sheet from the filename stored in BASE_SCREEN::m_DrawingSheetFileName.
92 // If empty, or not existing, the default drawing sheet is loaded.
94 aSch->Prj().GetProjectPath() );
95
96 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
97 wxFprintf( stderr, _( "Error loading drawing sheet." ) );
98}
99
100
101REPORTER& EESCHEMA_JOBS_HANDLER::Report( const wxString& aText, SEVERITY aSeverity )
102{
103 if( aSeverity == RPT_SEVERITY_ERROR )
104 wxFprintf( stderr, aText );
105 else
106 wxPrintf( aText );
107
108 return *this;
109}
110
111
113{
114 JOB_EXPORT_SCH_PDF* aPdfJob = dynamic_cast<JOB_EXPORT_SCH_PDF*>( aJob );
115
116 if( !aPdfJob )
118
119 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPdfJob->m_filename, SCH_IO_MGR::SCH_KICAD );
120
121 if( sch == nullptr )
122 {
123 wxFprintf( stderr, _( "Failed to load schematic file\n" ) );
125 }
126
127 std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
128 std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
129 InitRenderSettings( renderSettings.get(), aPdfJob->m_colorTheme, sch );
130
131 std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
132
133 SCH_PLOT_SETTINGS settings;
134 settings.m_plotAll = true;
135 settings.m_plotDrawingSheet = aPdfJob->m_plotDrawingSheet;
136 settings.m_blackAndWhite = aPdfJob->m_blackAndWhite;
137 settings.m_theme = aPdfJob->m_colorTheme;
138 settings.m_useBackgroundColor = aPdfJob->m_useBackgroundColor;
140 settings.m_outputFile = aPdfJob->m_outputFile;
141
142 schPlotter->Plot( PLOT_FORMAT::PDF, settings, renderSettings.get(), this );
143
144 return CLI::EXIT_CODES::OK;
145}
146
147
149{
150 JOB_EXPORT_SCH_SVG* aSvgJob = dynamic_cast<JOB_EXPORT_SCH_SVG*>( aJob );
151
152 if( !aSvgJob )
154
155 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aSvgJob->m_filename, SCH_IO_MGR::SCH_KICAD );
156
157 if( sch == nullptr )
158 {
159 wxFprintf( stderr, _( "Failed to load schematic file\n" ) );
161 }
162
163 std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
164 std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
165 InitRenderSettings( renderSettings.get(), aSvgJob->m_colorTheme, sch );
166
167 std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
168
169 SCH_PLOT_SETTINGS settings;
170 settings.m_plotAll = true;
171 settings.m_plotDrawingSheet = true;
172 settings.m_blackAndWhite = aSvgJob->m_blackAndWhite;
173 settings.m_theme = aSvgJob->m_colorTheme;
175 settings.m_outputDirectory = aSvgJob->m_outputDirectory;
176 settings.m_useBackgroundColor = aSvgJob->m_useBackgroundColor;
177
178 schPlotter->Plot( PLOT_FORMAT::SVG, settings, renderSettings.get(), this );
179
180 return CLI::EXIT_CODES::OK;
181}
182
183
185{
186 JOB_EXPORT_SCH_NETLIST* aNetJob = dynamic_cast<JOB_EXPORT_SCH_NETLIST*>( aJob );
187
188 if( !aNetJob )
190
191 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
192
193 if( sch == nullptr )
194 {
195 wxFprintf( stderr, _( "Failed to load schematic file\n" ) );
197 }
198
199 // Annotation warning check
200 SCH_REFERENCE_LIST referenceList;
201 sch->GetSheets().GetSymbols( referenceList );
202 if( referenceList.GetCount() > 0 )
203 {
204 if( referenceList.CheckAnnotation( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* ) {} ) > 0 )
205 {
206 wxPrintf( _( "Warning: schematic has annotation errors, please use the schematic editor to fix them\n" ) );
207 }
208 }
209
210 // Test duplicate sheet names:
211 ERC_TESTER erc( sch );
212
213 if( erc.TestDuplicateSheetNames( false ) > 0 )
214 {
215 wxPrintf( _( "Warning: duplicate sheet names.\n" ) );
216 }
217
218
219 std::unique_ptr<NETLIST_EXPORTER_BASE> helper;
220 unsigned netlistOption = 0;
221
222 wxString fileExt;
223
224 switch( aNetJob->format )
225 {
227 fileExt = NetlistFileExtension;
228 helper = std::make_unique<NETLIST_EXPORTER_KICAD>( sch );
229 break;
230
233 helper = std::make_unique<NETLIST_EXPORTER_ORCADPCB2>( sch );
234 break;
235
238 helper = std::make_unique<NETLIST_EXPORTER_CADSTAR>( sch );
239 break;
240
242 fileExt = SpiceFileExtension;
244 helper = std::make_unique<NETLIST_EXPORTER_SPICE>( sch );
245 break;
246
248 fileExt = SpiceFileExtension;
249 helper = std::make_unique<NETLIST_EXPORTER_SPICE_MODEL>( sch );
250 break;
251
253 fileExt = wxS( "xml" );
254 helper = std::make_unique<NETLIST_EXPORTER_XML>( sch );
255 break;
256 default:
257 wxFprintf( stderr, _( "Unknown netlist format.\n" ) );
259 }
260
261
262 if( aNetJob->m_outputFile.IsEmpty() )
263 {
264 wxFileName fn = sch->GetFileName();
265 fn.SetName( fn.GetName() );
266 fn.SetExt( fileExt );
267
268 aNetJob->m_outputFile = fn.GetFullName();
269 }
270
271 bool res = helper->WriteNetlist( aNetJob->m_outputFile, netlistOption, *this );
272
273 if(!res)
274 {
276 }
277
278 return CLI::EXIT_CODES::OK;
279}
280
281
283{
284 JOB_EXPORT_SCH_PYTHONBOM* aNetJob = dynamic_cast<JOB_EXPORT_SCH_PYTHONBOM*>( aJob );
285
286 SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
287
288 if( sch == nullptr )
289 {
290 wxFprintf( stderr, _( "Failed to load schematic file\n" ) );
292 }
293
294 // Annotation warning check
295 SCH_REFERENCE_LIST referenceList;
296 sch->GetSheets().GetSymbols( referenceList );
297 if( referenceList.GetCount() > 0 )
298 {
299 if( referenceList.CheckAnnotation(
300 []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
301 {
302 } )
303 > 0 )
304 {
305 wxPrintf( _( "Warning: schematic has annotation errors, please use the schematic "
306 "editor to fix them\n" ) );
307 }
308 }
309
310 // Test duplicate sheet names:
311 ERC_TESTER erc( sch );
312
313 if( erc.TestDuplicateSheetNames( false ) > 0 )
314 {
315 wxPrintf( _( "Warning: duplicate sheet names.\n" ) );
316 }
317
318 std::unique_ptr<NETLIST_EXPORTER_XML> xmlNetlist =
319 std::make_unique<NETLIST_EXPORTER_XML>( sch );
320
321 if( aNetJob->m_outputFile.IsEmpty() )
322 {
323 wxFileName fn = sch->GetFileName();
324 fn.SetName( fn.GetName() + "-bom" );
325 fn.SetExt( XmlFileExtension );
326
327 aNetJob->m_outputFile = fn.GetFullName();
328 }
329
330 bool res = xmlNetlist->WriteNetlist( aNetJob->m_outputFile, GNL_OPT_BOM, *this );
331
332 if( !res )
333 {
335 }
336
337 return CLI::EXIT_CODES::OK;
338}
339
340
342 KIGFX::SCH_RENDER_SETTINGS* aRenderSettings,
343 LIB_SYMBOL* symbol )
344{
345 wxASSERT( symbol != nullptr );
346
347 if( symbol == nullptr )
349
350 LIB_SYMBOL* symbolToPlot = symbol;
351
352 // if the symbol is an alias, then the draw items are stored in the parent
353 if( symbol->IsAlias() )
354 {
355 LIB_SYMBOL_SPTR parent = symbol->GetParent().lock();
356 symbolToPlot = parent.get();
357 }
358
359 if( aSvgJob->m_includeHiddenPins )
360 {
361 // horrible hack, TODO overhaul the Plot method to handle this
362 for( LIB_ITEM& item : symbolToPlot->GetDrawItems() )
363 {
364 if( item.Type() != LIB_PIN_T )
365 continue;
366
367 LIB_PIN& pin = static_cast<LIB_PIN&>( item );
368 pin.SetVisible( true );
369 }
370 }
371
372 // iterate from unit 1, unit 0 would be "all units" which we don't want
373 for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ )
374 {
375 int convert = 0;
376
377 wxFileName fn;
378
379 fn.SetPath( aSvgJob->m_outputDirectory );
380 fn.SetExt( SVGFileExtension );
381
382 //simplify the name if its single unit
383 if( symbol->IsMulti() )
384 {
385 fn.SetName( wxString::Format( "%s_%d", symbol->GetName().Lower(), unit ) );
386 wxPrintf( _( "Plotting symbol '%s' unit %d to '%s'\n" ), symbol->GetName(), unit,
387 fn.GetFullPath() );
388 }
389 else
390 {
391 fn.SetName( symbol->GetName().Lower() );
392 wxPrintf( _( "Plotting symbol '%s' to '%s'\n" ), symbol->GetName(), fn.GetFullPath() );
393 }
394
395 // Get the symbol bounding box to fit the plot page to it
396 BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, convert, false );
397 PAGE_INFO pageInfo( PAGE_INFO::Custom );
398 pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
399 pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
400
401 SVG_PLOTTER* plotter = new SVG_PLOTTER();
402 plotter->SetRenderSettings( aRenderSettings );
403 plotter->SetPageSettings( pageInfo );
404 plotter->SetColorMode( !aSvgJob->m_blackAndWhite );
405
406 wxPoint plot_offset;
407 const double scale = 1.0;
408
409 // Currently, plot units are in decimil
410 plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
411
412 plotter->SetCreator( wxT( "Eeschema-SVG" ) );
413
414 if( !plotter->OpenFile( fn.GetFullPath() ) )
415 {
416 wxFprintf( stderr, _( "Unable to open destination '%s'" ), fn.GetFullPath() );
417
418 delete plotter;
420 }
421
422 LOCALE_IO toggle;
423
424 plotter->StartPlot( wxT( "1" ) );
425
426 bool background = true;
427 TRANSFORM temp; // Uses default transform
428 VECTOR2I plotPos;
429
430 plotPos.x = pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
431 plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
432
433 // note, we want to use the fields from the original symbol pointer (in case of non-alias)
434 symbolToPlot->Plot( plotter, unit, convert, background, plotPos, temp, false );
435 symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false, aSvgJob->m_includeHiddenFields );
436
437 symbolToPlot->Plot( plotter, unit, convert, !background, plotPos, temp, false );
438 symbol->PlotLibFields( plotter, unit, convert, !background, plotPos, temp, false, aSvgJob->m_includeHiddenFields );
439
440 plotter->EndPlot();
441 delete plotter;
442 }
443
444 return CLI::EXIT_CODES::OK;
445}
446
447
449{
450 JOB_SYM_EXPORT_SVG* svgJob = dynamic_cast<JOB_SYM_EXPORT_SVG*>( aJob );
451
452 wxFileName fn( svgJob->m_libraryPath );
453 fn.MakeAbsolute();
454
455 SCH_SEXPR_PLUGIN_CACHE schLibrary( fn.GetFullPath() );
456
457 try
458 {
459 schLibrary.Load();
460 }
461 catch( ... )
462 {
463 wxFprintf( stderr, _( "Unable to load library\n" ) );
465 }
466
467 LIB_SYMBOL* symbol = nullptr;
468 if( !svgJob->m_symbol.IsEmpty() )
469 {
470 // See if the selected symbol exists
471 symbol = schLibrary.GetSymbol( svgJob->m_symbol );
472 if( !symbol )
473 {
474 wxFprintf( stderr, _( "There is no symbol selected to save." ) );
476 }
477 }
478
479 if( !svgJob->m_outputDirectory.IsEmpty() && !wxDir::Exists( svgJob->m_outputDirectory ) )
480 {
481 wxFileName::Mkdir( svgJob->m_outputDirectory );
482 }
483
484 KIGFX::SCH_RENDER_SETTINGS renderSettings;
485 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( svgJob->m_colorTheme );
486 renderSettings.LoadColors( cs );
488
489 int exitCode = CLI::EXIT_CODES::OK;
490 if( symbol )
491 {
492 exitCode = doSymExportSvg( svgJob, &renderSettings, symbol );
493 }
494 else
495 {
496 // Just plot all the symbols we can
497 const LIB_SYMBOL_MAP& libSymMap = schLibrary.GetSymbolMap();
498
499 for( const std::pair<const wxString, LIB_SYMBOL*>& entry : libSymMap )
500 {
501 exitCode = doSymExportSvg( svgJob, &renderSettings, entry.second );
502 if( exitCode != CLI::EXIT_CODES::OK )
503 break;
504 }
505 }
506
507 return exitCode;
508}
509
510
512{
513 JOB_SYM_UPGRADE* upgradeJob = dynamic_cast<JOB_SYM_UPGRADE*>( aJob );
514
515 wxFileName fn( upgradeJob->m_libraryPath );
516 fn.MakeAbsolute();
517
518 SCH_SEXPR_PLUGIN_CACHE schLibrary( fn.GetFullPath() );
519
520 try
521 {
522 schLibrary.Load();
523 }
524 catch( ... )
525 {
526 wxFprintf( stderr, _( "Unable to load library\n" ) );
528 }
529
530 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
531 {
532 if( wxFile::Exists( upgradeJob->m_outputLibraryPath ) )
533 {
534 wxFprintf( stderr, _( "Output path must not conflict with existing path\n" ) );
536 }
537 }
538
539 bool shouldSave = upgradeJob->m_force
541
542 if( shouldSave )
543 {
544 wxPrintf( _( "Saving symbol library in updated format\n" ) );
545
546 try
547 {
548 if( !upgradeJob->m_outputLibraryPath.IsEmpty() )
549 {
550 schLibrary.SetFileName( upgradeJob->m_outputLibraryPath );
551 }
552
553 schLibrary.SetModified();
554 schLibrary.Save();
555 }
556 catch( ... )
557 {
558 wxFprintf( stderr, _( "Unable to save library\n" ) );
560 }
561 }
562 else
563 {
564 wxPrintf( _( "Symbol library was not updated\n" ) );
565 }
566
567 return CLI::EXIT_CODES::OK;
568}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
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.
static SCHEMATIC * LoadSchematic(wxString &aFileName)
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
int doSymExportSvg(JOB_SYM_EXPORT_SVG *aSvgJob, KIGFX::SCH_RENDER_SETTINGS *aRenderSettings, LIB_SYMBOL *symbol)
void InitRenderSettings(KIGFX::SCH_RENDER_SETTINGS *aRenderSettings, const wxString &aTheme, SCHEMATIC *aSch)
Configures the SCH_RENDER_SETTINGS object with the correct data to be used with plotting.
Definition: erc.h:48
void Register(const std::string &aJobTypeName, std::function< int(JOB *job)> aHandler)
wxString m_outputLibraryPath
wxString m_libraryPath
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:28
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:61
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:705
bool IsMulti() const
Definition: lib_symbol.h:557
bool IsAlias() const
Definition: lib_symbol.h:188
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:508
wxString GetName() const override
Definition: lib_symbol.h:138
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:745
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:456
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:127
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
void SetWidthMils(int aWidthInMils)
Definition: page_info.cpp:244
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition: page_info.h:153
static const wxChar Custom[]
"User" defined page type
Definition: page_info.h:77
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:258
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition: page_info.h:144
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:143
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:140
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:159
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:137
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:126
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
wxString m_SchDrawingSheetFileName
Holds all the data relating to one schematic.
Definition: schematic.h:61
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:172
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:178
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
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.
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.
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
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _(s)
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 NetlistFileExtension
const std::string OrCadPcb2NetlistFileExtension
const std::string XmlFileExtension
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_INVALID_INPUT_FILE
Definition: exit_codes.h:33
static const int ERR_INVALID_OUTPUT_CONFLICT
Definition: exit_codes.h:34
static const int ERR_UNKNOWN
Definition: exit_codes.h:32
@ GNL_OPT_BOM
see class PGM_BASE
Plotting engines similar to ps (PostScript, Gerber, svg)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
SEVERITY
@ RPT_SEVERITY_ERROR
#define SEXPR_SYMBOL_LIB_FILE_VERSION
This file contains the file format version information for the s-expression schematic and symbol libr...
@ PAGE_SIZE_AUTO
Definition: sch_plotter.h:56
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
const int scale
constexpr int IUToMils(int iu) const
Definition: base_units.h:100
const double IU_PER_MILS
Definition: base_units.h:78
wxString m_theme
Definition: sch_plotter.h:88
bool m_useBackgroundColor
Definition: sch_plotter.h:85
wxString m_outputDirectory
Definition: sch_plotter.h:90
wxString m_outputFile
Definition: sch_plotter.h:91
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP
VECTOR3I res
@ LIB_PIN_T
Definition: typeinfo.h:202
Definition of file extensions used in Kicad.