diff --git a/emqbit-utilities/kicad/kccomp.py b/emqbit-utilities/kicad/kccomp.py index b764844..d44e6d4 100755 --- a/emqbit-utilities/kicad/kccomp.py +++ b/emqbit-utilities/kicad/kccomp.py @@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from datetime import datetime +from math import ceil + class KcLibrary: def __init__(self, name): @@ -69,9 +71,10 @@ class KcUnit: ll = max(self.left_pins, key=lambda KcPin: len(KcPin.name)) lr = max(self.right_pins, key=lambda KcPin: len(KcPin.name)) sl = (len( ll.name + " " + part + " " + lr.name))/2 - + H = max(len(self.left_pins),len(self.right_pins),10)/2*100 - W = max(len(self.top_pins)+6,len(self.bot_pins)+6,sl)/2*100 + W = max(len(self.top_pins)*60+len(ll.name)*40+40,len(self.bot_pins)*60+len(lr.name)*40+40,sl/2*100) + W = int(ceil(W/100.0)*100) of.writelines('S ' + str(-W) + ' ' + str(-H-100) + ' ' + str(W) + ' ' + str(H+100) + ' ' + str(self.id_unit) +' 1 0 f\n')