97 wxFprintf( stderr,
_(
"Error loading drawing sheet." ) );
104 wxFprintf( stderr, aText );
123 wxFprintf( stderr,
_(
"Failed to load schematic file\n" ) );
127 std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
128 std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
131 std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
159 wxFprintf( stderr,
_(
"Failed to load schematic file\n" ) );
163 std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
164 std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
167 std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
195 wxFprintf( stderr,
_(
"Failed to load schematic file\n" ) );
206 wxPrintf(
_(
"Warning: schematic has annotation errors, please use the schematic editor to fix them\n" ) );
213 if(
erc.TestDuplicateSheetNames(
false ) > 0 )
215 wxPrintf(
_(
"Warning: duplicate sheet names.\n" ) );
219 std::unique_ptr<NETLIST_EXPORTER_BASE> helper;
220 unsigned netlistOption = 0;
228 helper = std::make_unique<NETLIST_EXPORTER_KICAD>( sch );
233 helper = std::make_unique<NETLIST_EXPORTER_ORCADPCB2>( sch );
238 helper = std::make_unique<NETLIST_EXPORTER_CADSTAR>( sch );
244 helper = std::make_unique<NETLIST_EXPORTER_SPICE>( sch );
249 helper = std::make_unique<NETLIST_EXPORTER_SPICE_MODEL>( sch );
253 fileExt = wxS(
"xml" );
254 helper = std::make_unique<NETLIST_EXPORTER_XML>( sch );
257 wxFprintf( stderr,
_(
"Unknown netlist format.\n" ) );
265 fn.SetName( fn.GetName() );
266 fn.SetExt( fileExt );
271 bool res = helper->WriteNetlist( aNetJob->
m_outputFile, netlistOption, *
this );
290 wxFprintf( stderr,
_(
"Failed to load schematic file\n" ) );
305 wxPrintf(
_(
"Warning: schematic has annotation errors, please use the schematic "
306 "editor to fix them\n" ) );
313 if(
erc.TestDuplicateSheetNames(
false ) > 0 )
315 wxPrintf(
_(
"Warning: duplicate sheet names.\n" ) );
318 std::unique_ptr<NETLIST_EXPORTER_XML> xmlNetlist =
319 std::make_unique<NETLIST_EXPORTER_XML>( sch );
324 fn.SetName( fn.GetName() +
"-bom" );
345 wxASSERT( symbol !=
nullptr );
347 if( symbol ==
nullptr )
356 symbolToPlot = parent.get();
368 pin.SetVisible(
true );
373 for(
int unit = 1; unit < symbol->
GetUnitCount() + 1; unit++ )
386 wxPrintf(
_(
"Plotting symbol '%s' unit %d to '%s'\n" ), symbol->
GetName(), unit,
391 fn.SetName( symbol->
GetName().Lower() );
392 wxPrintf(
_(
"Plotting symbol '%s' to '%s'\n" ), symbol->
GetName(), fn.GetFullPath() );
407 const double scale = 1.0;
414 if( !plotter->
OpenFile( fn.GetFullPath() ) )
416 wxFprintf( stderr,
_(
"Unable to open destination '%s'" ), fn.GetFullPath() );
426 bool background =
true;
434 symbolToPlot->
Plot( plotter, unit,
convert, background, plotPos, temp,
false );
437 symbolToPlot->
Plot( plotter, unit,
convert, !background, plotPos, temp,
false );
463 wxFprintf( stderr,
_(
"Unable to load library\n" ) );
474 wxFprintf( stderr,
_(
"There is no symbol selected to save." ) );
499 for(
const std::pair<const wxString, LIB_SYMBOL*>& entry : libSymMap )
501 exitCode =
doSymExportSvg( svgJob, &renderSettings, entry.second );
526 wxFprintf( stderr,
_(
"Unable to load library\n" ) );
534 wxFprintf( stderr,
_(
"Output path must not conflict with existing path\n" ) );
539 bool shouldSave = upgradeJob->
m_force
544 wxPrintf(
_(
"Saving symbol library in updated format\n" ) );
558 wxFprintf( stderr,
_(
"Unable to save library\n" ) );
564 wxPrintf(
_(
"Symbol library was not updated\n" ) );
constexpr EDA_IU_SCALE schIUScale
coord_type GetHeight() const
coord_type GetWidth() const
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)
int JobExportNetlist(JOB *aJob)
int JobSymUpgrade(JOB *aJob)
int JobSymExportSvg(JOB *aJob)
int JobExportSvg(JOB *aJob)
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
int JobExportPythonBom(JOB *aJob)
int doSymExportSvg(JOB_SYM_EXPORT_SVG *aSvgJob, KIGFX::SCH_RENDER_SETTINGS *aRenderSettings, LIB_SYMBOL *symbol)
int JobExportPdf(JOB *aJob)
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.
void Register(const std::string &aJobTypeName, std::function< int(JOB *job)> aHandler)
bool m_useBackgroundColor
wxString m_outputDirectory
bool m_useBackgroundColor
wxString m_outputDirectory
bool m_includeHiddenFields
wxString m_outputLibraryPath
An simple container class that lets us dispatch output jobs to kifaces.
void SetDefaultPenWidth(int aWidth)
void SetGapLengthRatio(double aRatio)
void SetDashLengthRatio(double aRatio)
Store schematic specific render settings.
void LoadColors(const COLOR_SETTINGS *aSettings) override
The base class for drawable items used by schematic library symbols.
Define a library symbol object.
void Plot(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
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.
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.
LIB_SYMBOL_REF & GetParent()
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetWidthMils(int aWidthInMils)
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
static const wxChar Custom[]
"User" defined page type
void SetHeightMils(int aHeightInMils)
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void SetRenderSettings(RENDER_SETTINGS *aSettings)
virtual void SetCreator(const wxString &aCreator)
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
virtual const wxString GetProjectPath() const
Return the full path of the project.
A pure virtual class used to derive REPORTER objects from.
wxString m_SchDrawingSheetFileName
double m_DashedLineGapRatio
double m_DashedLineDashRatio
Holds all the data relating to one schematic.
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
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 ...
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.
int GetFileFormatVersionAtLoad() const
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
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
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
static const int ERR_ARGS
static const int ERR_INVALID_INPUT_FILE
static const int ERR_INVALID_OUTPUT_CONFLICT
static const int ERR_UNKNOWN
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.
#define SEXPR_SYMBOL_LIB_FILE_VERSION
This file contains the file format version information for the s-expression schematic and symbol libr...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
constexpr int IUToMils(int iu) const
bool m_useBackgroundColor
wxString m_outputDirectory
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP
Definition of file extensions used in Kicad.