KiCad PCB EDA Suite
netlist_generator.cpp File Reference
#include <fctsys.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <reporter.h>
#include <confirm.h>
#include <kiway.h>
#include <netlist.h>
#include <netlist_exporter.h>
#include <netlist_exporter_orcadpcb2.h>
#include <netlist_exporter_cadstar.h>
#include <netlist_exporter_pspice.h>
#include <netlist_exporter_kicad.h>
#include <netlist_exporter_generic.h>
#include <invoke_sch_dialog.h>

Go to the source code of this file.

Functions

int TestDuplicateSheetNames (bool aCreateMarker)
 Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated). More...
 

Function Documentation

◆ TestDuplicateSheetNames()

int TestDuplicateSheetNames ( bool  aCreateMarker)

Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).

Returns
the error count
Parameters
aCreateMarkertrue = create error markers in schematic, false = calculate error count only

Definition at line 157 of file eeschema/erc.cpp.

158 {
159  SCH_SCREEN* screen;
160  int err_count = 0;
161  SCH_SCREENS screenList; // Created the list of screen
162 
163  for( screen = screenList.GetFirst(); screen != NULL; screen = screenList.GetNext() )
164  {
165  std::vector<SCH_SHEET*> list;
166 
167  for( SCH_ITEM* item : screen->Items().OfType( SCH_SHEET_T ) )
168  list.push_back( static_cast<SCH_SHEET*>( item ) );
169 
170  for( size_t i = 0; i < list.size(); i++ )
171  {
172  SCH_SHEET* item = list[i];
173 
174  for( size_t j = i + 1; j < list.size(); j++ )
175  {
176  SCH_SHEET* test_item = list[j];
177 
178  // We have found a second sheet: compare names
179  // we are using case insensitive comparison to avoid mistakes between
180  // similar names like Mysheet and mysheet
181  if( item->GetName().CmpNoCase( test_item->GetName() ) == 0 )
182  {
183  if( aCreateMarker )
184  {
187  item->GetPosition(), item, test_item );
188  screen->Append( marker );
189  }
190 
191  err_count++;
192  }
193  }
194  }
195  }
196 
197  return err_count;
198 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:970
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
wxString GetName() const
Definition: sch_sheet.h:280
#define NULL
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:565
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:215
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:175
EE_RTREE & Items()
Definition: sch_screen.h:127
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:959
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:491

References SCH_SCREEN::Append(), ERCE_DUPLICATE_SHEET_NAME, SCH_SCREENS::GetFirst(), SCH_SHEET::GetName(), SCH_SCREENS::GetNext(), SCH_SHEET::GetPosition(), SCH_SCREEN::Items(), MARKER_BASE::MARKER_ERC, NULL, EE_RTREE::OfType(), SCH_SHEET_T, MARKER_BASE::SetData(), and UNSCALED.

Referenced by highlightNet(), SCH_EDIT_FRAME::prepareForNetlist(), and DIALOG_ERC::TestErc().