Rename GetModules to GetFootprints
This commit is contained in:
parent
dfddd19b17
commit
a4650e7269
|
@ -176,7 +176,7 @@ class add_automatic_border( ActionPlugin ):
|
||||||
max_y = self.max( max_y, bbox.GetY() + bbox.GetHeight() )
|
max_y = self.max( max_y, bbox.GetY() + bbox.GetHeight() )
|
||||||
|
|
||||||
# Same with modules: Find including area
|
# Same with modules: Find including area
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetFootprints():
|
||||||
bbox = module.GetBoundingBox()
|
bbox = module.GetBoundingBox()
|
||||||
min_x = self.min( min_x, bbox.GetX() )
|
min_x = self.min( min_x, bbox.GetX() )
|
||||||
min_y = self.min( min_y, bbox.GetY() )
|
min_y = self.min( min_y, bbox.GetY() )
|
||||||
|
|
|
@ -14,7 +14,7 @@ class testundoredo0(ActionPlugin):
|
||||||
def Run(self):
|
def Run(self):
|
||||||
pcb = GetBoard()
|
pcb = GetBoard()
|
||||||
|
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetFootprints():
|
||||||
pcb.RemoveNative(module)
|
pcb.RemoveNative(module)
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class testundoredo1(ActionPlugin):
|
||||||
area = pcb.GetArea(0)
|
area = pcb.GetArea(0)
|
||||||
pcb.RemoveNative(area)
|
pcb.RemoveNative(area)
|
||||||
|
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetFootprints():
|
||||||
pcb.RemoveNative(module)
|
pcb.RemoveNative(module)
|
||||||
|
|
||||||
for track in pcb.GetTracks():
|
for track in pcb.GetTracks():
|
||||||
|
@ -138,7 +138,7 @@ class testundoredo3(ActionPlugin):
|
||||||
area = pcb.GetArea(i)
|
area = pcb.GetArea(i)
|
||||||
area.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
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)))
|
module.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||||
if random.randint(0,10) > 5:
|
if random.randint(0,10) > 5:
|
||||||
module.Flip(module.GetPosition())
|
module.Flip(module.GetPosition())
|
||||||
|
|
|
@ -178,7 +178,7 @@ public:
|
||||||
|
|
||||||
wxString GetPath() const { return m_lib_path.GetPath(); }
|
wxString GetPath() const { return m_lib_path.GetPath(); }
|
||||||
bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); }
|
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
|
// 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.
|
// 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
|
// Some of the files may have been parsed correctly so we want to add the valid files to
|
||||||
// the library.
|
// 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() ) );
|
aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) );
|
||||||
|
|
||||||
if( !errorMsg.IsEmpty() && !aBestEfforts )
|
if( !errorMsg.IsEmpty() && !aBestEfforts )
|
||||||
|
@ -915,7 +915,7 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
|
||||||
|
|
||||||
validateCache( aLibraryPath, checkModified );
|
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 ) );
|
MODULE_CITER it = mods.find( TO_UTF8( aFootprintName ) );
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
|
|
||||||
bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); }
|
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
|
// 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.
|
// 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
|
// Some of the files may have been parsed correctly so we want to add the valid files to
|
||||||
// the library.
|
// 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 );
|
aFootprintNames.Add( it->first );
|
||||||
|
|
||||||
if( !errorMsg.IsEmpty() && !aBestEfforts )
|
if( !errorMsg.IsEmpty() && !aBestEfforts )
|
||||||
|
@ -2184,7 +2184,7 @@ const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath,
|
||||||
// do nothing with the error
|
// 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 );
|
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();
|
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.
|
// Quietly overwrite module and delete module file from path for any by same name.
|
||||||
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
|
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
|
||||||
|
|
|
@ -41,9 +41,9 @@ pcb.Save("my2.kicad_pcb")
|
||||||
|
|
||||||
pcb = LoadBoard("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():
|
for p in m.Pads():
|
||||||
print('pad ', p.GetName(), p.GetPosition(), p.GetOffset())
|
print('pad ', p.GetName(), p.GetPosition(), p.GetOffset())
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ filename=sys.argv[1]
|
||||||
|
|
||||||
pcb = LoadBoard(filename)
|
pcb = LoadBoard(filename)
|
||||||
|
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetFootprints():
|
||||||
print("* Module: %s" % module.GetReference())
|
print("* Module: %s" % module.GetReference())
|
||||||
module.Value().SetVisible(False) # set Value as Hidden
|
module.Value().SetVisible(False) # set Value as Hidden
|
||||||
module.Reference().SetVisible(True) # set Reference as Visible
|
module.Reference().SetVisible(True) # set Reference as Visible
|
||||||
|
|
|
@ -49,7 +49,7 @@ for item in pcb.GetDrawings():
|
||||||
print("")
|
print("")
|
||||||
print("LIST MODULES:")
|
print("LIST MODULES:")
|
||||||
|
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetFootprints():
|
||||||
print("* Module: %s at %s" % (module.GetReference(), ToUnits(module.GetPosition())))
|
print("* Module: %s at %s" % (module.GetReference(), ToUnits(module.GetPosition())))
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
|
@ -4,7 +4,7 @@ import pcbnew
|
||||||
|
|
||||||
pcb = pcbnew.GetBoard()
|
pcb = pcbnew.GetBoard()
|
||||||
|
|
||||||
for m in pcb.GetModules():
|
for m in pcb.GetFootprints():
|
||||||
print(m.GetPosition())
|
print(m.GetPosition())
|
||||||
for p in m.Pads():
|
for p in m.Pads():
|
||||||
print("p=>", p.GetPosition(), p.GetName())
|
print("p=>", p.GetPosition(), p.GetName())
|
||||||
|
|
|
@ -4,7 +4,7 @@ import pcbnew
|
||||||
|
|
||||||
pcb = pcbnew.GetBoard()
|
pcb = pcbnew.GetBoard()
|
||||||
|
|
||||||
for m in pcb.GetModules():
|
for m in pcb.GetFootprints():
|
||||||
print(m.GetReference(), "(", m.GetValue(), ") at ", m.GetPosition())
|
print(m.GetReference(), "(", m.GetValue(), ") at ", m.GetPosition())
|
||||||
for p in m.Pads():
|
for p in m.Pads():
|
||||||
print(" pad", p.GetName(), "at", p.GetPosition())
|
print(" pad", p.GetName(), "at", p.GetPosition())
|
||||||
|
|
|
@ -16,12 +16,12 @@ class TestPCBLoad(unittest.TestCase):
|
||||||
self.assertEqual(len(tracks),361)
|
self.assertEqual(len(tracks),361)
|
||||||
|
|
||||||
def test_pcb_modules(self):
|
def test_pcb_modules(self):
|
||||||
modules = list(self.pcb.GetModules())
|
modules = list(self.pcb.GetFootprints())
|
||||||
self.assertEqual(len(modules), 72)
|
self.assertEqual(len(modules), 72)
|
||||||
|
|
||||||
def test_pcb_module_references(self):
|
def test_pcb_module_references(self):
|
||||||
board_refs = list(module.GetReference() for
|
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',
|
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',
|
u'Q6', u'Q1', u'Q2', u'Q4', u'Q8', u'P2', u'U1', u'U4',
|
||||||
|
|
Loading…
Reference in New Issue