KiCad PCB EDA Suite
gbr_metadata.cpp
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) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2019 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 
31 #include <fctsys.h>
32 #include <gbr_metadata.h>
33 #include <utf8.h>
34 
36 {
37  // creates the CreationDate attribute:
38  // The attribute value must conform to the full version of the ISO 8601
39  // date and time format, including time and time zone. Note that this is
40  // the date the Gerber file was effectively created,
41  // not the time the project of PCB was started
42  wxDateTime date( wxDateTime::GetTimeNow() );
43  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
44  wxString timezone_offset; // ISO 8601 offset from UTC in timezone
45  timezone_offset = date.Format( "%z" ); // Extract the time zone offset
46  // The time zone offset format is +mm or +hhmm (or -mm or -hhmm)
47  // (mm = number of minutes, hh = number of hours. 1h00mn is returned as +0100)
48  // we want +(or -) hh:mm
49  if( timezone_offset.Len() > 3 ) // format +hhmm or -hhmm found
50  // Add separator between hours and minutes
51  timezone_offset.insert( 3, ":", 1 );
52 
53  wxString msg;
54 
55  switch( aFormat )
56  {
58  msg.Printf( "%%TF.CreationDate,%s%s*%%", date.FormatISOCombined(), timezone_offset );
59  break;
60 
62  msg.Printf( "G04 #@! TF.CreationDate,%s%s*", date.FormatISOCombined(), timezone_offset );
63  break;
64 
66  msg.Printf( "\"CreationDate\": \"%s%s\"", date.FormatISOCombined(), timezone_offset );
67  break;
68 
70  msg.Printf( "; #@! TF.CreationDate,%s%s", date.FormatISOCombined(), timezone_offset );
71  break;
72  }
73  return msg;
74 }
75 
76 
77 wxString GbrMakeProjectGUIDfromString( wxString& aText )
78 {
79  /* Gerber GUID format should be RFC4122 Version 1 or 4.
80  * See en.wikipedia.org/wiki/Universally_unique_identifier
81  * The format is:
82  * xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
83  * with
84  * x = hexDigit lower/upper case
85  * and
86  * M = '1' or '4' (UUID version: 1 (basic) or 4 (random)) (we use 4: UUID random)
87  * and
88  * N = '8' or '9' or 'A|a' or 'B|b' : UUID variant 1: 2 MSB bits have meaning) (we use N = 9)
89  * N = 1000 or 1001 or 1010 or 1011 : 10xx means Variant 1 (Variant2: 110x and 111x are reserved)
90  */
91 
92  wxString guid;
93 
94  // Build a 32 digits GUID from the board name:
95  // guid has 32 digits, so add chars in name to be sure we can build a 32 digits guid
96  // (i.e. from a 16 char string name)
97  // In fact only 30 digits are used, and 2 UID id
98  wxString bname = aText;
99  int cnt = 16 - bname.Len();
100 
101  if( cnt > 0 )
102  bname.Append( 'X', cnt );
103 
104  int chr_idx = 0;
105 
106  // Output the 8 first hex digits:
107  for( unsigned ii = 0; ii < 4; ii++ )
108  {
109  int cc = int( bname[chr_idx++] ) & 0xFF;
110  guid << wxString::Format( "%2.2x", cc );
111  }
112 
113  // Output the 4 next hex digits:
114  guid << '-';
115 
116  for( unsigned ii = 0; ii < 2; ii++ )
117  {
118  int cc = int( bname[chr_idx++] ) & 0xFF;
119  guid << wxString::Format( "%2.2x", cc );
120  }
121 
122  // Output the 4 next hex digits (UUID version and 3 digits):
123  guid << "-4"; // first digit: UUID version 4 (M = 4)
124  {
125  int cc = int( bname[chr_idx++] ) << 4 & 0xFF0;
126  cc += int( bname[chr_idx] ) >> 4 & 0x0F;
127  guid << wxString::Format( "%3.3x", cc );
128  }
129 
130  // Output the 4 next hex digits (UUID variant and 3 digits):
131  guid << "-9"; // first digit: UUID variant 1 (N = 9)
132  {
133  int cc = (int( bname[chr_idx++] ) & 0x0F) << 8;
134  cc += int( bname[chr_idx++] ) & 0xFF;
135  guid << wxString::Format( "%3.3x", cc );
136  }
137 
138  // Output the 12 last hex digits:
139  guid << '-';
140 
141  for( unsigned ii = 0; ii < 6; ii++ )
142  {
143  int cc = int( bname[chr_idx++] ) & 0xFF;
144  guid << wxString::Format( "%2.2x", cc );
145  }
146 
147  return guid;
148 }
149 
150 
152  bool aUseX1StructuredComment )
153 {
154  std::string attribute_string; // the specific aperture attribute (TA.xxx)
155  std::string comment_string; // a optional G04 comment line to write before the TA. line
156 
157  // generate a string to print a Gerber Aperture attribute
158  switch( aAttribute )
159  {
160  case GBR_APERTURE_ATTRIB_END: // Dummy value (aAttribute must be < GBR_APERTURE_ATTRIB_END)
161  case GBR_APERTURE_ATTRIB_NONE: // idle command: do nothing
162  break;
163 
164  case GBR_APERTURE_ATTRIB_ETCHEDCMP: // print info associated to an item
165  // which connects 2 different nets
166  // (Net tees, microwave component)
167  attribute_string = "TA.AperFunction,EtchedComponent";
168  break;
169 
170  case GBR_APERTURE_ATTRIB_CONDUCTOR: // print info associated to a track
171  attribute_string = "TA.AperFunction,Conductor";
172  break;
173 
174  case GBR_APERTURE_ATTRIB_EDGECUT: // print info associated to a board outline
175  attribute_string = "TA.AperFunction,Profile";
176  break;
177 
178  case GBR_APERTURE_ATTRIB_VIAPAD: // print info associated to a flashed via
179  attribute_string = "TA.AperFunction,ViaPad";
180  break;
181 
182  case GBR_APERTURE_ATTRIB_NONCONDUCTOR: // print info associated to a item on a copper layer
183  // which is not a track (for instance a text)
184  attribute_string = "TA.AperFunction,NonConductor";
185  break;
186 
187  case GBR_APERTURE_ATTRIB_COMPONENTPAD: // print info associated to a flashed
188  // through hole component on outer layer
189  attribute_string = "TA.AperFunction,ComponentPad";
190  break;
191 
192  case GBR_APERTURE_ATTRIB_SMDPAD_SMDEF: // print info associated to a flashed for SMD pad.
193  // with solder mask defined from the copper shape
194  // Excluded BGA pads which have their own type
195  attribute_string = "TA.AperFunction,SMDPad,SMDef";
196  break;
197 
198  case GBR_APERTURE_ATTRIB_SMDPAD_CUDEF: // print info associated to a flashed SMD pad with
199  // a solder mask defined by the solder mask
200  attribute_string = "TA.AperFunction,SMDPad,CuDef";
201  break;
202 
203  case GBR_APERTURE_ATTRIB_BGAPAD_SMDEF: // print info associated to flashed BGA pads with
204  // a solder mask defined by the copper shape
205  attribute_string = "TA.AperFunction,BGAPad,SMDef";
206  break;
207 
208  case GBR_APERTURE_ATTRIB_BGAPAD_CUDEF: // print info associated to a flashed BGA pad with
209  // a solder mask defined by the solder mask
210  attribute_string = "TA.AperFunction,BGAPad,CuDef";
211  break;
212 
213  case GBR_APERTURE_ATTRIB_CONNECTORPAD: // print info associated to a flashed edge connector pad (outer layers)
214  attribute_string = "TA.AperFunction,ConnectorPad";
215  break;
216 
217  case GBR_APERTURE_ATTRIB_WASHERPAD: // print info associated to flashed mechanical pads (NPTH)
218  attribute_string = "TA.AperFunction,WasherPad";
219  break;
220 
221  case GBR_APERTURE_ATTRIB_HEATSINKPAD: // print info associated to a flashed heat sink pad
222  // (typically for SMDs)
223  attribute_string = "TA.AperFunction,HeatsinkPad";
224  break;
225 
226  case GBR_APERTURE_ATTRIB_VIADRILL: // print info associated to a via hole in drill files
227  attribute_string = "TA.AperFunction,ViaDrill";
228  break;
229 
230  case GBR_APERTURE_ATTRIB_CMP_DRILL: // print info associated to a component
231  // round pad hole in drill files
232  attribute_string = "TA.AperFunction,ComponentDrill";
233  break;
234 
235  // print info associated to a component oblong pad hole in drill files
236  // Same as a round pad hole, but is a specific aperture in drill file and
237  // a G04 comment is added to the aperture function
239  comment_string = "aperture for slot hole";
240  attribute_string = "TA.AperFunction,ComponentDrill";
241  break;
242 
243  case GBR_APERTURE_ATTRIB_CMP_POSITION: // print info associated to a component
244  // flashed shape at the component position
245  // in placement files
246  attribute_string = "TA.AperFunction,ComponentMain";
247  break;
248 
249  case GBR_APERTURE_ATTRIB_PAD1_POSITION: // print info associated to a component
250  // flashed shape at pad 1 position
251  // (pad 1 is also pad A1 or pad AA1)
252  // in placement files
253  attribute_string = "TA.AperFunction,ComponentPin";
254  break;
255 
256  case GBR_APERTURE_ATTRIB_PADOTHER_POSITION: // print info associated to a component
257  // flashed shape at pads position (all but pad 1)
258  // in placement files
259  // Currently: (could be changed later) same as
260  // GBR_APERTURE_ATTRIB_PADOTHER_POSITION
261  attribute_string = "TA.AperFunction,ComponentPin";
262  break;
263 
264  case GBR_APERTURE_ATTRIB_CMP_BODY: // print info associated to a component
265  // print the component physical body
266  // polygon in placement files
267  attribute_string = "TA.AperFunction,ComponentOutline,Body";
268  break;
269 
270  case GBR_APERTURE_ATTRIB_CMP_LEAD2LEAD: // print info associated to a component
271  // print the component physical lead to lead
272  // polygon in placement files
273  attribute_string = "TA.AperFunction,ComponentOutline,Lead2Lead";
274  break;
275 
276  case GBR_APERTURE_ATTRIB_CMP_FOOTPRINT: // print info associated to a component
277  // print the component footprint bounding box
278  // polygon in placement files
279  attribute_string = "TA.AperFunction,ComponentOutline,Footprint";
280  break;
281 
282  case GBR_APERTURE_ATTRIB_CMP_COURTYARD: // print info associated to a component
283  // print the component courtyard
284  // polygon in placement files
285  attribute_string = "TA.AperFunction,ComponentOutline,Courtyard";
286  break;
287 
288  break;
289  }
290 
291  std::string full_attribute_string;
292  wxString eol_string;
293 
294  if( !attribute_string.empty() )
295  {
296  if( !comment_string.empty() )
297  {
298  full_attribute_string = "G04 " + comment_string + "*\n";
299  }
300 
301  if( aUseX1StructuredComment )
302  {
303  full_attribute_string += "G04 #@! ";
304  eol_string = "*\n";
305  }
306  else
307  {
308  full_attribute_string += "%";
309  eol_string = "*%\n";
310  }
311  }
312 
313  full_attribute_string += attribute_string + eol_string;
314 
315  return full_attribute_string;
316 }
317 
318 
319 // Helper function to convert a ascii hex char to its integer value
320 // If the char is not a hexa char, return -1
321 int char2Hex( unsigned aCode )
322 {
323  if( aCode >= '0' && aCode <= '9' )
324  return aCode - '0';
325 
326  if( aCode >= 'A' && aCode <= 'F' )
327  return aCode - 'A' + 10;
328 
329  if( aCode >= 'a' && aCode <= 'f' )
330  return aCode - 'a' + 10;
331 
332  return -1;
333 }
334 
335 
336 wxString FormatStringFromGerber( const wxString& aString )
337 {
338  // make the inverse conversion of FormatStringToGerber()
339  // It converts a "normalized" gerber string containing escape sequences
340  // and convert it to a 16 bits unicode char
341  // and return a wxString (unicode 16) from the gerber string
342  // Note the initial gerber string can already contain unicode chars.
343  wxString txt; // The string converted from Gerber string
344 
345  unsigned count = aString.Length();
346 
347  for( unsigned ii = 0; ii < count; ++ii )
348  {
349  unsigned code = aString[ii];
350 
351  if( code == '\\' )
352  {
353  // If next char is not a hexadecimal char, just skip the '\'
354  // It is perhaps a escape sequence like \\ or \" or ...
355  if( ii < count-1 )
356  {
357  code = aString[ii+1];
358 
359  if( char2Hex( code ) < 0 )
360  {
361  ++ii;
362  txt.Append( aString[ii] );
363  continue;
364  }
365  }
366  // Convert 4 hexadecimal digits to a 16 bit unicode
367  // (Gerber allows only 4 hexadecimal digits)
368  long value = 0;
369 
370  for( int jj = 0; jj < 4; jj++ )
371  {
372  value <<= 4;
373  code = aString[++ii];
374  // Basic conversion (with no control), but it expects a valid gerber file
375  int hexa = char2Hex( code );
376  value += hexa;
377  }
378 
379  txt.Append( wxChar( value ) );
380  }
381  else
382  txt.Append( aString[ii] );
383  }
384 
385  return txt;
386 }
387 
388 
389 wxString ConvertNotAllowedCharsInGerber( const wxString& aString, bool aAllowUtf8Chars, bool aQuoteString )
390 {
391  /* format string means convert any code > 0x7E and unautorized codes to a hexadecimal
392  * 16 bits sequence unicode
393  * unautorized codes are ',' '*' '%' '\' and are used as separators in Gerber files
394  */
395  wxString txt;
396 
397  if( aQuoteString )
398  txt << "\"";
399 
400  for( unsigned ii = 0; ii < aString.Length(); ++ii )
401  {
402  wxChar code = aString[ii];
403  bool convert = false;
404 
405  switch( code )
406  {
407  case '\\':
408  case '%':
409  case '*':
410  case ',':
411  convert = true;
412  break;
413 
414  default:
415  break;
416  }
417 
418  if( !aAllowUtf8Chars && code > 0x7F )
419  convert = true;
420 
421  if( convert )
422  {
423  txt += '\\';
424 
425  // Convert code to 4 hexadecimal digit
426  // (Gerber allows only 4 hexadecimal digit)
427  char hexa[32];
428  sprintf( hexa,"%4.4X", code & 0xFFFF);
429  txt += hexa;
430  }
431  else
432  txt += code;
433  }
434 
435  if( aQuoteString )
436  txt << "\"";
437 
438  return txt;
439 }
440 
441 
442 std::string FormatStringToGerber( const wxString& aString )
443 {
444  wxString converted;
445  /* format string means convert any code > 0x7E and unautorized codes to a hexadecimal
446  * 16 bits sequence unicode
447  * unautorized codes are ',' '*' '%' '\'
448  * This conversion is not made for quoted strings, because if the string is
449  * quoted, the conversion is expected to be already made, and the returned string must use
450  * UTF8 encoding
451  */
452  if( aString[0] != '\"' || aString[aString.Len()-1] != '\"' )
453  converted = ConvertNotAllowedCharsInGerber( aString, false, false );
454  else
455  converted = aString;
456 
457  // Convert the char string to std::string. Be carefull when converting awxString to
458  // a std::string: using static_cast<const char*> is mandatory
459  std::string txt = static_cast<const char*>( converted.utf8_str() );
460 
461  return txt;
462 }
463 
464 // Netname and Pan num fields cannot be empty in Gerber files
465 // Normalized names must be used, if any
466 #define NO_NET_NAME wxT( "N/C" ) // net name of not connected pads (one pad net) (normalized)
467 #define NO_PAD_NAME wxT( "" ) // pad name of pads without pad name/number (not normalized)
468 
469 bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttributes,
470  GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes,
471  bool aUseX1StructuredComment )
472 {
473  aClearPreviousAttributes = false;
474  wxString prepend_string;
475  wxString eol_string;
476 
477  if( aUseX1StructuredComment )
478  {
479  prepend_string = "G04 #@! ";
480  eol_string = "*\n";
481  }
482  else
483  {
484  prepend_string = "%";
485  eol_string = "*%\n";
486  }
487 
488  // print a Gerber net attribute record.
489  // it is added to the object attributes dictionary
490  // On file, only modified or new attributes are printed.
491  if( aData == NULL )
492  return false;
493 
494  std::string pad_attribute_string;
495  std::string net_attribute_string;
496  std::string cmp_attribute_string;
497 
499  return false; // idle command: do nothing
500 
502  {
503  // print info associated to a flashed pad (cmpref, pad name)
504  // example: %TO.P,R5,3*%
505  pad_attribute_string = prepend_string + "TO.P,";
506  pad_attribute_string += FormatStringToGerber( aData->m_Cmpref ) + ",";
507 
508  if( aData->m_Padname.IsEmpty() )
509  // Happens for "mechanical" or never connected pads
510  pad_attribute_string += FormatStringToGerber( NO_PAD_NAME );
511  else
512  pad_attribute_string += FormatStringToGerber( aData->m_Padname );
513 
514  pad_attribute_string += eol_string;
515  }
516 
518  {
519  // print info associated to a net
520  // example: %TO.N,Clk3*%
521  net_attribute_string = prepend_string + "TO.N,";
522 
523  if( aData->m_Netname.IsEmpty() )
524  {
525  if( aData->m_NotInNet )
526  {
527  // Happens for not connectable pads: mechanical pads
528  // and pads with no padname/num
529  // In this case the net name must be left empty
530  }
531  else
532  {
533  // Happens for not connected pads: use a normalized
534  // dummy name
535  net_attribute_string += FormatStringToGerber( NO_NET_NAME );
536  }
537  }
538  else
539  net_attribute_string += FormatStringToGerber( aData->m_Netname );
540 
541  net_attribute_string += eol_string;
542  }
543 
546  {
547  // print info associated to a footprint
548  // example: %TO.C,R2*%
549  // Because GBR_NETINFO_PAD option already contains this info, it is not
550  // created here for a GBR_NETINFO_PAD attribute
551  cmp_attribute_string = prepend_string + "TO.C,";
552  cmp_attribute_string += FormatStringToGerber( aData->m_Cmpref ) + eol_string;
553  }
554 
555  // the full list of requested attributes:
556  std::string full_attribute_string = pad_attribute_string + net_attribute_string
557  + cmp_attribute_string;
558  // the short list of requested attributes
559  // (only modified or new attributes are stored here):
560  std::string short_attribute_string;
561 
562  // Attributes have changed: update attribute string, and see if the previous attribute
563  // list (dictionary in Gerber language) must be cleared
564  if( aLastNetAttributes != full_attribute_string )
565  {
566  // first, remove no longer existing attributes.
567  // Because in Kicad the full attribute list is evaluated for each object,
568  // the entire dictionary is cleared
569  // If m_TryKeepPreviousAttributes is true, only the no longer existing attribute
570  // is cleared.
571  // Note: to avoid interaction beteween clear attributes and set attributes
572  // the clear attribute is inserted first.
573  bool clearDict = false;
574 
575  if( aLastNetAttributes.find( "TO.P," ) != std::string::npos )
576  {
577  if( pad_attribute_string.empty() ) // No more this attribute
578  {
579  if( aData->m_TryKeepPreviousAttributes ) // Clear only this attribute
580  short_attribute_string.insert( 0, prepend_string + "TO.P" + eol_string );
581  else
582  clearDict = true;
583  }
584  else if( aLastNetAttributes.find( pad_attribute_string )
585  == std::string::npos ) // This attribute has changed
586  short_attribute_string += pad_attribute_string;
587  }
588  else // New attribute
589  short_attribute_string += pad_attribute_string;
590 
591  if( aLastNetAttributes.find( "TO.N," ) != std::string::npos )
592  {
593  if( net_attribute_string.empty() ) // No more this attribute
594  {
595  if( aData->m_TryKeepPreviousAttributes ) // Clear only this attribute
596  short_attribute_string.insert( 0, prepend_string + "TO.N" + eol_string );
597  else
598  clearDict = true;
599  }
600  else if( aLastNetAttributes.find( net_attribute_string )
601  == std::string::npos ) // This attribute has changed
602  short_attribute_string += net_attribute_string;
603  }
604  else // New attribute
605  short_attribute_string += net_attribute_string;
606 
607  if( aLastNetAttributes.find( "TO.C," ) != std::string::npos )
608  {
609  if( cmp_attribute_string.empty() ) // No more this attribute
610  {
611  if( aData->m_TryKeepPreviousAttributes ) // Clear only this attribute
612  {
613  // Refinement:
614  // the attribute will be cleared only if there is no pad attribute.
615  // If a pad attribute exists, the component name exists so the old
616  // TO.C value will be updated, therefore no need to clear it before updating
617  if( pad_attribute_string.empty() )
618  short_attribute_string.insert( 0, prepend_string + "TO.C" + eol_string );
619  }
620  else
621  clearDict = true;
622  }
623  else if( aLastNetAttributes.find( cmp_attribute_string )
624  == std::string::npos ) // This attribute has changed
625  short_attribute_string += cmp_attribute_string;
626  }
627  else // New attribute
628  short_attribute_string += cmp_attribute_string;
629 
630  aClearPreviousAttributes = clearDict;
631 
632  aLastNetAttributes = full_attribute_string;
633 
634  if( clearDict )
635  aPrintedText = full_attribute_string;
636  else
637  aPrintedText = short_attribute_string;
638  }
639 
640  return true;
641 }
642 
643 
644 /************ class GBR_CMP_PNP_METADATA *************/
645 
647 {
648  // Clear all strings
649  m_Orientation = 0.0;
650  m_Manufacturer.Clear();
651  m_MPN.Clear();
652  m_Package.Clear();
653  m_Value.Clear();
655 }
662 {
663  wxString text;
664  wxString start_of_line( "%TO.");
665  wxString end_of_line( "*%\n" );
666 
667  wxString mounType[] =
668  {
669  "Other", "SMD", "BGA", "TH"
670  };
671 
672  if( !m_Manufacturer.IsEmpty() )
673  text << start_of_line << "CMfr," << m_Manufacturer << end_of_line;
674 
675  if( !m_MPN.IsEmpty() )
676  text << start_of_line << "CMPN," << m_MPN << end_of_line;
677 
678  if( !m_Package.IsEmpty() )
679  text << start_of_line << "Cpkg," << m_Package << end_of_line;
680 
681  if( !m_Footprint.IsEmpty() )
682  text << start_of_line << "CFtp," << m_Footprint << end_of_line;
683 
684  if( !m_Value.IsEmpty() )
685  text << start_of_line << "CVal," << m_Value << end_of_line;
686 
687  if( !m_LibraryName.IsEmpty() )
688  text << start_of_line << "CLbN," << m_LibraryName << end_of_line;
689 
690  if( !m_LibraryDescr.IsEmpty() )
691  text << start_of_line << "CLbD," << m_LibraryDescr << end_of_line;
692 
693  text << start_of_line << "CMnt," << mounType[m_MountType] << end_of_line;
694  text << start_of_line << "CRot," << m_Orientation << end_of_line;
695 
696  return text;
697 }
std::string FormatStringToGerber(const wxString &aString)
This helper function "normalize" aString and convert it to a Gerber std::string Normalisation means c...
a class to handle special data (items attributes) during plot.
aperture used for etched components
Definition: gbr_metadata.h:83
aperture used to draw component footprint bounding box in placement files
Definition: gbr_metadata.h:106
#define NO_NET_NAME
aperture used for edge connecto pad (outer layers)
Definition: gbr_metadata.h:93
aperture used for flashed pin 1 (or A1 or AA1) position in placement files
Definition: gbr_metadata.h:100
aperture used for pads oblong holes in drill files
Definition: gbr_metadata.h:98
aperture used for heat sink pad (typically for SMDs)
Definition: gbr_metadata.h:95
aperture used for flashed pads position in placement files
Definition: gbr_metadata.h:101
print info associated to a component (TO.C attribute)
int char2Hex(unsigned aCode)
wxString m_Cmpref
the component reference parent of the data
aperture used for through hole component on outer layer
Definition: gbr_metadata.h:88
aperture used for via holes in drill files
Definition: gbr_metadata.h:96
wxString GbrMakeCreationDateAttributeString(GBR_NC_STRING_FORMAT aFormat)
bool FormatNetAttribute(std::string &aPrintedText, std::string &aLastNetAttributes, GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes, bool aUseX1StructuredComment)
Generates the string to print to a gerber file, to set a net attribute for a graphic object.
this class handle info which can be added in a gerber file as attribute of an object the GBR_INFO_TYP...
aperture used for SMD pad. Excluded BGA pads which have their own type
Definition: gbr_metadata.h:89
aperture used for BGA pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:92
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
wxString GbrMakeProjectGUIDfromString(wxString &aText)
A helper function to build a project GUID using format RFC4122 Version 1 or 4 from the project name,...
#define NO_PAD_NAME
aperture used for pad holes in drill files
Definition: gbr_metadata.h:97
wxString m_Netname
for items associated to a net: the netname
aperture used for mechanical pads (NPTH)
Definition: gbr_metadata.h:94
aperture used to draw component outline courtyard in placement files
Definition: gbr_metadata.h:108
aperture used for BGA pads with a solder mask defined by the copper shape
Definition: gbr_metadata.h:91
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
aperture used to draw component physical body outline (without pins) in placement files
Definition: gbr_metadata.h:102
static std::string FormatAttribute(GBR_APERTURE_ATTRIB aAttribute, bool aUseX1StructuredComment)
aperture used for flashed cmp position in placement files
Definition: gbr_metadata.h:99
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString FormatCmpPnPMetadata()
aperture used for SMD pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:90
bool m_TryKeepPreviousAttributes
If true, do not clear all attributes when a atribute has changed Usefull when some attributes need to...
wxString ConvertNotAllowedCharsInGerber(const wxString &aString, bool aAllowUtf8Chars, bool aQuoteString)
Similar to FormatStringToGerber.
print info associated to a flashed pad (TO.P attribute)
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
wxString FormatStringFromGerber(const wxString &aString)
This helper function make the inverse conversion of FormatStringToGerber() It converts a "normalized"...
aperture used for not connected items (texts, outlines on copper)
Definition: gbr_metadata.h:86
print info associated to a net (TO.N attribute)
GBR_NC_STRING_FORMAT
creates the TF.CreationDate attribute: The attribute value must conform to the full version of the IS...
Definition: gbr_metadata.h:51
aperture used to draw component physical body outline (with pins) in placement files
Definition: gbr_metadata.h:104
int m_NetAttribType
the type of net info (used to define the gerber string to create)