Fixes to scripting after refactoring & interface cleanups,

This commit is contained in:
Matthew Beckler 2013-04-18 23:23:11 +02:00 committed by Miguel Angel Ajo
parent c597e75b73
commit 97ccebf355
6 changed files with 14 additions and 19 deletions

View File

@ -13,7 +13,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb
module = MODULE(pcb)
module.SetReference("FPC"+str(pads)) # give it a reference name
module.m_Reference.SetPos0(wxPointMM(-1,-1))
module.Reference().SetPos0(wxPointMM(-1,-1))
pcb.Add(module) # add it to our pcb
m_pos = wxPointMM(50,50)
module.SetPosition(m_pos)
@ -52,7 +52,7 @@ module.Add(e)
# save the PCB to disk
module.SetLibRef("FPC"+str(pads))
try:
FootprintLibCreate("fpc.mod")
FootprintLibCreate("fpc40.mod")
except:
pass # we try to create, but may be it exists already
FootprintSave("fpc40.mod",module)

View File

@ -12,7 +12,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb
module = MODULE(pcb)
module.SetReference("M1") # give it a reference name
module.m_Reference.SetPos0(wxPointMM(-10,-10))
module.Reference().SetPos0(wxPointMM(-10,-10))
pcb.Add(module) # add it to our pcb
m_pos = wxPointMM(50,50)
module.SetPosition(m_pos)
@ -41,7 +41,7 @@ pcb = LoadBoard("/tmp/my2.brd")
print map( lambda x: x.GetReference() , list(pcb.GetModules()))
for m in pcb.GetModules():
for p in m.GetPads():
for p in m.Pads():
print p.GetPadName(), p.GetPosition(), p.GetOffset()

View File

@ -8,7 +8,7 @@ pcb = LoadBoard(filename)
for module in pcb.GetModules():
print "* Module: %s"%module.GetReference()
module.GetValueObj().SetVisible(False) # set Value as Hidden
module.GetReferenceObj().SetVisible(True) # set Reference as Visible
module.Value().SetVisible(False) # set Value as Hidden
module.Reference().SetVisible(True) # set Reference as Visible
pcb.Save("mod_"+filename)

View File

@ -4,6 +4,6 @@ lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod")
for name in lst:
m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name)
print name,"->",m.GetLibRef(), m.GetReference()
for p in m.GetPads():
for p in m.Pads():
print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset()

View File

@ -33,11 +33,6 @@
%pythoncode
{
def GetPads(self): return self.m_Pads
def GetDrawings(self): return self.m_Drawings
def GetReferenceObj(self): return self.m_Reference
def GetValueObj(self): return self.m_Value
#def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self)
@ -52,10 +47,10 @@
if type(itemC) is D_PAD:
item.thisown=0
self.m_Pads.PushBack(itemC)
self.Pads().PushBack(itemC)
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
item.thisown = 0
self.m_Drawings.PushBack(item)
self.GraphicalItems().PushBack(item)
}
}