Fix units.i and add some extra wrappers wxSizeMM, wxSizeMils wxRectMM wxRectMils

This commit is contained in:
Miguel Angel Ajo 2012-04-08 16:59:12 +02:00
parent be15057977
commit 946ddbaa08
2 changed files with 24 additions and 2 deletions

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python2.7
import pcbnew
from pcbnew import *
size_0_6mm = wxSize(FromMM(0.6),FromMM(0.6))
size_0_6mm = wxSizeMM(0.6,0.6)
# create a blank board

View File

@ -50,9 +50,30 @@
elif type(iu) in [wxPoint,wxSize]:
return tuple(map(ToMils,iu))
def FromMils(mils):
def FromMils(iu):
if type(iu) in [int,float]:
return mils*10.0
elif type(iu) in [wxPoint,wxSize]:
return tuple(map(FromMils,iu))
def wxSizeMM(mmx,mmy): return wxSize(FromMM(mmx),FromMM(mmy))
def wxSizeMils(mmx,mmy): return wxSize(FromMils(mmx),FromMils(mmy))
def wxPointMM(mmx,mmy): return wxPoint(FromMM(mmx),FromMM(mmy))
def wxPointMils(mmx,mmy): return wxPoint(FromMils(mmx),FromMils(mmy))
def wxRectMM(x,y,wx,wy):
x = int(FromMM(x))
y = int(FromMM(y))
wx = int(FromMM(wx))
wy = int (FromMM(wy))
return wxRect(x,y,wx,wy)
def wxRectMils(x,y,wx,wy):
x = int(FromMils(x))
y = int(FromMils(y))
wx = int(FromMils(wx))
wy = int (FromMils(wy))
return wxRect(x,y,wx,wy)
}