Commit 0cdc5c59 authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

detect building status of the swig .py file (on parallel make builds). Fix...

detect building status of the swig .py file (on parallel make builds). Fix unit conversion returns (From_xxx) to integer, what's all the wxPoint/wxRect/wx.. expect. Extended createPcb.py example
parent 1f108b0b
#!/usr/bin/env python2.7 #!/usr/bin/env python2.7
import pcbnew
from pcbnew import * from pcbnew import *
size_0_6mm = wxSizeMM(0.6,0.6) size_0_6mm = wxSizeMM(0.6,0.6)
size_1_0mm = wxSizeMM(1.0,1.0)
# create a blank board # create a blank board
pcb = BOARD() pcb = BOARD()
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))
pcb.Add(module) # add it to our pcb pcb.Add(module) # add it to our pcb
m_pos = wxPoint(FromMM(50),FromMM(50)) m_pos = wxPointMM(50,50)
module.SetPosition(m_pos) module.SetPosition(m_pos)
print "module position:",m_pos
# create a pad and add it to the module # create a pad array and add it to the module
n = 1 n = 1
for y in range (0,10): for y in range (0,10):
for x in range (0,10): for x in range (0,10):
pad = D_PAD(module) pad = D_PAD(module)
pad.SetDrillSize(size_0_6mm) pad.SetDrillSize(size_0_6mm)
pt = wxPoint(FromMM(x*2),FromMM(y*2)) pad.SetSize(size_1_0mm)
pt = wxPointMM(1.27*x,1.27*y)
pad.SetPos0(pt); pad.SetPos0(pt);
pad.SetPosition(pt) #pad.SetPosition(pt)
pad.SetPadName(str(n)) pad.SetPadName(str(n))
module.Add(pad) module.Add(pad)
n+=1 n+=1
...@@ -43,3 +45,5 @@ for m in pcb.GetModules(): ...@@ -43,3 +45,5 @@ for m in pcb.GetModules():
for p in m.GetPads(): for p in m.GetPads():
print p.GetPadName(),p.GetPosition(), p.GetOffset() print p.GetPadName(),p.GetPosition(), p.GetOffset()
# pcb.GetDesignSettings()
\ No newline at end of file
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
def GetPads(self): return self.m_Pads def GetPads(self): return self.m_Pads
def GetDrawings(self): return self.m_Drawings def GetDrawings(self): return self.m_Drawings
def GetReferenceObj(self): return self.m_Reference
#def SaveToLibrary(self,filename): #def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self) # return SaveModuleToLibrary(filename,self)
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <wx_python_helpers.h> #include <wx_python_helpers.h>
#include <class_board_item.h> #include <class_board_item.h>
#include <class_board_connected_item.h> #include <class_board_connected_item.h>
#include <class_board_design_settings.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_track.h> #include <class_track.h>
...@@ -78,6 +79,7 @@ ...@@ -78,6 +79,7 @@
%include <class_board_item.h> %include <class_board_item.h>
%include <class_board_connected_item.h> %include <class_board_connected_item.h>
%include <class_board_design_settings.h>
%include <class_board.h> %include <class_board.h>
%include <class_module.h> %include <class_module.h>
%include <class_track.h> %include <class_track.h>
......
...@@ -40,19 +40,19 @@ ...@@ -40,19 +40,19 @@
def FromMM(iu): def FromMM(iu):
if type(iu) in [int,float]: if type(iu) in [int,float]:
return iu / 0.00254 return int(iu / 0.00254)
elif type(iu) in [wxPoint,wxSize]: elif type(iu) in [wxPoint,wxSize]:
return tuple(map(FromMM,iu)) return tuple(map(FromMM,iu))
def ToMils(iu): def ToMils(iu):
if type(iu) in [int,float]: if type(iu) in [int,float]:
return iu / 10.0 return int(iu / 10.0)
elif type(iu) in [wxPoint,wxSize]: elif type(iu) in [wxPoint,wxSize]:
return tuple(map(ToMils,iu)) return tuple(map(ToMils,iu))
def FromMils(iu): def FromMils(iu):
if type(iu) in [int,float]: if type(iu) in [int,float]:
return mils*10.0 return int(iu*10.0)
elif type(iu) in [wxPoint,wxSize]: elif type(iu) in [wxPoint,wxSize]:
return tuple(map(FromMils,iu)) return tuple(map(FromMils,iu))
......
...@@ -31,6 +31,10 @@ f = open(filename,"wb") ...@@ -31,6 +31,10 @@ f = open(filename,"wb")
doneOk = False doneOk = False
if (len(lines)<4000):
print "still building"
exit(0)
for l in lines: for l in lines:
if l.startswith("if version_info >= (2,6,0):"): if l.startswith("if version_info >= (2,6,0):"):
l = l.replace("version_info >= (2,6,0)","False") l = l.replace("version_info >= (2,6,0)","False")
......
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