diff --git a/pcbnew/python/swig/units.i b/pcbnew/python/swig/units.i index 441eacac81..fd560d50a2 100644 --- a/pcbnew/python/swig/units.i +++ b/pcbnew/python/swig/units.i @@ -36,24 +36,32 @@ return float(iu) / float(IU_PER_MM) elif type(iu) in [wxPoint,wxSize]: return tuple(map(ToMM,iu)) + else: + raise TypeError("ToMM() excpects int, float, wxPoint or wxSize, instead got type " + str(type(iu))) def FromMM(mm): if type(mm) in [int,float]: return int(float(mm) * float(IU_PER_MM)) elif type(mm) in [wxPoint,wxSize]: return tuple(map(FromMM,mm)) + else: + raise TypeError("FromMM() expects int, float, wxPoint or wxSize, instead got type " + str(type(mm))) def ToMils(iu): if type(iu) in [int,float]: return float(iu) / float(IU_PER_MILS) elif type(iu) in [wxPoint,wxSize]: return tuple(map(ToMils,iu)) + else: + raise TypeError("ToMils() excpects int, float, wxPoint or wxSize, instead got type " + str(type(iu))) def FromMils(mils): if type(mils) in [int,float]: return int(float(mils)*float(IU_PER_MILS)) elif type(mils) in [wxPoint,wxSize]: return tuple(map(FromMils,mils)) + else: + raise TypeError("FromMils() excpects int, float, wxPoint or wxSize, instead got type " + str(type(mils))) def PutOnGridMM(value, gridSizeMM): thresh = FromMM(gridSizeMM)