KiCad PCB EDA Suite
Loading...
Searching...
No Matches
netlist_exporter_xml.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) 1992-2013 jp.charras at wanadoo.fr
5 * Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
27
28#include <build_version.h>
29#include <common.h> // for ExpandTextVars
30#include <sch_base_frame.h>
31#include <sch_group.h>
32#include <symbol_library.h>
33#include <string_utils.h>
34#include <connection_graph.h>
35#include <core/kicad_algo.h>
36#include <wx/wfstream.h>
37#include <xnode.h> // also nests: <wx/xml/xml.h>
38#include <json_common.h>
39#include <project_sch.h>
40
41#include <symbol_lib_table.h>
42
43#include <set>
44
45static bool sortPinsByNumber( SCH_PIN* aPin1, SCH_PIN* aPin2 );
46
47bool NETLIST_EXPORTER_XML::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions,
48 REPORTER& aReporter )
49{
50 // output the XML format netlist.
51
52 // declare the stream ourselves to use the buffered FILE api
53 // instead of letting wx use the syscall variant
54 wxFFileOutputStream stream( aOutFileName );
55
56 if( !stream.IsOk() )
57 return false;
58
59 wxXmlDocument xdoc;
60 xdoc.SetRoot( makeRoot( GNL_ALL | aNetlistOptions ) );
61
62 return xdoc.Save( stream, 2 /* indent bug, today was ignored by wxXml lib */ );
63}
64
65
67{
68 XNODE* xroot = node( wxT( "export" ) );
69
70 xroot->AddAttribute( wxT( "version" ), wxT( "E" ) );
71
72 if( aCtl & GNL_HEADER )
73 // add the "design" header
74 xroot->AddChild( makeDesignHeader() );
75
76 if( aCtl & GNL_SYMBOLS )
77 {
78 xroot->AddChild( makeSymbols( aCtl ) );
79
80 if( aCtl & GNL_OPT_KICAD )
81 xroot->AddChild( makeGroups() );
82 }
83
84 if( aCtl & GNL_PARTS )
85 xroot->AddChild( makeLibParts() );
86
87 if( aCtl & GNL_LIBRARIES )
88 // must follow makeGenericLibParts()
89 xroot->AddChild( makeLibraries() );
90
91 if( aCtl & GNL_NETS )
92 xroot->AddChild( makeListOfNets( aCtl ) );
93
94 return xroot;
95}
96
97
99
100
102 const SCH_SHEET_PATH& aSheet,
103 const SCH_SHEET_LIST& aSheetList )
104{
105 wxString value;
106 wxString footprint;
107 wxString datasheet;
108 wxString description;
109 wxString candidate;
110 nlohmann::ordered_map<wxString, wxString> fields;
111
112 if( aSymbol->GetUnitCount() > 1 )
113 {
114 // Sadly, each unit of a symbol can have its own unique fields. This
115 // block finds the unit with the lowest number having a non blank field
116 // value and records it. Therefore user is best off setting fields
117 // into only the first unit. But this scavenger algorithm will find
118 // any non blank fields in all units and use the first non-blank field
119 // for each unique field name.
120
121 wxString ref = aSymbol->GetRef( &aSheet );
122
123 int minUnit = aSymbol->GetUnitSelection( &aSheet );
124
125 for( const SCH_SHEET_PATH& sheet : aSheetList )
126 {
127 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
128 {
129 SCH_SYMBOL* symbol2 = static_cast<SCH_SYMBOL*>( item );
130
131 wxString ref2 = symbol2->GetRef( &sheet );
132
133 if( ref2.CmpNoCase( ref ) != 0 )
134 continue;
135
136 int unit = symbol2->GetUnitSelection( &aSheet );
137
138 // The lowest unit number wins. User should only set fields in any one unit.
139
140 // Value
141 candidate = symbol2->GetValue( m_resolveTextVars, &sheet, false );
142
143 if( !candidate.IsEmpty() && ( unit < minUnit || value.IsEmpty() ) )
144 value = candidate;
145
146 // Footprint
147 candidate = symbol2->GetFootprintFieldText( m_resolveTextVars, &sheet, false );
148
149 if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
150 footprint = candidate;
151
152 // Datasheet
153 candidate = m_resolveTextVars
154 ? symbol2->GetField( FIELD_T::DATASHEET )->GetShownText( &sheet, false )
155 : symbol2->GetField( FIELD_T::DATASHEET )->GetText();
156
157 if( !candidate.IsEmpty() && ( unit < minUnit || datasheet.IsEmpty() ) )
158 datasheet = candidate;
159
160 // Description
161 candidate = m_resolveTextVars
162 ? symbol2->GetField( FIELD_T::DESCRIPTION )->GetShownText( &sheet, false )
163 : symbol2->GetField( FIELD_T::DESCRIPTION )->GetText();
164
165 if( !candidate.IsEmpty() && ( unit < minUnit || description.IsEmpty() ) )
166 description = candidate;
167
168 // All non-mandatory fields
169 for( SCH_FIELD& field : symbol2->GetFields() )
170 {
171 if( field.IsMandatory() || field.IsPrivate() )
172 continue;
173
174 if( unit < minUnit || fields.count( field.GetName() ) == 0 )
175 {
177 fields[field.GetName()] = field.GetShownText( &aSheet, false );
178 else
179 fields[field.GetName()] = field.GetText();
180 }
181 }
182
183 minUnit = std::min( unit, minUnit );
184 }
185 }
186 }
187 else
188 {
189 value = aSymbol->GetValue( m_resolveTextVars, &aSheet, false );
190 footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars, &aSheet, false );
191
192 SCH_FIELD* datasheetField = aSymbol->GetField( FIELD_T::DATASHEET );
193 SCH_FIELD* descriptionField = aSymbol->GetField( FIELD_T::DESCRIPTION );
194
195 // Datasheet
197 datasheet = datasheetField->GetShownText( &aSheet, false );
198 else
199 datasheet = datasheetField->GetText();
200
201 // Description
203 description = descriptionField->GetShownText( &aSheet, false );
204 else
205 description = descriptionField->GetText();
206
207 for( SCH_FIELD& field : aSymbol->GetFields() )
208 {
209 if( field.IsMandatory() || field.IsPrivate() )
210 continue;
211
213 fields[field.GetName()] = field.GetShownText( &aSheet, false );
214 else
215 fields[field.GetName()] = field.GetText();
216 }
217 }
218
219 fields[GetCanonicalFieldName( FIELD_T::FOOTPRINT )] = footprint;
221 fields[GetCanonicalFieldName( FIELD_T::DESCRIPTION )] = description;
222
223 // Do not output field values blank in netlist:
224 if( value.size() )
225 aNode->AddChild( node( wxT( "value" ), UnescapeString( value ) ) );
226 else // value field always written in netlist
227 aNode->AddChild( node( wxT( "value" ), wxT( "~" ) ) );
228
229 if( footprint.size() )
230 aNode->AddChild( node( wxT( "footprint" ), UnescapeString( footprint ) ) );
231
232 if( datasheet.size() )
233 aNode->AddChild( node( wxT( "datasheet" ), UnescapeString( datasheet ) ) );
234
235 if( description.size() )
236 aNode->AddChild( node( wxT( "description" ), UnescapeString( description ) ) );
237
238 XNODE* xfields;
239 aNode->AddChild( xfields = node( wxT( "fields" ) ) );
240
241 for( const auto& [ fieldName, fieldValue ] : fields )
242 {
243 XNODE* xfield = node( wxT( "field" ), UnescapeString( fieldValue ) );
244 xfield->AddAttribute( wxT( "name" ), UnescapeString( fieldName ) );
245 xfields->AddChild( xfield );
246 }
247}
248
249
251{
252 XNODE* xcomps = node( wxT( "components" ) );
253
255 m_libParts.clear();
256
257 SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
258 SCH_SHEET_LIST sheetList = m_schematic->Hierarchy();
259
260 // Output is xml, so there is no reason to remove spaces from the field values.
261 // And XML element names need not be translated to various languages.
262
263 for( const SCH_SHEET_PATH& sheet : sheetList )
264 {
265 // Change schematic CurrentSheet in each iteration to allow hierarchical
266 // resolution of text variables in sheet fields.
267 m_schematic->SetCurrentSheet( sheet );
268
269 auto cmp =
270 [&sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
271 {
272 return ( StrNumCmp( a->GetRef( &sheet, false ),
273 b->GetRef( &sheet, false ), true ) < 0 );
274 };
275
276 std::set<SCH_SYMBOL*, decltype( cmp )> ordered_symbols( cmp );
277 std::multiset<SCH_SYMBOL*, decltype( cmp )> extra_units( cmp );
278
279 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
280 {
281 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
282 auto test = ordered_symbols.insert( symbol );
283
284 if( !test.second )
285 {
286 if( ( *( test.first ) )->m_Uuid > symbol->m_Uuid )
287 {
288 extra_units.insert( *( test.first ) );
289 ordered_symbols.erase( test.first );
290 ordered_symbols.insert( symbol );
291 }
292 else
293 {
294 extra_units.insert( symbol );
295 }
296 }
297 }
298
299 for( EDA_ITEM* item : ordered_symbols )
300 {
301 SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
302 bool forBOM = aCtl & GNL_OPT_BOM;
303 bool forBoard = aCtl & GNL_OPT_KICAD;
304
305 if( !symbol )
306 continue;
307
308 if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->ResolveExcludedFromBOM() ) )
309 continue;
310
311 if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->ResolveExcludedFromBoard() ) )
312 continue;
313
314 // Output the symbol's elements in order of expected access frequency. This may
315 // not always look best, but it will allow faster execution under XSL processing
316 // systems which do sequential searching within an element.
317
318 XNODE* xcomp; // current symbol being constructed
319 xcomps->AddChild( xcomp = node( wxT( "comp" ) ) );
320
321 xcomp->AddAttribute( wxT( "ref" ), symbol->GetRef( &sheet ) );
322 addSymbolFields( xcomp, symbol, sheet, sheetList );
323
324 XNODE* xlibsource;
325 xcomp->AddChild( xlibsource = node( wxT( "libsource" ) ) );
326
327 // "logical" library name, which is in anticipation of a better search algorithm
328 // for parts based on "logical_lib.part" and where logical_lib is merely the library
329 // name minus path and extension.
330 wxString libName;
331 wxString partName;
332
333 if( symbol->UseLibIdLookup() )
334 {
335 libName = symbol->GetLibId().GetUniStringLibNickname();
336 partName = symbol->GetLibId().GetUniStringLibItemName();
337 }
338 else
339 {
340 partName = symbol->GetSchSymbolLibraryName();
341 }
342
343 xlibsource->AddAttribute( wxT( "lib" ), libName );
344
345 // We only want the symbol name, not the full LIB_ID.
346 xlibsource->AddAttribute( wxT( "part" ), partName );
347
348 xlibsource->AddAttribute( wxT( "description" ), symbol->GetDescription() );
349
350 /* Add the symbol properties. */
351 XNODE* xproperty;
352
353 std::vector<SCH_FIELD>& fields = symbol->GetFields();
354
355 for( SCH_FIELD& field : fields )
356 {
357 if( field.IsMandatory() || field.IsPrivate() )
358 continue;
359
360 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
361 xproperty->AddAttribute( wxT( "name" ), field.GetCanonicalName() );
362
364 xproperty->AddAttribute( wxT( "value" ), field.GetShownText( &sheet, false ) );
365 else
366 xproperty->AddAttribute( wxT( "value" ), field.GetText() );
367 }
368
369 for( const SCH_FIELD& sheetField : sheet.Last()->GetFields() )
370 {
371 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
372 xproperty->AddAttribute( wxT( "name" ), sheetField.GetCanonicalName() );
373
375 // do not allow GetShownText() to add any prefix useful only when displaying
376 // the field on screen
377 xproperty->AddAttribute( wxT( "value" ), sheetField.GetShownText( &sheet, false ) );
378 else
379 xproperty->AddAttribute( wxT( "value" ), sheetField.GetText() );
380 }
381
382 if( symbol->ResolveExcludedFromBOM() || sheet.GetExcludedFromBOM() )
383 {
384 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
385 xproperty->AddAttribute( wxT( "name" ), wxT( "exclude_from_bom" ) );
386 }
387
388 if( symbol->ResolveExcludedFromBoard() || sheet.GetExcludedFromBoard() )
389 {
390 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
391 xproperty->AddAttribute( wxT( "name" ), wxT( "exclude_from_board" ) );
392 }
393
394 if( symbol->ResolveDNP() || sheet.GetDNP() )
395 {
396 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
397 xproperty->AddAttribute( wxT( "name" ), wxT( "dnp" ) );
398 }
399
400 if( const std::unique_ptr<LIB_SYMBOL>& part = symbol->GetLibSymbolRef() )
401 {
402 if( part->GetKeyWords().size() )
403 {
404 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
405 xproperty->AddAttribute( wxT( "name" ), wxT( "ki_keywords" ) );
406 xproperty->AddAttribute( wxT( "value" ), part->GetKeyWords() );
407 }
408
409 if( !part->GetFPFilters().IsEmpty() )
410 {
411 wxString filters;
412
413 for( const wxString& filter : part->GetFPFilters() )
414 filters += ' ' + filter;
415
416 xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
417 xproperty->AddAttribute( wxT( "name" ), wxT( "ki_fp_filters" ) );
418 xproperty->AddAttribute( wxT( "value" ), filters.Trim( false ) );
419 }
420
421 if( part->GetDuplicatePinNumbersAreJumpers() )
422 xcomp->AddChild( node( wxT( "duplicate_pin_numbers_are_jumpers" ), wxT( "1" ) ) );
423
424 const std::vector<std::set<wxString>>& jumperGroups = part->JumperPinGroups();
425
426 if( !jumperGroups.empty() )
427 {
428 XNODE* groupNode;
429 xcomp->AddChild( xproperty = node( wxT( "jumper_pin_groups" ) ) );
430
431 for( const std::set<wxString>& group : jumperGroups )
432 {
433 xproperty->AddChild( groupNode = node( wxT( "group" ) ) );
434
435 for( const wxString& padName : group )
436 groupNode->AddAttribute( wxT( "pin" ), padName );
437 }
438 }
439 }
440
441 XNODE* xsheetpath;
442 xcomp->AddChild( xsheetpath = node( wxT( "sheetpath" ) ) );
443
444 xsheetpath->AddAttribute( wxT( "names" ), sheet.PathHumanReadable() );
445 xsheetpath->AddAttribute( wxT( "tstamps" ), sheet.PathAsString() );
446
447 // Node for component class
448 std::vector<wxString> compClassNames =
449 getComponentClassNamesForAllSymbolUnits( symbol, sheet, sheetList );
450
451 if( compClassNames.size() > 0 )
452 {
453 XNODE* xcompclasslist;
454 xcomp->AddChild( xcompclasslist = node( wxT( "component_classes" ) ) );
455
456 for( const wxString& compClass : compClassNames )
457 {
458 xcompclasslist->AddChild( node( wxT( "class" ), UnescapeString( compClass ) ) );
459 }
460 }
461
462 XNODE* xunits; // Node for extra units
463 xcomp->AddChild( xunits = node( wxT( "tstamps" ) ) );
464
465 auto range = extra_units.equal_range( symbol );
466 wxString uuid;
467
468 // Output a series of children with all UUIDs associated with the REFDES
469 for( auto it = range.first; it != range.second; ++it )
470 {
471 uuid = ( *it )->m_Uuid.AsString();
472
473 // Add a space between UUIDs, if not in KICAD mode (i.e.
474 // using wxXmlDocument::Save()). KICAD MODE has its own XNODE::Format function.
475 if( !( aCtl & GNL_OPT_KICAD ) ) // i.e. for .xml format
476 uuid += ' ';
477
478 xunits->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
479 }
480
481 // Output the primary UUID
482 uuid = symbol->m_Uuid.AsString();
483 xunits->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
484 }
485 }
486
487 m_schematic->SetCurrentSheet( currentSheet );
488
489 return xcomps;
490}
491
492
494{
495 XNODE* xcomps = node( wxT( "groups" ) );
496
498 // Do not clear m_libParts here: it is populated in makeSymbols() and used later by
499 // makeLibParts() to emit the libparts section for CvPcb and other consumers.
500
501 SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
502 SCH_SHEET_LIST sheetList = m_schematic->Hierarchy();
503
504 for( const SCH_SHEET_PATH& sheet : sheetList )
505 {
506 // Change schematic CurrentSheet in each iteration to allow hierarchical
507 // resolution of text variables in sheet fields.
508 m_schematic->SetCurrentSheet( sheet );
509
510 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GROUP_T ) )
511 {
512 SCH_GROUP* group = static_cast<SCH_GROUP*>( item );
513
514 XNODE* xgroup; // current symbol being constructed
515 xcomps->AddChild( xgroup = node( wxT( "group" ) ) );
516
517 xgroup->AddAttribute( wxT( "name" ), group->GetName() );
518 xgroup->AddAttribute( wxT( "uuid" ), group->m_Uuid.AsString() );
519 xgroup->AddAttribute( wxT( "lib_id" ), group->GetDesignBlockLibId().Format() );
520
521 XNODE* xmembers;
522 xgroup->AddChild( xmembers = node( wxT( "members" ) ) );
523
524 for( EDA_ITEM* member : group->GetItems() )
525 {
526 if( member->Type() == SCH_SYMBOL_T )
527 {
528 XNODE* xmember;
529 xmembers->AddChild( xmember = node( wxT( "member" ) ) );
530 xmember->AddAttribute( wxT( "uuid" ), member->m_Uuid.AsString() );
531 }
532 }
533 }
534 }
535
536 m_schematic->SetCurrentSheet( currentSheet );
537
538 return xcomps;
539}
540
541
543 SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSymbolSheet, const SCH_SHEET_LIST& aSheetList )
544{
545 std::unordered_set<wxString> compClassNames = aSymbol->GetComponentClassNames( &aSymbolSheet );
546 int primaryUnit = aSymbol->GetUnitSelection( &aSymbolSheet );
547
548 if( aSymbol->GetUnitCount() > 1 )
549 {
550 wxString ref = aSymbol->GetRef( &aSymbolSheet );
551
552 for( const SCH_SHEET_PATH& sheet : aSheetList )
553 {
554 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
555 {
556 SCH_SYMBOL* symbol2 = static_cast<SCH_SYMBOL*>( item );
557
558 wxString ref2 = symbol2->GetRef( &sheet );
559 int otherUnit = symbol2->GetUnitSelection( &sheet );
560
561 if( ref2.CmpNoCase( ref ) != 0 )
562 continue;
563
564 if( otherUnit == primaryUnit )
565 continue;
566
567 std::unordered_set<wxString> otherClassNames =
568 symbol2->GetComponentClassNames( &sheet );
569 compClassNames.insert( otherClassNames.begin(), otherClassNames.end() );
570 }
571 }
572 }
573
574 std::vector<wxString> sortedCompClassNames( compClassNames.begin(), compClassNames.end() );
575 std::sort( sortedCompClassNames.begin(), sortedCompClassNames.end(),
576 []( const wxString& str1, const wxString& str2 )
577 {
578 return str1.Cmp( str2 ) < 0;
579 } );
580
581 return sortedCompClassNames;
582}
583
584
586{
587 SCH_SCREEN* screen;
588 XNODE* xdesign = node( wxT( "design" ) );
589 XNODE* xtitleBlock;
590 XNODE* xsheet;
591 XNODE* xcomment;
592 XNODE* xtextvar;
593 wxString sheetTxt;
594 wxFileName sourceFileName;
595
596 // the root sheet is a special sheet, call it source
597 xdesign->AddChild( node( wxT( "source" ), m_schematic->GetFileName() ) );
598
599 xdesign->AddChild( node( wxT( "date" ), GetISO8601CurrentDateTime() ) );
600
601 // which Eeschema tool
602 xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) );
603
604 const std::map<wxString, wxString>& properties = m_schematic->Project().GetTextVars();
605
606 for( const std::pair<const wxString, wxString>& prop : properties )
607 {
608 xdesign->AddChild( xtextvar = node( wxT( "textvar" ), prop.second ) );
609 xtextvar->AddAttribute( wxT( "name" ), prop.first );
610 }
611
612 /*
613 * Export the sheets information
614 */
615 unsigned sheetIndex = 1; // Human readable index
616
617 for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
618 {
619 screen = sheet.LastScreen();
620
621 xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) );
622
623 // get the string representation of the sheet index number.
624 sheetTxt.Printf( wxT( "%u" ), sheetIndex++ );
625 xsheet->AddAttribute( wxT( "number" ), sheetTxt );
626 xsheet->AddAttribute( wxT( "name" ), sheet.PathHumanReadable() );
627 xsheet->AddAttribute( wxT( "tstamps" ), sheet.PathAsString() );
628
629 TITLE_BLOCK tb = screen->GetTitleBlock();
630 PROJECT* prj = &m_schematic->Project();
631
632 xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) );
633
634 xtitleBlock->AddChild( node( wxT( "title" ), ExpandTextVars( tb.GetTitle(), prj ) ) );
635 xtitleBlock->AddChild( node( wxT( "company" ), ExpandTextVars( tb.GetCompany(), prj ) ) );
636 xtitleBlock->AddChild( node( wxT( "rev" ), ExpandTextVars( tb.GetRevision(), prj ) ) );
637 xtitleBlock->AddChild( node( wxT( "date" ), ExpandTextVars( tb.GetDate(), prj ) ) );
638
639 // We are going to remove the fileName directories.
640 sourceFileName = wxFileName( screen->GetFileName() );
641 xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) );
642
643 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
644 xcomment->AddAttribute( wxT( "number" ), wxT( "1" ) );
645 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 0 ), prj ) );
646
647 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
648 xcomment->AddAttribute( wxT( "number" ), wxT( "2" ) );
649 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 1 ), prj ) );
650
651 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
652 xcomment->AddAttribute( wxT( "number" ), wxT( "3" ) );
653 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 2 ), prj ) );
654
655 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
656 xcomment->AddAttribute( wxT( "number" ), wxT( "4" ) );
657 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 3 ), prj ) );
658
659 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
660 xcomment->AddAttribute( wxT( "number" ), wxT( "5" ) );
661 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 4 ), prj ) );
662
663 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
664 xcomment->AddAttribute( wxT( "number" ), wxT( "6" ) );
665 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 5 ), prj ) );
666
667 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
668 xcomment->AddAttribute( wxT( "number" ), wxT( "7" ) );
669 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 6 ), prj ) );
670
671 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
672 xcomment->AddAttribute( wxT( "number" ), wxT( "8" ) );
673 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 7 ), prj ) );
674
675 xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
676 xcomment->AddAttribute( wxT( "number" ), wxT( "9" ) );
677 xcomment->AddAttribute( wxT( "value" ), ExpandTextVars( tb.GetComment( 8 ), prj ) );
678 }
679
680 return xdesign;
681}
682
683
685{
686 XNODE* xlibs = node( wxT( "libraries" ) ); // auto_ptr
687 SYMBOL_LIB_TABLE* symbolLibTable = PROJECT_SCH::SchSymbolLibTable( &m_schematic->Project() );
688
689 for( std::set<wxString>::iterator it = m_libraries.begin(); it!=m_libraries.end(); ++it )
690 {
691 wxString libNickname = *it;
692 XNODE* xlibrary;
693
694 if( symbolLibTable->HasLibrary( libNickname ) )
695 {
696 xlibs->AddChild( xlibrary = node( wxT( "library" ) ) );
697 xlibrary->AddAttribute( wxT( "logical" ), libNickname );
698 xlibrary->AddChild( node( wxT( "uri" ), symbolLibTable->GetFullURI( libNickname ) ) );
699 }
700
701 // @todo: add more fun stuff here
702 }
703
704 return xlibs;
705}
706
707
709{
710 XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr
711 std::vector<SCH_FIELD*> fieldList;
712
713 m_libraries.clear();
714
715 for( LIB_SYMBOL* lcomp : m_libParts )
716 {
717 wxString libNickname = lcomp->GetLibId().GetLibNickname();;
718
719 // The library nickname will be empty if the cache library is used.
720 if( !libNickname.IsEmpty() )
721 m_libraries.insert( libNickname ); // inserts symbol's library if unique
722
723 XNODE* xlibpart;
724 xlibparts->AddChild( xlibpart = node( wxT( "libpart" ) ) );
725 xlibpart->AddAttribute( wxT( "lib" ), libNickname );
726 xlibpart->AddAttribute( wxT( "part" ), lcomp->GetName() );
727
728 //----- show the important properties -------------------------
729 if( !lcomp->GetDescription().IsEmpty() )
730 xlibpart->AddChild( node( wxT( "description" ), lcomp->GetDescription() ) );
731
732 if( !lcomp->GetDatasheetField().GetText().IsEmpty() )
733 xlibpart->AddChild( node( wxT( "docs" ), lcomp->GetDatasheetField().GetText() ) );
734
735 // Write the footprint list
736 if( lcomp->GetFPFilters().GetCount() )
737 {
738 XNODE* xfootprints;
739 xlibpart->AddChild( xfootprints = node( wxT( "footprints" ) ) );
740
741 for( unsigned i = 0; i < lcomp->GetFPFilters().GetCount(); ++i )
742 {
743 if( !lcomp->GetFPFilters()[i].IsEmpty() )
744 xfootprints->AddChild( node( wxT( "fp" ), lcomp->GetFPFilters()[i] ) );
745 }
746 }
747
748 //----- show the fields here ----------------------------------
749 fieldList.clear();
750 lcomp->GetFields( fieldList );
751
752 XNODE* xfields;
753 xlibpart->AddChild( xfields = node( "fields" ) );
754
755 for( const SCH_FIELD* field : fieldList )
756 {
757 XNODE* xfield;
758 xfields->AddChild( xfield = node( wxT( "field" ), field->GetText() ) );
759 xfield->AddAttribute( wxT( "name" ), field->GetCanonicalName() );
760 }
761
762 //----- show the pins here ------------------------------------
763 // NOTE: Expand stacked-pin notation into individual pins so downstream
764 // tools (e.g. CvPcb) see the actual number of footprint pins.
765 std::vector<SCH_PIN*> pinList = lcomp->GetGraphicalPins( 0, 0 );
766
767 /*
768 * We must erase redundant Pins references in pinList
769 * These redundant pins exist because some pins are found more than one time when a
770 * symbol has multiple parts per package or has 2 representations (DeMorgan conversion).
771 * For instance, a 74ls00 has DeMorgan conversion, with different pin shapes, and
772 * therefore each pin appears 2 times in the list. Common pins (VCC, GND) can also be
773 * found more than once.
774 */
775 sort( pinList.begin(), pinList.end(), sortPinsByNumber );
776
777 for( int ii = 0; ii < (int)pinList.size()-1; ii++ )
778 {
779 if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
780 { // 2 pins have the same number, remove the redundant pin at index i+1
781 pinList.erase(pinList.begin() + ii + 1);
782 ii--;
783 }
784 }
785
786 wxLogTrace( "CVPCB_PINCOUNT",
787 wxString::Format( "makeLibParts: lib='%s' part='%s' pinList(size)=%zu",
788 libNickname, lcomp->GetName(), pinList.size() ) );
789
790 if( pinList.size() )
791 {
792 XNODE* pins;
793
794 xlibpart->AddChild( pins = node( wxT( "pins" ) ) );
795
796 for( unsigned i=0; i<pinList.size(); ++i )
797 {
798 SCH_PIN* basePin = pinList[i];
799
800 bool stackedValid = false;
801 std::vector<wxString> expandedNums = basePin->GetStackedPinNumbers( &stackedValid );
802
803 // If stacked notation detected and valid, emit one libparts pin per expanded number.
804 if( stackedValid && !expandedNums.empty() )
805 {
806 for( const wxString& num : expandedNums )
807 {
808 XNODE* pin;
809 pins->AddChild( pin = node( wxT( "pin" ) ) );
810 pin->AddAttribute( wxT( "num" ), num );
811 pin->AddAttribute( wxT( "name" ), basePin->GetShownName() );
812 pin->AddAttribute( wxT( "type" ), basePin->GetCanonicalElectricalTypeName() );
813
814 wxLogTrace( "CVPCB_PINCOUNT",
815 wxString::Format( "makeLibParts: -> pin num='%s' name='%s' (expanded)",
816 num, basePin->GetShownName() ) );
817 }
818 }
819 else
820 {
821 XNODE* pin;
822 pins->AddChild( pin = node( wxT( "pin" ) ) );
823 pin->AddAttribute( wxT( "num" ), basePin->GetShownNumber() );
824 pin->AddAttribute( wxT( "name" ), basePin->GetShownName() );
825 pin->AddAttribute( wxT( "type" ), basePin->GetCanonicalElectricalTypeName() );
826
827 wxLogTrace( "CVPCB_PINCOUNT",
828 wxString::Format( "makeLibParts: -> pin num='%s' name='%s'",
829 basePin->GetShownNumber(),
830 basePin->GetShownName() ) );
831 }
832
833 // caution: construction work site here, drive slowly
834 }
835 }
836 }
837
838 return xlibparts;
839}
840
841
843{
844 wxString netCodeTxt;
845 XNODE* xnets = node( wxT( "nets" ) ); // auto_ptr if exceptions ever get used.
846 XNODE* xnet = nullptr;
847
848 /* output:
849 <net code="123" name="/cfcard.sch/WAIT#" class="signal">
850 <node ref="R23" pin="1"/>
851 <node ref="U18" pin="12"/>
852 </net>
853 */
854
855 struct NET_NODE
856 {
857 NET_NODE( SCH_PIN* aPin, const SCH_SHEET_PATH& aSheet ) :
858 m_Pin( aPin ),
859 m_Sheet( aSheet )
860 {}
861
862 SCH_PIN* m_Pin;
863 SCH_SHEET_PATH m_Sheet;
864 };
865
866 struct NET_RECORD
867 {
868 NET_RECORD( const wxString& aName ) :
869 m_Name( aName ),
870 m_HasNoConnect( false )
871 {};
872
873 wxString m_Name;
874 wxString m_Class;
875 bool m_HasNoConnect;
876 std::vector<NET_NODE> m_Nodes;
877 };
878
879 std::vector<NET_RECORD*> nets;
880
881 for( const auto& [ key, subgraphs ] : m_schematic->ConnectionGraph()->GetNetMap() )
882 {
883 wxString net_name = key.Name;
884 NET_RECORD* net_record = nullptr;
885
886 if( !( aCtl & GNL_OPT_KICAD ) )
887 net_name = UnescapeString( net_name );
888
889 if( subgraphs.empty() )
890 continue;
891
892 nets.emplace_back( new NET_RECORD( net_name ) );
893 net_record = nets.back();
894
895 for( CONNECTION_SUBGRAPH* subgraph : subgraphs )
896 {
897 bool nc = subgraph->GetNoConnect() && subgraph->GetNoConnect()->Type() == SCH_NO_CONNECT_T;
898 const SCH_SHEET_PATH& sheet = subgraph->GetSheet();
899
900 if( net_record->m_Class.IsEmpty() && subgraph->GetDriver() )
901 {
902 if( subgraph->GetDriver()->GetEffectiveNetClass() )
903 {
904 net_record->m_Class = subgraph->GetDriver()->GetEffectiveNetClass()->GetName();
905 net_record->m_Class = UnescapeString( net_record->m_Class );
906 }
907 }
908
909 if( nc )
910 net_record->m_HasNoConnect = true;
911
912 for( SCH_ITEM* item : subgraph->GetItems() )
913 {
914 if( item->Type() == SCH_PIN_T )
915 {
916 SCH_PIN* pin = static_cast<SCH_PIN*>( item );
917 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( pin->GetParentSymbol() );
918 bool forBOM = aCtl & GNL_OPT_BOM;
919 bool forBoard = aCtl & GNL_OPT_KICAD;
920
921 if( !symbol )
922 continue;
923
924 if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->ResolveExcludedFromBOM() ) )
925 continue;
926
927 if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->ResolveExcludedFromBoard() ) )
928 continue;
929
930 net_record->m_Nodes.emplace_back( pin, sheet );
931 }
932 }
933 }
934 }
935
936 // Netlist ordering: Net name, then ref des, then pin name
937 std::sort( nets.begin(), nets.end(),
938 []( const NET_RECORD* a, const NET_RECORD*b )
939 {
940 return StrNumCmp( a->m_Name, b->m_Name ) < 0;
941 } );
942
943 for( int i = 0; i < (int) nets.size(); ++i )
944 {
945 NET_RECORD* net_record = nets[i];
946 bool added = false;
947 XNODE* xnode;
948
949 // Netlist ordering: Net name, then ref des, then pin name
950 std::sort( net_record->m_Nodes.begin(), net_record->m_Nodes.end(),
951 []( const NET_NODE& a, const NET_NODE& b )
952 {
953 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
954 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
955
956 if( refA == refB )
957 return a.m_Pin->GetShownNumber() < b.m_Pin->GetShownNumber();
958
959 return refA < refB;
960 } );
961
962 // Some duplicates can exist, for example on multi-unit parts with duplicated pins across
963 // units. If the user connects the pins on each unit, they will appear on separate
964 // subgraphs. Remove those here:
965 alg::remove_duplicates( net_record->m_Nodes,
966 []( const NET_NODE& a, const NET_NODE& b )
967 {
968 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
969 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
970
971 return refA == refB && a.m_Pin->GetShownNumber() == b.m_Pin->GetShownNumber();
972 } );
973
974 // Determine if all pins in the net are stacked (nets with only one pin are implicitly
975 // taken to be stacked)
976 bool allNetPinsStacked = true;
977
978 if( net_record->m_Nodes.size() > 1 )
979 {
980 SCH_PIN* firstPin = net_record->m_Nodes.begin()->m_Pin;
981 allNetPinsStacked =
982 std::all_of( net_record->m_Nodes.begin() + 1, net_record->m_Nodes.end(),
983 [=]( auto& node )
984 {
985 return firstPin->GetParent() == node.m_Pin->GetParent()
986 && firstPin->GetPosition() == node.m_Pin->GetPosition()
987 && firstPin->GetName() == node.m_Pin->GetName();
988 } );
989 }
990
991 for( const NET_NODE& netNode : net_record->m_Nodes )
992 {
993 wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet );
994
995 // Skip power symbols and virtual symbols
996 if( refText[0] == wxChar( '#' ) )
997 continue;
998
999 if( !added )
1000 {
1001 netCodeTxt.Printf( wxT( "%d" ), i + 1 );
1002
1003 xnets->AddChild( xnet = node( wxT( "net" ) ) );
1004 xnet->AddAttribute( wxT( "code" ), netCodeTxt );
1005 xnet->AddAttribute( wxT( "name" ), net_record->m_Name );
1006 xnet->AddAttribute( wxT( "class" ), net_record->m_Class );
1007
1008 added = true;
1009 }
1010
1011 std::vector<wxString> nums = netNode.m_Pin->GetStackedPinNumbers();
1012 wxString baseName = netNode.m_Pin->GetShownName();
1013 wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
1014
1015 wxLogTrace( "KICAD_STACKED_PINS",
1016 wxString::Format( "XML: net='%s' ref='%s' base='%s' shownNum='%s' expand=%zu",
1017 net_record->m_Name, refText, baseName,
1018 netNode.m_Pin->GetShownNumber(), nums.size() ) );
1019
1020 for( const wxString& num : nums )
1021 {
1022 xnet->AddChild( xnode = node( wxT( "node" ) ) );
1023 xnode->AddAttribute( wxT( "ref" ), refText );
1024 xnode->AddAttribute( wxT( "pin" ), num );
1025
1026 wxString fullName = baseName.IsEmpty() ? num : baseName + wxT( "_" ) + num;
1027
1028 if( !baseName.IsEmpty() || nums.size() > 1 )
1029 xnode->AddAttribute( wxT( "pinfunction" ), fullName );
1030
1031 wxString typeAttr = pinType;
1032
1033 if( net_record->m_HasNoConnect
1034 && ( net_record->m_Nodes.size() == 1 || allNetPinsStacked ) )
1035 {
1036 typeAttr += wxT( "+no_connect" );
1037 wxLogTrace( "KICAD_STACKED_PINS",
1038 wxString::Format( "XML: marking node ref='%s' pin='%s' as no_connect",
1039 refText, num ) );
1040 }
1041
1042 xnode->AddAttribute( wxT( "pintype" ), typeAttr );
1043 }
1044 }
1045 }
1046
1047 for( NET_RECORD* record : nets )
1048 delete record;
1049
1050 return xnets;
1051}
1052
1053
1054XNODE* NETLIST_EXPORTER_XML::node( const wxString& aName,
1055 const wxString& aTextualContent /* = wxEmptyString*/ )
1056{
1057 XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );
1058
1059 if( aTextualContent.Len() > 0 ) // excludes wxEmptyString, the parameter's default value
1060 n->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, aTextualContent ) );
1061
1062 return n;
1063}
1064
1065
1066static bool sortPinsByNumber( SCH_PIN* aPin1, SCH_PIN* aPin2 )
1067{
1068 // return "lhs < rhs"
1069 return StrNumCmp( aPin1->GetShownNumber(), aPin2->GetShownNumber(), true ) < 0;
1070}
wxString GetBuildVersion()
Get the full KiCad version string.
A subgraph is a set of items that are electrically connected on a single sheet.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
const KIID m_Uuid
Definition eda_item.h:516
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:97
wxString AsString() const
Definition kiid.cpp:246
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition lib_id.h:112
const wxString GetUniStringLibNickname() const
Definition lib_id.h:88
Define a library symbol object.
Definition lib_symbol.h:85
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
SCH_SYMBOL * findNextSymbol(EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath)
Check if the given symbol should be processed for netlisting.
std::set< LIB_SYMBOL *, LIB_SYMBOL_LESS_THAN > m_libParts
unique library symbols used. LIB_SYMBOL items are sorted by names
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
XNODE * makeDesignHeader()
Fill out a project "design" header into an XML node.
XNODE * makeLibraries()
Fill out an XML node with a list of used libraries and returns it.
bool WriteNetlist(const wxString &aOutFileName, unsigned aNetlistOptions, REPORTER &aReporter) override
Write generic netlist to aOutFileName.
XNODE * node(const wxString &aName, const wxString &aTextualContent=wxEmptyString)
A convenience function that creates a new XNODE with an optional textual child.
XNODE * makeListOfNets(unsigned aCtl)
Fill out an XML node with a list of nets and returns it.
void addSymbolFields(XNODE *aNode, SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheet, const SCH_SHEET_LIST &aSheetList)
Holder for multi-unit symbol fields.
std::vector< wxString > getComponentClassNamesForAllSymbolUnits(SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSymbolSheet, const SCH_SHEET_LIST &aSheetList)
Finds all component class names attached to any sub-unit of a given symbol.
XNODE * makeSymbols(unsigned aCtl)
XNODE * makeRoot(unsigned aCtl=GNL_ALL)
Build the entire document tree for the generic export.
std::set< wxString > m_libraries
XNODE * makeLibParts()
Fill out an XML node with the unique library parts and returns it.
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
Container for project specific data.
Definition project.h:65
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
bool ResolveExcludedFromBOM() const
Definition sch_item.cpp:262
bool ResolveExcludedFromBoard() const
Definition sch_item.cpp:277
bool ResolveDNP() const
Definition sch_item.cpp:292
wxString GetShownNumber() const
Definition sch_pin.cpp:587
std::vector< wxString > GetStackedPinNumbers(bool *aValid=nullptr) const
Definition sch_pin.cpp:593
wxString GetCanonicalElectricalTypeName() const
Definition sch_pin.cpp:342
wxString GetShownName() const
Definition sch_pin.cpp:576
const wxString & GetFileName() const
Definition sch_screen.h:152
const TITLE_BLOCK & GetTitleBlock() const
Definition sch_screen.h:163
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool GetExcludedFromBOM() const
const SCH_SHEET * GetSheet(unsigned aIndex) const
bool GetExcludedFromBoard() const
Schematic symbol object.
Definition sch_symbol.h:75
wxString GetDescription() const override
bool UseLibIdLookup() const
Definition sch_symbol.h:181
wxString GetSchSymbolLibraryName() const
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:164
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
int GetUnitCount() const override
Return the number of units per package of the symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:183
std::unordered_set< wxString > GetComponentClassNames(const SCH_SHEET_PATH *aPath) const
Return the component classes this symbol belongs in.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:41
const wxString & GetCompany() const
Definition title_block.h:96
const wxString & GetRevision() const
Definition title_block.h:86
const wxString & GetDate() const
Definition title_block.h:76
const wxString & GetComment(int aIdx) const
const wxString & GetTitle() const
Definition title_block.h:63
Hold an XML or S-expression element.
Definition xnode.h:43
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
Definition common.cpp:59
The common library.
void remove_duplicates(_Container &__c)
Deletes all duplicate values from __c.
Definition kicad_algo.h:161
static bool sortPinsByNumber(SCH_PIN *aPin1, SCH_PIN *aPin2)
#define GNL_ALL
@ GNL_LIBRARIES
@ GNL_OPT_KICAD
@ GNL_SYMBOLS
@ GNL_OPT_BOM
Class to handle a set of SCH_ITEMs.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString UnescapeString(const wxString &aSource)
wxString GetISO8601CurrentDateTime()
Definition for symbol library class.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
wxString GetCanonicalFieldName(FIELD_T aFieldType)
@ SCH_GROUP_T
Definition typeinfo.h:175
@ SCH_NO_CONNECT_T
Definition typeinfo.h:162
@ SCH_SYMBOL_T
Definition typeinfo.h:174
@ SCH_PIN_T
Definition typeinfo.h:155