KiCad PCB EDA Suite
gbr_metadata.h
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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
33 #ifndef GBR_METADATA_H
34 #define GBR_METADATA_H
35 
36 #include <gbr_netlist_metadata.h>
37 
46 wxString GbrMakeProjectGUIDfromString( wxString& aText );
47 
48 
49 // this class handle info which can be added in a gerber file as attribute
50 // of an aperture, by the %TA.AperFunction command
51 // This attribute is added when creating a new aperture (command %ADDxx)
52 // Only one aperture attribute can be added to a given aperture
53 //
55 {
56 public:
58  {
77  };
78 
81  {}
82 
86  static std::string GetAttributeName( GBR_APERTURE_ATTRIB aAttribute );
87  std::string GetAttributeName()
88  {
90  }
91 
100  static std::string FormatAttribute( GBR_APERTURE_ATTRIB aAttribute,
101  bool aUseX1StructuredComment );
102 
103  std::string FormatAttribute( bool aUseX1StructuredComment )
104  {
105  return FormatAttribute( m_ApertAttribute, aUseX1StructuredComment );
106  }
107 
108  // The id of the aperture attribute
110 };
111 
112 // this class handle metadata which can be added in a gerber file as attribute
113 // in X2 format
115 {
116 public:
117  GBR_METADATA(): m_isCopper( false) {}
118 
120  {
121  m_ApertureMetadata.m_ApertAttribute = aApertAttribute;
122  }
123 
125  {
126  return m_ApertureMetadata.m_ApertAttribute;
127  }
128 
129  void SetNetAttribType( int aNetAttribType )
130  {
131  m_NetlistMetadata.m_NetAttribType = aNetAttribType;
132  }
133 
134  int GetNetAttribType() const
135  {
136  return m_NetlistMetadata.m_NetAttribType;
137  }
138 
139  void SetNetName( const wxString& aNetname ) { m_NetlistMetadata.m_Netname = aNetname; }
140  void SetPadName( const wxString& aPadname ) { m_NetlistMetadata.m_Padname = aPadname; }
141  void SetCmpReference( const wxString& aComponentRef ) { m_NetlistMetadata.m_Cmpref = aComponentRef; }
142 
147  bool IsCopper() { return m_isCopper; }
148  void SetCopper( bool aValue ) { m_isCopper = aValue; }
149 
154 
159 
160 private:
168 };
169 
170 
179 std::string formatStringToGerber( const wxString& aString );
180 
187 wxString FormatStringFromGerber( const wxString& aString );
188 
206 bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttributes,
207  GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes,
208  bool aUseX1StructuredComment );
209 
210 #endif // GBR_METADATA_H
void SetPadName(const wxString &aPadname)
Definition: gbr_metadata.h:140
aperture used for etched components
Definition: gbr_metadata.h:60
aperture used for edge connecto pad (outer layers)
Definition: gbr_metadata.h:70
aperture used for heat sink pad (typically for SMDs)
Definition: gbr_metadata.h:72
void SetNetAttribType(int aNetAttribType)
Definition: gbr_metadata.h:129
aperture used for through hole component on outer layer
Definition: gbr_metadata.h:65
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
Definition: gbr_metadata.h:147
aperture used for via holes in drill files
Definition: gbr_metadata.h:73
this class handle info which can be added in a gerber file as attribute of an obtect the GBR_INFO_TYP...
aperture used for SMD pad. Excluded BGA pads which have their own type
Definition: gbr_metadata.h:66
aperture used for BGA pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:69
aperture used for pad holes in drill files
Definition: gbr_metadata.h:74
wxString FormatStringFromGerber(const wxString &aString)
This helper function make the inverse conversion of formatStringToGerber() It converts a "normalized"...
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:124
std::string GetAttributeName()
Definition: gbr_metadata.h:87
aperture used for mechanical pads (NPTH)
Definition: gbr_metadata.h:71
wxString GbrMakeProjectGUIDfromString(wxString &aText)
A helper function to build a project GUID using format RFC4122 Version 1 or 4 from the project name...
aperture used for BGA pads with a solder mask defined by the copper shape
Definition: gbr_metadata.h:68
bool FormatNetAttribute(std::string &aPrintedText, std::string &aLastNetAttributes, GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes, bool aUseX1StructuredComment)
Generates the string to print to a gerber file, to set a net attribute for a graphic object...
std::string formatStringToGerber(const wxString &aString)
This helper function "normalize" aString and convert it to a Gerber std::string Normalisation means c...
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:61
static std::string FormatAttribute(GBR_APERTURE_ATTRIB aAttribute, bool aUseX1StructuredComment)
void SetNetName(const wxString &aNetname)
Definition: gbr_metadata.h:139
aperture used for SMD pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:67
bool m_isCopper
if the metadata is relative to a copper layer or not.
Definition: gbr_metadata.h:167
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:119
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:158
aperture used for not connected items (texts, outlines on copper)
Definition: gbr_metadata.h:63
std::string FormatAttribute(bool aUseX1StructuredComment)
Definition: gbr_metadata.h:103
int GetNetAttribType() const
Definition: gbr_metadata.h:134
void SetCopper(bool aValue)
Definition: gbr_metadata.h:148
aperture used for oblong holes in drill files
Definition: gbr_metadata.h:75
void SetCmpReference(const wxString &aComponentRef)
Definition: gbr_metadata.h:141
GBR_APERTURE_METADATA m_ApertureMetadata
a item to handle aperture attribute:
Definition: gbr_metadata.h:153
GBR_APERTURE_ATTRIB m_ApertAttribute
Definition: gbr_metadata.h:109