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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef GBR_NETLIST_METADATA_H
22#define GBR_NETLIST_METADATA_H
23
54{
55public:
62
67
68 void ClearData(); // Clear all strings
69
76 wxString FormatCmpPnPMetadata();
77
78
79 double m_Orientation; // orientation in degree
80 wxString m_Manufacturer; // Manufacturer name
81 wxString m_MPN; // Manufacturer part number
82 wxString m_Package; // Package, as per IPC-7351
83 wxString m_Footprint; // Footprint name, from library
84 wxString m_LibraryName; // Library name, containing the footprint
85 wxString m_LibraryDescr; // Library description
86 wxString m_Value; // Component value
87 MOUNT_TYPE m_MountType; // SMD|TH|Other
88};
89
99{
100public:
102 {}
103
104 void clear()
105 {
106 m_field.clear();
107 m_useUTF8 = false;
108 m_escapeString = false;
109 }
110
111 void Clear() { clear(); }
112
113 const wxString& GetValue() const { return m_field; }
114
115 void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString )
116 {
117 m_field = aField;
118 m_useUTF8 = aUseUTF8;
119 m_escapeString = aEscapeString;
120 }
121
122 bool IsEmpty() const { return m_field.IsEmpty(); }
123
124 std::string GetGerberString() const;
125
126private:
127 wxString m_field;
131};
132
133
148{
149public:
150 // This enum enables the different net attributes attached to the object
151 // the values can be ORed for items which can have more than one attribute
152 // (A flashed pad has all allowed attributes)
160
165
170 {
171 m_ExtraData.Clear();
172 }
173
177 void SetExtraData( const wxString& aExtraData)
178 {
179 m_ExtraData = aExtraData;
180 }
181
189 void ClearAttribute( const wxString* aName )
190 {
192 {
193 m_Padname.clear();
194 m_PadPinFunction.clear();
195 m_Cmpref.clear();
196 m_Netname.clear();
197 return;
198 }
199
200 if( !aName || aName->IsEmpty() || *aName == wxT( ".CN" ) )
201 {
203 m_Padname.clear();
204 m_PadPinFunction.clear();
205 m_Cmpref.clear();
206 m_Netname.clear();
207 return;
208 }
209
210 if( *aName == wxT( ".C" ) )
211 {
213 m_Cmpref.clear();
214 return;
215 }
216
217 if( *aName == wxT( ".N" ) )
218 {
220 m_Netname.clear();
221 return;
222 }
223
224 if( *aName == wxT( ".P" ) )
225 {
227 m_Padname.clear();
228 m_PadPinFunction.clear();
229 return;
230 }
231 }
232
233 // these members are used in the %TO object attributes command.
241 wxString m_Cmpref;
242 wxString m_Netname;
243
244 wxString m_ExtraData;
246
253};
254
255
256// Flashed pads use the full attribute set: this is a helper for flashed pads
257#define GBR_NETINFO_ALL \
258 ( GBR_NETLIST_METADATA::GBR_NETINFO_PAD | GBR_NETLIST_METADATA::GBR_NETINFO_NET \
259 | GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
260
261#endif // GBR_NETLIST_METADATA_H
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
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.