KiCad PCB EDA Suite
X2_gerber_attributes.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) 2010-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 1992-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 
29 #ifndef X2_GERBER_ATTRIBUTE_H
30 #define X2_GERBER_ATTRIBUTE_H
31 
32 /*
33  * Manage the gerber extensions (attributes) in the new X2 version
34  * only few extensions are handled
35  * See http://www.ucamco.com/files/downloads/file/81/the_gerber_file_format_specification.pdf
36  *
37  * gerber attributes in the new X2 version look like:
38  * %TF.FileFunction,Copper,L1,Top*%
39  *
40  * Currently:
41  * .FileFunction .FileFunction Identifies the file's function in the PCB.
42  * Other Standard Attributes, not yet used in Gerbview:
43  * .Part Identifies the part the file represents, e.g. a single PCB
44  * .MD5 Sets the MD5 file signature or checksum.
45  */
46 
47 #include <wx/arrstr.h>
48 
55 {
56 protected:
57  wxArrayString m_Prms;
58 
61 public:
62  X2_ATTRIBUTE();
63  ~X2_ATTRIBUTE();
64 
68  wxArrayString& GetPrms() { return m_Prms; }
69 
76  const wxString& GetPrm( int aIdx );
77 
82  const wxString& GetAttribute();
83 
88  int GetPrmCount() { return int( m_Prms.GetCount() ); }
89 
102  bool ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char* &aText, int& aLineNum );
103 
107  void DbgListPrms();
108 
113  {
114  return GetAttribute().IsSameAs( wxT(".FileFunction"), false );
115  }
116 
120  bool IsFileMD5()
121  {
122  return GetAttribute().IsSameAs( wxT(".MD5"), false );
123  }
124 
128  bool IsFilePart()
129  {
130  return GetAttribute().IsSameAs( wxT(".Part"), false );
131  }
132 };
133 
151 {
152  int m_z_order; // the z order of the layer for a board
153  int m_z_sub_order; // the z sub_order of the copper layer for a board
154 
155 public:
156  X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase );
157 
158  bool IsCopper();
159 
164  bool IsDrillFile();
165 
166  const wxString& GetFileType();
167  const wxString& GetBrdLayerId();
168 
173  const wxString GetDrillLayerPair();
174 
179  const wxString& GetLPType();
180 
185  const wxString& GetRouteType();
186 
187  const wxString& GetBrdLayerSide();
188  const wxString& GetLabel();
190 
191  int GetZOrder() { return m_z_order; }
192  int GetZSubOrder() { return m_z_sub_order; }
194 
196 private:
197 
201  void set_Z_Order();
202 };
203 
204 #endif // X2_GERBER_ATTRIBUTE_H
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma ...
const wxString & GetPrm(int aIdx)
bool IsFileMD5()
return true if the attribute is .MD5
wxArrayString & GetPrms()
bool IsFilePart()
return true if the attribute is .Part
bool IsFileFunction()
return true if the attribute is .FileFunction
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText, int &aLineNum)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
void DbgListPrms()
Debug function: pring using wxLogMessage le list of parameters.
const wxString & GetAttribute()
int GetZOrder()
the Order of the board layer, from front (Top) side to back (Bot) side
wxArrayString m_Prms
the list of parameters (after TF) in gbr file the first one is the attribute name, if starting by &#39;.