KiCad PCB EDA Suite
plot_auxiliary_data.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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2017 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 PLOT_EXTRA_DATA_H
34 #define PLOT_EXTRA_DATA_H
35 
36 #include <gbr_netlist_metadata.h>
37 
38 
39 // this class handle info which can be added in a gerber file as attribute
40 // of an aperture, by the %TA.AperFunction command
41 // This attribute is added when creating a new aperture (command %ADDxx)
42 // Only one aperture attribute can be added to a given aperture
43 //
45 {
46 public:
48  {
67  };
68 
71  {}
72 
76  static std::string GetAttributeName( GBR_APERTURE_ATTRIB aAttribute );
77  std::string GetAttributeName()
78  {
80  }
81 
86  static std::string FormatAttribute( GBR_APERTURE_ATTRIB aAttribute );
87  std::string FormatAttribute()
88  {
90  }
91 
92  // The id of the aperture attribute
94 };
95 
96 // this class handle metadata which can be added in a gerber file as attribute
97 // in X2 format
99 {
100 public:
101  GBR_METADATA(): m_isCopper( false) {}
102 
104  {
105  m_ApertureMetadata.m_ApertAttribute = aApertAttribute;
106  }
107 
109  {
111  }
112 
113  void SetNetAttribType( int aNetAttribType )
114  {
115  m_NetlistMetadata.m_NetAttribType = aNetAttribType;
116  }
117 
118  int GetNetAttribType() const
119  {
121  }
122 
123  void SetNetName( const wxString& aNetname ) { m_NetlistMetadata.m_Netname = aNetname; }
124  void SetPadName( const wxString& aPadname ) { m_NetlistMetadata.m_Padname = aPadname; }
125  void SetCmpReference( const wxString& aComponentRef ) { m_NetlistMetadata.m_Cmpref = aComponentRef; }
126 
131  bool IsCopper() { return m_isCopper; }
132  void SetCopper( bool aValue ) { m_isCopper = aValue; }
133 
138 
143 
144 private:
152 };
153 
162 std::string formatStringToGerber( const wxString& aString );
163 
177 bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttributes,
178  GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes );
179 
180 #endif // PLOT_EXTRA_DATA_H
void SetPadName(const wxString &aPadname)
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 edge connecto pad (outer layers)
aperture used for heat sink pad (typically for SMDs)
void SetNetAttribType(int aNetAttribType)
wxString m_Cmpref
the component reference parent of the data
aperture used for through hole component on outer layer
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
aperture used for via holes in drill files
bool FormatNetAttribute(std::string &aPrintedText, std::string &aLastNetAttributes, GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes)
Generates the string to print to a gerber file, to set a net attribute for a graphic object...
aperture used for SMD pad. Excluded BGA pads which have their own type
aperture used for BGA pad with a solder mask defined by the solder mask
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
aperture used for pad holes in drill files
wxString m_Netname
for items associated to a net: the netname
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
std::string GetAttributeName()
aperture used for mechanical pads (NPTH)
aperture used for BGA pads with a solder mask defined by the copper shape
aperture used for connected items like tracks (not vias)
void SetNetName(const wxString &aNetname)
aperture used for SMD pad with a solder mask defined by the solder mask
bool m_isCopper
if the metadata is relative to a copper layer or not.
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
aperture used for not connected items (texts, outlines on copper)
int GetNetAttribType() const
void SetCopper(bool aValue)
aperture used for oblong holes in drill files
void SetCmpReference(const wxString &aComponentRef)
GBR_APERTURE_METADATA m_ApertureMetadata
a item to handle aperture attribute:
GBR_APERTURE_ATTRIB m_ApertAttribute
int m_NetAttribType
the type of net info (used to define the gerber string to create)