KiCad PCB EDA Suite
class_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-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2014 KiCad Developers, see change_log.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 _CLASS_X2_GERBER_ATTRIBUTE_H_
30 #define _CLASS_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 
101  bool ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char* &aText );
102 
106  void DbgListPrms();
107 
112  {
113  return GetAttribute().IsSameAs( wxT(".FileFunction"), false );
114  }
115 
119  bool IsFileMD5()
120  {
121  return GetAttribute().IsSameAs( wxT(".MD5"), false );
122  }
123 
127  bool IsFilePart()
128  {
129  return GetAttribute().IsSameAs( wxT(".Part"), false );
130  }
131 };
132 
150 {
151  int m_z_order; // the z order of the layer for a board
152  int m_z_sub_order; // the z sub_order of the copper layer for a board
153 
154 public:
155  X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase );
156 
157  bool IsCopper();
158 
163  bool IsDrillFile();
164 
165  const wxString& GetFileType();
166  const wxString& GetBrdLayerId();
167 
172  const wxString GetDrillLayerPair();
173 
178  const wxString& GetLPType();
179 
184  const wxString& GetRouteType();
185 
186  const wxString& GetBrdLayerSide();
187  const wxString& GetLabel();
189 
190  int GetZOrder() { return m_z_order; }
191  int GetZSubOrder() { return m_z_sub_order; }
193 
195 private:
196 
200  void set_Z_Order();
201 };
202 
203 #endif // _CLASS_X2_GERBER_ATTRIBUTE_H_
const wxString & GetFileType()
the type of layer (Copper, Soldermask ... )
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 IsCopper()
return true if the filefunction type is "Copper"
int GetZSubOrder()
the Order of the bdr copper layer, from front (Top) side to back (Bot) side
bool IsFileMD5()
return true if the attribute is .MD5
wxArrayString & GetPrms()
void set_Z_Order()
Initialize the z order priority of the current file, from its attributes.
bool IsFilePart()
return true if the attribute is .Part
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
X2_ATTRIBUTE_FILEFUNCTION(X2_ATTRIBUTE &aAttributeBase)
const wxString & GetLabel()
the filefunction label, if any
const wxString & GetBrdLayerId()
the brd layer identifier: Ln, only for Copper type or Top, Bot for other types
bool IsFileFunction()
return true if the attribute is .FileFunction
const wxString & GetBrdLayerSide()
the brd layer Pos: Top, Bot, Inr same as GetBrdLayerId() for non copper type
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 '.