KiCad PCB EDA Suite
|
Handle special data (items attributes) during plot. More...
#include <gbr_netlist_metadata.h>
Go to the source code of this file.
Classes | |
class | GBR_APERTURE_METADATA |
class | GBR_METADATA |
Metadata which can be added in a gerber file as attribute in X2 format. More... | |
Enumerations | |
enum | GBR_NC_STRING_FORMAT { GBR_NC_STRING_FORMAT_X1 , GBR_NC_STRING_FORMAT_X2 , GBR_NC_STRING_FORMAT_GBRJOB , GBR_NC_STRING_FORMAT_NCDRILL } |
Create a gerber TF.CreationDate attribute. More... | |
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. | |
std::string | FormatStringToGerber (const wxString &aString) |
Normalize aString and convert it to a Gerber std::string. | |
wxString | ConvertNotAllowedCharsInGerber (const wxString &aString, bool aAllowUtf8Chars, bool aQuoteString) |
Normalize aString and convert it to a Gerber compatible wxString. | |
wxString | FormatStringFromGerber (const wxString &aString) |
Convert a gerber string into a 16 bit Unicode 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. | |
Handle special data (items attributes) during plot.
Used in Gerber plotter to generate auxiliary data during plot (for instance info associated to apertures and flashed pads)
Definition in file gbr_metadata.h.
enum GBR_NC_STRING_FORMAT |
Create a gerber TF.CreationDate attribute.
The attribute value must conform to the full version of the ISO 8601 date and time format, including time and time zone.
Example of structured comment (compatible X1 gerber) G04 #@! TF.CreationDate,2018-11-21T08:49:16+01:00* (example of X1 attribute)
Example NC drill files ; #@! TF.CreationDate,2018-11-21T08:49:16+01:00* (example of NC drill comment)
Example of X2 attribute: TF.CreationDate,2018-11-06T08:25:24+01:00*%
aFormat | string compatibility: X1, X2, GBRJOB or NC drill syntax. |
Enumerator | |
---|---|
GBR_NC_STRING_FORMAT_X1 | |
GBR_NC_STRING_FORMAT_X2 | |
GBR_NC_STRING_FORMAT_GBRJOB | |
GBR_NC_STRING_FORMAT_NCDRILL |
Definition at line 59 of file gbr_metadata.h.
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().