KiCad PCB EDA Suite
|
GERBER_JOBFILE_WRITER is a class used to create Gerber job file a Gerber job file stores info to make a board: list of gerber files info about the board itsel: size, number of copper layers thickness of the board, copper and dielectric and some other info (colors, finish type ...) More...
#include <gerber_jobfile_writer.h>
Public Member Functions | |
GERBER_JOBFILE_WRITER (BOARD *aPcb, REPORTER *aReporter=nullptr) | |
virtual | ~GERBER_JOBFILE_WRITER () |
void | AddGbrFile (PCB_LAYER_ID aLayer, wxString &aFilename) |
add a gerber file name and type in job file list | |
bool | CreateJobFile (const wxString &aFullFilename) |
Creates a Gerber job file. | |
bool | WriteJSONJobFile (const wxString &aFullFilename) |
Creates an Gerber job file in JSON format. | |
Private Member Functions | |
enum ONSIDE | hasSilkLayers () |
enum ONSIDE | hasSolderMasks () |
const char * | sideKeyValue (enum ONSIDE aValue) |
void | addJSONHeader () |
Add the job file header in JSON format to m_JSONbuffer. | |
void | addJSONGeneralSpecs () |
Add the General Specs in JSON format to m_JSONbuffer. | |
void | addJSONFilesAttributes () |
Add the Files Attributes section in JSON format to m_JSONbuffer. | |
void | addJSONMaterialStackup () |
Add the Material Stackup section in JSON format to m_JSONbuffer This is the ordered list of stackup layers (mask, paste, silk, copper, dielectric) used to make the physical board. | |
void | addJSONDesignRules () |
Add the Design Rules section in JSON format to m_JSONbuffer. | |
std::string | formatStringFromUTF32 (const wxString &aText) |
A helper function to convert a wxString ( therefore a Unicode text ) to a JSON compatible string (a escaped unicode sequence of 4 hexa). | |
double | mapValue (double aUiValue) |
A helper function to convert a double in Pcbnew internal units to a JSON double value (in mm), with only 4 digits in mantissa for a better readability when printed using g or equivalent format. | |
Private Attributes | |
BOARD * | m_pcb |
REPORTER * | m_reporter |
JOBFILE_PARAMS | m_params |
double | m_conversionUnits |
nlohmann::ordered_json | m_json |
GERBER_JOBFILE_WRITER is a class used to create Gerber job file a Gerber job file stores info to make a board: list of gerber files info about the board itsel: size, number of copper layers thickness of the board, copper and dielectric and some other info (colors, finish type ...)
note: dimensions are always in mm in Kicad job file (can be also in inches in a job file) and they are in floating point notation
Definition at line 71 of file gerber_jobfile_writer.h.
Definition at line 54 of file gerber_jobfile_writer.cpp.
References EDA_IU_SCALE::IU_PER_MM, m_conversionUnits, m_pcb, m_reporter, and pcbIUScale.
|
inlinevirtual |
Definition at line 76 of file gerber_jobfile_writer.h.
|
inline |
add a gerber file name and type in job file list
aLayer | is the PCB_LAYER_ID corresponding to the gerber file |
aFilename | is the filename (without path) of the gerber file |
Definition at line 85 of file gerber_jobfile_writer.h.
References JOBFILE_PARAMS::m_GerberFileList, JOBFILE_PARAMS::m_LayerId, and m_params.
Referenced by PCBNEW_JOBS_HANDLER::JobExportGerbers(), and DIALOG_PLOT::Plot().
|
private |
Add the Design Rules section in JSON format to m_JSONbuffer.
Definition at line 453 of file gerber_jobfile_writer.cpp.
References B_Cu, F_Cu, BOARD::Footprints(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), m_json, BOARD_DESIGN_SETTINGS::m_NetSettings, m_pcb, mapValue(), name, pad, PCB_VIA_T, BOARD::Tracks(), and BOARD::Zones().
Referenced by WriteJSONJobFile().
|
private |
Add the Files Attributes section in JSON format to m_JSONbuffer.
Definition at line 326 of file gerber_jobfile_writer.cpp.
References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, formatStringFromUTF32(), BOARD::GetCopperLayerCount(), IsCopperLayer(), JOBFILE_PARAMS::m_GerberFileList, m_json, JOBFILE_PARAMS::m_LayerId, m_params, m_pcb, m_reporter, Margin, name, REPORTER::Report(), RPT_SEVERITY_ERROR, User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.
Referenced by WriteJSONJobFile().
|
private |
Add the General Specs in JSON format to m_JSONbuffer.
Definition at line 224 of file gerber_jobfile_writer.cpp.
References BS_EDGE_CONNECTOR_BEVELLED, ExpandTextVars(), GbrMakeProjectGUIDfromString(), BOARD::GetBoardEdgesBoundingBox(), BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD::GetFileName(), BOX2< Vec >::GetHeight(), BOARD::GetProject(), TITLE_BLOCK::GetRevision(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), BOARD::GetTitleBlock(), BOX2< Vec >::GetWidth(), BOARD_STACKUP::m_CastellatedPads, BOARD_STACKUP::m_EdgeConnectorConstraints, BOARD_STACKUP::m_EdgePlating, BOARD_STACKUP::m_FinishType, BOARD_STACKUP::m_HasDielectricConstrains, m_json, m_pcb, and mapValue().
Referenced by WriteJSONJobFile().
|
private |
Add the job file header in JSON format to m_JSONbuffer.
Definition at line 157 of file gerber_jobfile_writer.cpp.
References GBR_NC_STRING_FORMAT_GBRJOB, GbrMakeCreationDateAttributeString(), GetBuildVersion(), and m_json.
Referenced by WriteJSONJobFile().
|
private |
Add the Material Stackup section in JSON format to m_JSONbuffer This is the ordered list of stackup layers (mask, paste, silk, copper, dielectric) used to make the physical board.
Therefore not all layers are listed here
Definition at line 569 of file gerber_jobfile_writer.cpp.
References _, B_Cu, BS_ITEM_TYPE_COPPER, BS_ITEM_TYPE_DIELECTRIC, BS_ITEM_TYPE_SILKSCREEN, BS_ITEM_TYPE_SOLDERMASK, BS_ITEM_TYPE_SOLDERPASTE, color, F_Cu, BOARD_STACKUP_ITEM::FormatEpsilonR(), BOARD_STACKUP_ITEM::FormatLossTangent(), formatStringFromUTF32(), BOARD_STACKUP_ITEM::GetBrdLayerId(), BOARD_STACKUP_ITEM::GetColor(), BOARD::GetCopperLayerCount(), BOARD_STACKUP::GetCount(), BOARD::GetDesignSettings(), BOARD_STACKUP_ITEM::GetDielectricLayerId(), BOARD_STACKUP_ITEM::GetEpsilonR(), BOARD::GetLayerName(), BOARD_STACKUP_ITEM::GetLossTangent(), BOARD_STACKUP_ITEM::GetMaterial(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), BOARD_STACKUP::GetStackupLayer(), GetStandardColors(), BOARD_STACKUP_ITEM::GetSublayersCount(), BOARD_STACKUP_ITEM::GetThickness(), BOARD_STACKUP_ITEM::GetType(), BOARD_STACKUP_ITEM::GetTypeName(), BOARD_STACKUP_ITEM::HasMaterialValue(), In1_Cu, BOARD_STACKUP_ITEM::IsColorEditable(), IsPrmSpecified(), BOARD_STACKUP_ITEM::IsThicknessEditable(), BOARD_STACKUP::m_HasDielectricConstrains, BOARD_DESIGN_SETTINGS::m_HasStackup, m_json, m_pcb, m_reporter, mapValue(), name, REPORTER::Report(), RPT_SEVERITY_ERROR, and BOARD_STACKUP::SynchronizeWithBoard().
Referenced by WriteJSONJobFile().
bool GERBER_JOBFILE_WRITER::CreateJobFile | ( | const wxString & | aFullFilename | ) |
Creates a Gerber job file.
aFullFilename | = the full filename |
Definition at line 132 of file gerber_jobfile_writer.cpp.
References _, m_reporter, REPORTER::Report(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, and WriteJSONJobFile().
Referenced by PCBNEW_JOBS_HANDLER::JobExportGerbers(), and DIALOG_PLOT::Plot().
|
private |
A helper function to convert a wxString ( therefore a Unicode text ) to a JSON compatible string (a escaped unicode sequence of 4 hexa).
Definition at line 61 of file gerber_jobfile_writer.cpp.
Referenced by addJSONFilesAttributes(), and addJSONMaterialStackup().
|
private |
Definition at line 70 of file gerber_jobfile_writer.cpp.
References B_SilkS, F_SilkS, flag, JOBFILE_PARAMS::m_LayerId, m_params, SIDE_BOTTOM, SIDE_NONE, and SIDE_TOP.
|
private |
Definition at line 87 of file gerber_jobfile_writer.cpp.
References B_Mask, F_Mask, flag, JOBFILE_PARAMS::m_LayerId, m_params, SIDE_BOTTOM, SIDE_NONE, and SIDE_TOP.
|
private |
A helper function to convert a double in Pcbnew internal units to a JSON double value (in mm), with only 4 digits in mantissa for a better readability when printed using g or equivalent format.
Definition at line 207 of file gerber_jobfile_writer.cpp.
References m_conversionUnits.
Referenced by addJSONDesignRules(), addJSONGeneralSpecs(), and addJSONMaterialStackup().
|
private |
Definition at line 103 of file gerber_jobfile_writer.cpp.
References SIDE_BOTH, SIDE_BOTTOM, SIDE_NONE, and SIDE_TOP.
bool GERBER_JOBFILE_WRITER::WriteJSONJobFile | ( | const wxString & | aFullFilename | ) |
Creates an Gerber job file in JSON format.
aFullFilename | = the full filename |
aParams | = true for a NPTH file, false for a PTH file |
Definition at line 177 of file gerber_jobfile_writer.cpp.
References addJSONDesignRules(), addJSONFilesAttributes(), addJSONGeneralSpecs(), addJSONHeader(), addJSONMaterialStackup(), dummy, and m_json.
Referenced by CreateJobFile().
|
private |
Definition at line 168 of file gerber_jobfile_writer.h.
Referenced by GERBER_JOBFILE_WRITER(), and mapValue().
|
private |
Definition at line 169 of file gerber_jobfile_writer.h.
Referenced by addJSONDesignRules(), addJSONFilesAttributes(), addJSONGeneralSpecs(), addJSONHeader(), addJSONMaterialStackup(), and WriteJSONJobFile().
|
private |
Definition at line 167 of file gerber_jobfile_writer.h.
Referenced by AddGbrFile(), addJSONFilesAttributes(), hasSilkLayers(), and hasSolderMasks().
|
private |
Definition at line 165 of file gerber_jobfile_writer.h.
Referenced by addJSONDesignRules(), addJSONFilesAttributes(), addJSONGeneralSpecs(), addJSONMaterialStackup(), and GERBER_JOBFILE_WRITER().
|
private |
Definition at line 166 of file gerber_jobfile_writer.h.
Referenced by addJSONFilesAttributes(), addJSONMaterialStackup(), CreateJobFile(), and GERBER_JOBFILE_WRITER().