KiCad PCB EDA Suite
|
helper functions to handle the gerber metadata in files, related to the netlist info and aperture attribute. More...
Go to the source code of this file.
Macros | |
#define | NO_NET_NAME wxT( "N/C" ) |
#define | NO_PAD_NAME wxT( "" ) |
Functions | |
wxString | GbrMakeCreationDateAttributeString (GBR_NC_STRING_FORMAT aFormat) |
wxString | GbrMakeProjectGUIDfromString (const wxString &aText) |
Build a project GUID using format RFC4122 Version 1 or 4 from the project name, because a KiCad project has no specific GUID. | |
int | char2Hex (unsigned aCode) |
wxString | FormatStringFromGerber (const wxString &aString) |
Convert a gerber string into a 16 bit Unicode string. | |
wxString | ConvertNotAllowedCharsInGerber (const wxString &aString, bool aAllowUtf8Chars, bool aQuoteString) |
Normalize aString and convert it to a Gerber compatible wxString. | |
std::string | FormatStringToGerber (const wxString &aString) |
Normalize aString and convert it to a Gerber std::string. | |
bool | FormatNetAttribute (std::string &aPrintedText, std::string &aLastNetAttributes, const GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes, bool aUseX1StructuredComment) |
Generate the string to set a net attribute for a graphic object to print to a gerber file. | |
helper functions to handle the gerber metadata in files, related to the netlist info and aperture attribute.
Definition in file gbr_metadata.cpp.
#define NO_NET_NAME wxT( "N/C" ) |
Definition at line 538 of file gbr_metadata.cpp.
#define NO_PAD_NAME wxT( "" ) |
Definition at line 539 of file gbr_metadata.cpp.
int char2Hex | ( | unsigned | aCode | ) |
Definition at line 354 of file gbr_metadata.cpp.
Referenced by FormatStringFromGerber().
wxString ConvertNotAllowedCharsInGerber | ( | const wxString & | aString, |
bool | aAllowUtf8Chars, | ||
bool | aQuoteString | ||
) |
Normalize aString and convert it to a Gerber compatible wxString.
Normalization means convert to a hexadecimal 16 bit sequence Unicode and on request convert any code > 0x7F. Illegal characters are ',' '*' '' '\'.
aString | the string to convert. |
aAllowUtf8Chars | false to convert non ASCII7 values to Unicode sequence. |
aQuoteString | true to double quote the returned string. |
Definition at line 435 of file gbr_metadata.cpp.
References convert.
Referenced by PLACEFILE_GERBER_WRITER::CreatePlaceFile(), FormatStringToGerber(), and GBR_DATA_FIELD::GetGerberString().
bool FormatNetAttribute | ( | std::string & | aPrintedText, |
std::string & | aLastNetAttributes, | ||
const GBR_NETLIST_METADATA * | aData, | ||
bool & | aClearPreviousAttributes, | ||
bool | aUseX1StructuredComment | ||
) |
Generate the string to set a net attribute for a graphic object to print to a gerber file.
aPrintedText | is the string to print. |
aLastNetAttributes | is the current full set of attributes. |
aData | is the GBR_NETLIST_METADATA associated to the graphic object (can be NULL if no associated metadata, and aClearPreviousAttributes will be set to false) |
aClearPreviousAttributes | returns true if the full set of attributes must be deleted from file before adding new attribute (happens when a previous attribute no longer exists). |
aUseX1StructuredComment | false in X2 mode and true in X1 mode to add the net attribute in compatible X1 structured comment (i.e. prefixed by "G04 #@! ") |
Definition at line 542 of file gbr_metadata.cpp.
References FormatStringToGerber(), GBR_NETLIST_METADATA::GBR_NETINFO_CMP, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_PAD, GBR_NETLIST_METADATA::GBR_NETINFO_UNSPECIFIED, GBR_DATA_FIELD::GetGerberString(), GBR_DATA_FIELD::IsEmpty(), GBR_NETLIST_METADATA::m_Cmpref, GBR_NETLIST_METADATA::m_NetAttribType, GBR_NETLIST_METADATA::m_Netname, GBR_NETLIST_METADATA::m_NotInNet, GBR_NETLIST_METADATA::m_Padname, GBR_NETLIST_METADATA::m_PadPinFunction, GBR_NETLIST_METADATA::m_TryKeepPreviousAttributes, NO_NET_NAME, and NO_PAD_NAME.
Referenced by GERBER_PLOTTER::formatNetAttribute().
wxString FormatStringFromGerber | ( | const wxString & | aString | ) |
Convert a gerber string into a 16 bit Unicode string.
aString | the gerber string to format. |
Definition at line 369 of file gbr_metadata.cpp.
References char2Hex().
Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().
std::string FormatStringToGerber | ( | const wxString & | aString | ) |
Normalize aString and convert it to a Gerber std::string.
Normalization means convert any code > 0x7F and unauthorized code to a hexadecimal 16 bit sequence Unicode. Illegal characters are ',' '*' '' '\'.
aString | the string to convert. |
Definition at line 512 of file gbr_metadata.cpp.
References ConvertNotAllowedCharsInGerber().
Referenced by FormatNetAttribute().
wxString GbrMakeCreationDateAttributeString | ( | GBR_NC_STRING_FORMAT | aFormat | ) |
Definition at line 37 of file gbr_metadata.cpp.
References GBR_NC_STRING_FORMAT_GBRJOB, GBR_NC_STRING_FORMAT_NCDRILL, GBR_NC_STRING_FORMAT_X1, and GBR_NC_STRING_FORMAT_X2.
Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONHeader(), and EXCELLON_WRITER::writeEXCELLONHeader().
wxString GbrMakeProjectGUIDfromString | ( | const wxString & | aText | ) |
Build a project GUID using format RFC4122 Version 1 or 4 from the project name, because a KiCad project has no specific GUID.
RFC4122 is used mainly for its syntax, because fields have no meaning for Gerber files and therefore the GUID generated has no meaning because it do not use any time and time stamp specific to the project, just a random pattern (random is here a pattern specific to a project).
See en.wikipedia.org/wiki/Universally_unique_identifier
Definition at line 81 of file gbr_metadata.cpp.
Referenced by AddGerberX2Header(), and GERBER_JOBFILE_WRITER::addJSONGeneralSpecs().