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 (C) 2016-2020 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
77 wxString FormatCmpPnPMetadata();
78
79
80 double m_Orientation; // orientation in degree
81 wxString m_Manufacturer; // Manufacturer name
82 wxString m_MPN; // Manufacturer part number
83 wxString m_Package; // Package, as per IPC-7351
84 wxString m_Footprint; // Footprint name, from library
85 wxString m_LibraryName; // Library name, containing the footprint
86 wxString m_LibraryDescr; // Library description
87 wxString m_Value; // Component value
88 MOUNT_TYPE m_MountType; // SMD|TH|Other
89};
90
100{
101public:
103 {}
104
105 void clear()
106 {
107 m_field.clear();
108 m_useUTF8 = false;
109 m_escapeString = false;
110 }
111
112 void Clear() { clear(); }
113
114 const wxString& GetValue() const { return m_field; }
115
116 void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString )
117 {
118 m_field = aField;
119 m_useUTF8 = aUseUTF8;
120 m_escapeString = aEscapeString;
121 }
122
123 bool IsEmpty() const { return m_field.IsEmpty(); }
124
125 std::string GetGerberString() const;
126
127private:
128 wxString m_field;
132};
133
134
149{
150public:
151 // This enum enables the different net attributes attached to the object
152 // the values can be ORed for items which can have more than one attribute
153 // (A flashed pad has all allowed attributes)
155 {
159 GBR_NETINFO_CMP = 4
160 };
161
163 m_NotInNet( false ), m_TryKeepPreviousAttributes( false )
164 {
165 }
166
171 {
172 m_ExtraData.Clear();
173 }
174
178 void SetExtraData( const wxString& aExtraData)
179 {
180 m_ExtraData = aExtraData;
181 }
182
190 void ClearAttribute( const wxString* aName )
191 {
193 {
196 m_Cmpref.clear();
197 m_Netname.clear();
198 return;
199 }
200
201 if( !aName || aName->IsEmpty() || *aName == wxT( ".CN" ) )
202 {
206 m_Cmpref.clear();
207 m_Netname.clear();
208 return;
209 }
210
211 if( *aName == wxT( ".C" ) )
212 {
213 m_NetAttribType &= ~GBR_NETINFO_CMP;
214 m_Cmpref.clear();
215 return;
216 }
217
218 if( *aName == wxT( ".N" ) )
219 {
220 m_NetAttribType &= ~GBR_NETINFO_NET;
221 m_Netname.clear();
222 return;
223 }
224
225 if( *aName == wxT( ".P" ) )
226 {
227 m_NetAttribType &= ~GBR_NETINFO_PAD;
230 return;
231 }
232 }
233
234 // these members are used in the %TO object attributes command.
242 wxString m_Cmpref;
243 wxString m_Netname;
244
245 wxString m_ExtraData;
247
254};
255
256
257// Flashed pads use the full attribute set: this is a helper for flashed pads
258#define GBR_NETINFO_ALL \
259 ( GBR_NETLIST_METADATA::GBR_NETINFO_PAD | GBR_NETLIST_METADATA::GBR_NETINFO_NET \
260 | GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
261
262#endif // GBR_NETLIST_METADATA_H
Information which can be added in a gerber P&P file as attribute of a component.
wxString FormatCmpPnPMetadata()
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.