Completed the calculation of the mill parameters
[vtf.git] / vtf.py
blob07a4785e03b759f37781a4d54f0383fd8287a6f4
1 #!/usr/bin/env python
3 # system include
4 import sys, os, re
6 # PyQt4 include
7 from PyQt4 import QtGui, QtCore
9 # Specific include
10 from vtf_gui import Ui_Vtf
12 class VtfWindow(Ui_Vtf):
13 def __init__(self):
14 self.giri = 0
15 self.denti = 1
16 self.ava_dente = 0.0
17 self.vel_ava = 0.0
18 self.diametro = 0.0
19 self.vel_taglio = 0.0
21 def FinalizeGui(self):
22 QtCore.QObject.connect(ui.SP_Denti, QtCore.SIGNAL("valueChanged (int)"), self.DentiMod)
23 QtCore.QObject.connect(ui.LE_Diametro, QtCore.SIGNAL("textChanged (QString)"), self.DiamMod)
24 QtCore.QObject.connect(ui.LE_VelTaglio, QtCore.SIGNAL("textChanged (QString)"), self.VelTaglioMod)
25 QtCore.QObject.connect(ui.LE_AvaDente, QtCore.SIGNAL("textChanged (QString)"), self.AvaDentMod)
27 def UpdateVel(self):
28 # Calcolo il numero di giri
29 # Controllo che tutti i valori necessari siano diversi da zero
30 if self.vel_taglio == 0 or self.diametro == 0:
31 return
32 giri_min = int((self.vel_taglio * 1000) / self.diametro / 3.14)
33 ui.LE_Giri.setText(str(giri_min))
34 self.giri = giri_min
35 self.UpdateAv()
37 def UpdateAv(self):
38 if self.giri == 0 or self.ava_dente == 0:
39 return
40 ava_min = self.giri * self.denti * self.ava_dente
41 ui.LE_Avanzamento.setText(str(ava_min))
44 def DentiMod(self, i):
45 if i == 0:
46 return
47 self.denti = i
48 self.UpdateVel()
50 def DiamMod(self, text):
51 try:
52 self.diametro = float(text)
53 self.UpdateVel()
54 except:
55 ui.LE_Diametro.setText(text[:-1])
57 def VelTaglioMod(self, text):
58 try:
59 self.vel_taglio = float(text)
60 self.UpdateVel()
61 except:
62 ui.LE_VelTaglio.setText(text[:-1])
64 def AvaDentMod(self, text):
65 try:
66 self.ava_dente = float(text)
67 self.UpdateVel()
68 except:
69 ui.LE_AvaDente.setText(text[:-1])
73 app = QtGui.QApplication(sys.argv)
74 window = QtGui.QDialog()
75 ui = VtfWindow()
76 ui.setupUi(window)
77 ui.FinalizeGui()
78 window.show()
79 sys.exit(app.exec_())