diff --git a/pcbnew/scripting/examples/createPcb.py b/pcbnew/scripting/examples/createPcb.py index f46b1f5a40..2c50ee5301 100755 --- a/pcbnew/scripting/examples/createPcb.py +++ b/pcbnew/scripting/examples/createPcb.py @@ -1,30 +1,32 @@ #!/usr/bin/env python2.7 -import pcbnew from pcbnew import * size_0_6mm = wxSizeMM(0.6,0.6) - +size_1_0mm = wxSizeMM(1.0,1.0) # create a blank board pcb = BOARD() +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)) pcb.Add(module) # add it to our pcb -m_pos = wxPoint(FromMM(50),FromMM(50)) +m_pos = wxPointMM(50,50) 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 for y in range (0,10): for x in range (0,10): pad = D_PAD(module) 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.SetPosition(pt) + #pad.SetPosition(pt) pad.SetPadName(str(n)) module.Add(pad) n+=1 @@ -43,3 +45,5 @@ for m in pcb.GetModules(): for p in m.GetPads(): print p.GetPadName(),p.GetPosition(), p.GetOffset() + +# pcb.GetDesignSettings() \ No newline at end of file diff --git a/pcbnew/scripting/module.i b/pcbnew/scripting/module.i index 942ef7a9aa..cf7cedb757 100644 --- a/pcbnew/scripting/module.i +++ b/pcbnew/scripting/module.i @@ -35,6 +35,7 @@ def GetPads(self): return self.m_Pads def GetDrawings(self): return self.m_Drawings + def GetReferenceObj(self): return self.m_Reference #def SaveToLibrary(self,filename): # return SaveModuleToLibrary(filename,self) diff --git a/pcbnew/scripting/pcbnew.i b/pcbnew/scripting/pcbnew.i index cbabab029d..ece9340af0 100644 --- a/pcbnew/scripting/pcbnew.i +++ b/pcbnew/scripting/pcbnew.i @@ -47,6 +47,7 @@ #include #include #include + #include #include #include #include @@ -78,6 +79,7 @@ %include %include +%include %include %include %include diff --git a/pcbnew/scripting/units.i b/pcbnew/scripting/units.i index 09cb6fb320..f496b42e7b 100644 --- a/pcbnew/scripting/units.i +++ b/pcbnew/scripting/units.i @@ -40,19 +40,19 @@ def FromMM(iu): if type(iu) in [int,float]: - return iu / 0.00254 + return int(iu / 0.00254) elif type(iu) in [wxPoint,wxSize]: return tuple(map(FromMM,iu)) def ToMils(iu): if type(iu) in [int,float]: - return iu / 10.0 + return int(iu / 10.0) elif type(iu) in [wxPoint,wxSize]: return tuple(map(ToMils,iu)) def FromMils(iu): if type(iu) in [int,float]: - return mils*10.0 + return int(iu*10.0) elif type(iu) in [wxPoint,wxSize]: return tuple(map(FromMils,iu)) diff --git a/scripting/fixswigimports.py b/scripting/fixswigimports.py index 484552970d..bb338c1e4c 100755 --- a/scripting/fixswigimports.py +++ b/scripting/fixswigimports.py @@ -31,6 +31,10 @@ f = open(filename,"wb") doneOk = False +if (len(lines)<4000): + print "still building" + exit(0) + for l in lines: if l.startswith("if version_info >= (2,6,0):"): l = l.replace("version_info >= (2,6,0)","False")