Commit 97ccebf3 authored by Matthew Beckler's avatar Matthew Beckler Committed by Miguel Angel Ajo

Fixes to scripting after refactoring & interface cleanups,

parent c597e75b
...@@ -13,7 +13,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1)) ...@@ -13,7 +13,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb # create a new module, it's parent is our previously created pcb
module = MODULE(pcb) module = MODULE(pcb)
module.SetReference("FPC"+str(pads)) # give it a reference name 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 pcb.Add(module) # add it to our pcb
m_pos = wxPointMM(50,50) m_pos = wxPointMM(50,50)
module.SetPosition(m_pos) module.SetPosition(m_pos)
...@@ -52,7 +52,7 @@ module.Add(e) ...@@ -52,7 +52,7 @@ module.Add(e)
# save the PCB to disk # save the PCB to disk
module.SetLibRef("FPC"+str(pads)) module.SetLibRef("FPC"+str(pads))
try: try:
FootprintLibCreate("fpc.mod") FootprintLibCreate("fpc40.mod")
except: except:
pass # we try to create, but may be it exists already pass # we try to create, but may be it exists already
FootprintSave("fpc40.mod",module) FootprintSave("fpc40.mod",module)
......
...@@ -12,7 +12,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1)) ...@@ -12,7 +12,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb # create a new module, it's parent is our previously created pcb
module = MODULE(pcb) module = MODULE(pcb)
module.SetReference("M1") # give it a reference name 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 pcb.Add(module) # add it to our pcb
m_pos = wxPointMM(50,50) m_pos = wxPointMM(50,50)
module.SetPosition(m_pos) module.SetPosition(m_pos)
...@@ -41,8 +41,8 @@ pcb = LoadBoard("/tmp/my2.brd") ...@@ -41,8 +41,8 @@ pcb = LoadBoard("/tmp/my2.brd")
print map( lambda x: x.GetReference() , list(pcb.GetModules())) print map( lambda x: x.GetReference() , list(pcb.GetModules()))
for m in pcb.GetModules(): for m in pcb.GetModules():
for p in m.GetPads(): for p in m.Pads():
print p.GetPadName(),p.GetPosition(), p.GetOffset() print p.GetPadName(), p.GetPosition(), p.GetOffset()
# pcb.GetDesignSettings() # pcb.GetDesignSettings()
...@@ -8,7 +8,7 @@ pcb = LoadBoard(filename) ...@@ -8,7 +8,7 @@ pcb = LoadBoard(filename)
for module in pcb.GetModules(): for module in pcb.GetModules():
print "* Module: %s"%module.GetReference() print "* Module: %s"%module.GetReference()
module.GetValueObj().SetVisible(False) # set Value as Hidden module.Value().SetVisible(False) # set Value as Hidden
module.GetReferenceObj().SetVisible(True) # set Reference as Visible module.Reference().SetVisible(True) # set Reference as Visible
pcb.Save("mod_"+filename) pcb.Save("mod_"+filename)
\ No newline at end of file
...@@ -37,7 +37,7 @@ print "LISTING DRAWINGS:" ...@@ -37,7 +37,7 @@ print "LISTING DRAWINGS:"
for item in pcb.GetDrawings(): for item in pcb.GetDrawings():
if type(item) is TEXTE_PCB: if type(item) is TEXTE_PCB:
print "* Text: '%s' at %s"%(item.GetText(),item.GetPosition()) print "* Text: '%s' at %s"%(item.GetText(), item.GetPosition())
elif type(item) is DRAWSEGMENT: elif type(item) is DRAWSEGMENT:
print "* Drawing: %s"%item.GetShapeStr() # dir(item) print "* Drawing: %s"%item.GetShapeStr() # dir(item)
else: else:
...@@ -60,4 +60,4 @@ print "" ...@@ -60,4 +60,4 @@ print ""
print "RATSNEST:",len(pcb.GetFullRatsnest()) print "RATSNEST:",len(pcb.GetFullRatsnest())
print dir(pcb.GetNetClasses()) print dir(pcb.GetNetClasses())
\ No newline at end of file
...@@ -4,6 +4,6 @@ lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod") ...@@ -4,6 +4,6 @@ lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod")
for name in lst: for name in lst:
m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name) m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name)
print name,"->",m.GetLibRef(), m.GetReference() 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() print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset()
\ No newline at end of file
...@@ -33,11 +33,6 @@ ...@@ -33,11 +33,6 @@
%pythoncode %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): #def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self) # return SaveModuleToLibrary(filename,self)
...@@ -52,10 +47,10 @@ ...@@ -52,10 +47,10 @@
if type(itemC) is D_PAD: if type(itemC) is D_PAD:
item.thisown=0 item.thisown=0
self.m_Pads.PushBack(itemC) self.Pads().PushBack(itemC)
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]: elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
item.thisown = 0 item.thisown = 0
self.m_Drawings.PushBack(item) self.GraphicalItems().PushBack(item)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment