KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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
28
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
52
54{
55public:
58
62 wxArrayString& GetPrms() { return m_Prms; }
63
70 const wxString& GetPrm( int aIdx );
71
76 const wxString& GetAttribute();
77
82 int GetPrmCount() { return int( m_Prms.GetCount() ); }
83
96 bool ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char* &aText, int& aLineNum );
97
101 void DbgListPrms();
102
107 {
108 return GetAttribute().IsSameAs( wxT(".FileFunction"), false );
109 }
110
115 {
116 return GetAttribute().IsSameAs( wxT(".MD5"), false );
117 }
118
123 {
124 return GetAttribute().IsSameAs( wxT(".Part"), false );
125 }
126
127protected:
128 wxArrayString m_Prms;
131};
132
148
150{
151public:
152 X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase );
153
154 bool IsCopper();
155
160 bool IsDrillFile();
161
162 const wxString& GetFileType();
163 const wxString& GetBrdLayerId();
165
169 const wxString GetDrillLayerPair();
170
175 const wxString& GetLPType();
176
181 const wxString& GetRouteType();
182
183 const wxString& GetBrdLayerSide();
185 const wxString& GetLabel();
186
187 int GetZOrder() { return m_z_order; }
189 int GetZSubOrder() { return m_z_sub_order; }
191
192private:
193
197 void set_Z_Order();
198
199 int m_z_order; // the z order of the layer for a board
200 int m_z_sub_order; // the z sub_order of the copper layer for a board
201};
202
203#endif // X2_GERBER_ATTRIBUTE_H
bool IsCopper()
return true if the filefunction type is "Copper"
X2_ATTRIBUTE_FILEFUNCTION(X2_ATTRIBUTE &aAttributeBase)
const wxString & GetBrdLayerSide()
the brd layer Pos: Top, Bot, Inr same as GetBrdLayerId() for non copper type
const wxString & GetFileType()
the type of layer (Copper, Soldermask ... )
int GetZSubOrder()
the Order of the bdr copper layer, from front (Top) side to back (Bot) side
const wxString & GetLabel()
the filefunction label, if any
void set_Z_Order()
Initialize the z order priority of the current file, from its attributes.
const wxString & GetBrdLayerId()
the brd layer identifier: Ln, only for Copper type or Top, Bot for other types
int GetZOrder()
the Order of the board layer, from front (Top) side to back (Bot) side
const wxString & GetPrm(int aIdx)
bool IsFileFunction()
Return true if the attribute is .FileFunction.
void DbgListPrms()
Debug function: print using wxLogMessage le list of parameters.
const wxString & GetAttribute()
bool IsFilePart()
Return true if the attribute is .Part.
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.
bool IsFileMD5()
Return true if the attribute is .MD5.
wxArrayString m_Prms
the list of parameters (after TF) in gbr file the first one is the attribute name,...
wxArrayString & GetPrms()