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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#ifndef X2_GERBER_ATTRIBUTE_H
26#define X2_GERBER_ATTRIBUTE_H
27
28/*
29 * Manage the gerber extensions (attributes) in the new X2 version
30 * only few extensions are handled
31 * See http://www.ucamco.com/files/downloads/file/81/the_gerber_file_format_specification.pdf
32 *
33 * gerber attributes in the new X2 version look like:
34 * %TF.FileFunction,Copper,L1,Top*%
35 *
36 * Currently:
37 * .FileFunction .FileFunction Identifies the file's function in the PCB.
38 * Other Standard Attributes, not yet used in Gerbview:
39 * .Part Identifies the part the file represents, e.g. a single PCB
40 * .MD5 Sets the MD5 file signature or checksum.
41 */
42
43#include <wx/arrstr.h>
44
48
50{
51public:
54
58 wxArrayString& GetPrms() { return m_Prms; }
59
66 const wxString& GetPrm( int aIdx );
67
72 const wxString& GetAttribute();
73
78 int GetPrmCount() { return int( m_Prms.GetCount() ); }
79
92 bool ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char* &aText, int& aLineNum );
93
97 void DbgListPrms();
98
103 {
104 return GetAttribute().IsSameAs( wxT(".FileFunction"), false );
105 }
106
111 {
112 return GetAttribute().IsSameAs( wxT(".MD5"), false );
113 }
114
119 {
120 return GetAttribute().IsSameAs( wxT(".Part"), false );
121 }
122
123protected:
124 wxArrayString m_Prms;
127};
128
144
146{
147public:
148 X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase );
149
150 bool IsCopper();
151
156 bool IsDrillFile();
157
158 const wxString& GetFileType();
159 const wxString& GetBrdLayerId();
161
165 const wxString GetDrillLayerPair();
166
171 const wxString& GetLPType();
172
177 const wxString& GetRouteType();
178
179 const wxString& GetBrdLayerSide();
181 const wxString& GetLabel();
182
183 int GetZOrder() { return m_z_order; }
185 int GetZSubOrder() { return m_z_sub_order; }
187
188private:
189
193 void set_Z_Order();
194
195 int m_z_order; // the z order of the layer for a board
196 int m_z_sub_order; // the z sub_order of the copper layer for a board
197};
198
199#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()