KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gbr_netlist_metadata.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) 2016 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
25#ifndef GBR_NETLIST_METADATA_H
26#define GBR_NETLIST_METADATA_H
27
58{
59public:
61 {
65 };
66
68 m_Orientation( 0.0 ),
70 {}
71
72 void ClearData(); // Clear all strings
73
80 wxString FormatCmpPnPMetadata();
81
82
83 double m_Orientation; // orientation in degree
84 wxString m_Manufacturer; // Manufacturer name
85 wxString m_MPN; // Manufacturer part number
86 wxString m_Package; // Package, as per IPC-7351
87 wxString m_Footprint; // Footprint name, from library
88 wxString m_LibraryName; // Library name, containing the footprint
89 wxString m_LibraryDescr; // Library description
90 wxString m_Value; // Component value
91 MOUNT_TYPE m_MountType; // SMD|TH|Other
92};
93
103{
104public:
106 {}
107
108 void clear()
109 {
110 m_field.clear();
111 m_useUTF8 = false;
112 m_escapeString = false;
113 }
114
115 void Clear() { clear(); }
116
117 const wxString& GetValue() const { return m_field; }
118
119 void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString )
120 {
121 m_field = aField;
122 m_useUTF8 = aUseUTF8;
123 m_escapeString = aEscapeString;
124 }
125
126 bool IsEmpty() const { return m_field.IsEmpty(); }
127
128 std::string GetGerberString() const;
129
130private:
131 wxString m_field;
135};
136
137
152{
153public:
154 // This enum enables the different net attributes attached to the object
155 // the values can be ORed for items which can have more than one attribute
156 // (A flashed pad has all allowed attributes)
158 {
162 GBR_NETINFO_CMP = 4
163 };
164
166 m_NotInNet( false ), m_TryKeepPreviousAttributes( false )
167 {
168 }
169
174 {
175 m_ExtraData.Clear();
176 }
177
181 void SetExtraData( const wxString& aExtraData)
182 {
183 m_ExtraData = aExtraData;
184 }
185
193 void ClearAttribute( const wxString* aName )
194 {
196 {
199 m_Cmpref.clear();
200 m_Netname.clear();
201 return;
202 }
203
204 if( !aName || aName->IsEmpty() || *aName == wxT( ".CN" ) )
205 {
209 m_Cmpref.clear();
210 m_Netname.clear();
211 return;
212 }
213
214 if( *aName == wxT( ".C" ) )
215 {
216 m_NetAttribType &= ~GBR_NETINFO_CMP;
217 m_Cmpref.clear();
218 return;
219 }
220
221 if( *aName == wxT( ".N" ) )
222 {
223 m_NetAttribType &= ~GBR_NETINFO_NET;
224 m_Netname.clear();
225 return;
226 }
227
228 if( *aName == wxT( ".P" ) )
229 {
230 m_NetAttribType &= ~GBR_NETINFO_PAD;
233 return;
234 }
235 }
236
237 // these members are used in the %TO object attributes command.
245 wxString m_Cmpref;
246 wxString m_Netname;
247
248 wxString m_ExtraData;
250
257};
258
259
260// Flashed pads use the full attribute set: this is a helper for flashed pads
261#define GBR_NETINFO_ALL \
262 ( GBR_NETLIST_METADATA::GBR_NETINFO_PAD | GBR_NETLIST_METADATA::GBR_NETINFO_NET \
263 | GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
264
265#endif // GBR_NETLIST_METADATA_H
Information which can be added in a gerber P&P file as attribute of a component.
wxString FormatCmpPnPMetadata()
One line by non empty data the orientation (.CRot) and mount type (.CMnt) are always generated.
A Gerber data field.
void SetField(const wxString &aField, bool aUseUTF8, bool aEscapeString)
std::string GetGerberString() const
wxString m_field
the Unicode text to print in Gbr file (after escape and quoting)
bool m_useUTF8
true to use UTF8, false to escape non ASCII7 chars
const wxString & GetValue() const
bool m_escapeString
true to quote the field in gbr file
Information which can be added in a gerber file as attribute of an object.
int m_NetAttribType
the type of net info (used to define the gerber string to create)
wxString m_Cmpref
the component reference parent of the data
@ GBR_NETINFO_NET
print info associated to a net (TO.N attribute)
@ GBR_NETINFO_UNSPECIFIED
idle command (no command)
@ GBR_NETINFO_CMP
print info associated to a component (TO.C attribute)
@ GBR_NETINFO_PAD
print info associated to a flashed pad (TO.P attribute)
void ClearExtraData()
Clear the extra data string printed at end of net attributes.
GBR_DATA_FIELD m_PadPinFunction
for a pad: the pin function (defined in schematic)
bool m_TryKeepPreviousAttributes
If true, do not clear all attributes when a attribute has changed.
wxString m_ExtraData
a string to print after TO object attributes, if not empty it is printed "as this"
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
GBR_DATA_FIELD m_Padname
for a flashed pad: the pad name ((TO.P attribute)
void SetExtraData(const wxString &aExtraData)
Set the extra data string printed at end of net attributes.
wxString m_Netname
for items associated to a net: the netname
void ClearAttribute(const wxString *aName)
Remove the net attribute specified by aName.