Rename GetModules to GetFootprints

This commit is contained in:
Dominik Wernberger 2020-11-14 00:03:36 +01:00 committed by Werni
parent dfddd19b17
commit a4650e7269
10 changed files with 19 additions and 19 deletions

View File

@ -176,7 +176,7 @@ class add_automatic_border( ActionPlugin ):
max_y = self.max( max_y, bbox.GetY() + bbox.GetHeight() )
# Same with modules: Find including area
for module in pcb.GetModules():
for module in pcb.GetFootprints():
bbox = module.GetBoundingBox()
min_x = self.min( min_x, bbox.GetX() )
min_y = self.min( min_y, bbox.GetY() )

View File

@ -14,7 +14,7 @@ class testundoredo0(ActionPlugin):
def Run(self):
pcb = GetBoard()
for module in pcb.GetModules():
for module in pcb.GetFootprints():
pcb.RemoveNative(module)
@ -32,7 +32,7 @@ class testundoredo1(ActionPlugin):
area = pcb.GetArea(0)
pcb.RemoveNative(area)
for module in pcb.GetModules():
for module in pcb.GetFootprints():
pcb.RemoveNative(module)
for track in pcb.GetTracks():
@ -138,7 +138,7 @@ class testundoredo3(ActionPlugin):
area = pcb.GetArea(i)
area.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
for module in pcb.GetModules():
for module in pcb.GetFootprints():
module.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
if random.randint(0,10) > 5:
module.Flip(module.GetPosition())

View File

@ -178,7 +178,7 @@ public:
wxString GetPath() const { return m_lib_path.GetPath(); }
bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); }
FOOTPRINT_MAP& GetModules() { return m_footprints; }
FOOTPRINT_MAP& GetFootprints() { return m_footprints; }
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any PLUGIN.
@ -896,7 +896,7 @@ void GPCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxSt
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
for( MODULE_CITER it = m_cache->GetModules().begin(); it != m_cache->GetModules().end(); ++it )
for( MODULE_CITER it = m_cache->GetFootprints().begin(); it != m_cache->GetFootprints().end(); ++it )
aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) );
if( !errorMsg.IsEmpty() && !aBestEfforts )
@ -915,7 +915,7 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
validateCache( aLibraryPath, checkModified );
const FOOTPRINT_MAP& mods = m_cache->GetModules();
const FOOTPRINT_MAP& mods = m_cache->GetFootprints();
MODULE_CITER it = mods.find( TO_UTF8( aFootprintName ) );

View File

@ -103,7 +103,7 @@ public:
bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); }
FOOTPRINT_MAP& GetModules() { return m_modules; }
FOOTPRINT_MAP& GetFootprints() { return m_modules; }
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any PLUGIN.
@ -2158,7 +2158,7 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString&
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
for( MODULE_CITER it = m_cache->GetModules().begin(); it != m_cache->GetModules().end(); ++it )
for( MODULE_CITER it = m_cache->GetFootprints().begin(); it != m_cache->GetFootprints().end(); ++it )
aFootprintNames.Add( it->first );
if( !errorMsg.IsEmpty() && !aBestEfforts )
@ -2184,7 +2184,7 @@ const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath,
// do nothing with the error
}
const FOOTPRINT_MAP& mods = m_cache->GetModules();
const FOOTPRINT_MAP& mods = m_cache->GetFootprints();
MODULE_CITER it = mods.find( aFootprintName );
@ -2263,7 +2263,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
wxString footprintName = aFootprint->GetFPID().GetLibItemName();
FOOTPRINT_MAP& mods = m_cache->GetModules();
FOOTPRINT_MAP& mods = m_cache->GetFootprints();
// Quietly overwrite module and delete module file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),

View File

@ -41,9 +41,9 @@ pcb.Save("my2.kicad_pcb")
pcb = LoadBoard("my2.kicad_pcb")
print(map( lambda x: x.GetReference() , list(pcb.GetModules())))
print(map( lambda x: x.GetReference() , list(pcb.GetFootprints())))
for m in pcb.GetModules():
for m in pcb.GetFootprints():
for p in m.Pads():
print('pad ', p.GetName(), p.GetPosition(), p.GetOffset())

View File

@ -6,7 +6,7 @@ filename=sys.argv[1]
pcb = LoadBoard(filename)
for module in pcb.GetModules():
for module in pcb.GetFootprints():
print("* Module: %s" % module.GetReference())
module.Value().SetVisible(False) # set Value as Hidden
module.Reference().SetVisible(True) # set Reference as Visible

View File

@ -49,7 +49,7 @@ for item in pcb.GetDrawings():
print("")
print("LIST MODULES:")
for module in pcb.GetModules():
for module in pcb.GetFootprints():
print("* Module: %s at %s" % (module.GetReference(), ToUnits(module.GetPosition())))
print("")

View File

@ -4,7 +4,7 @@ import pcbnew
pcb = pcbnew.GetBoard()
for m in pcb.GetModules():
for m in pcb.GetFootprints():
print(m.GetPosition())
for p in m.Pads():
print("p=>", p.GetPosition(), p.GetName())

View File

@ -4,7 +4,7 @@ import pcbnew
pcb = pcbnew.GetBoard()
for m in pcb.GetModules():
for m in pcb.GetFootprints():
print(m.GetReference(), "(", m.GetValue(), ") at ", m.GetPosition())
for p in m.Pads():
print(" pad", p.GetName(), "at", p.GetPosition())

View File

@ -16,12 +16,12 @@ class TestPCBLoad(unittest.TestCase):
self.assertEqual(len(tracks),361)
def test_pcb_modules(self):
modules = list(self.pcb.GetModules())
modules = list(self.pcb.GetFootprints())
self.assertEqual(len(modules), 72)
def test_pcb_module_references(self):
board_refs = list(module.GetReference() for
module in self.pcb.GetModules())
module in self.pcb.GetFootprints())
known_refs = [u'P1', u'P3', u'C2', u'C1', u'D1', u'Q3', u'Q5', u'Q7',
u'Q6', u'Q1', u'Q2', u'Q4', u'Q8', u'P2', u'U1', u'U4',