-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmillingParameters.py
124 lines (92 loc) · 3.43 KB
/
millingParameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
'''
this file contain stuff around MillingParameters
Current tool table is stored as a plain ascii file. File format is
LinuxCNC tool table format up from version 2.4 and FloatEntry
(http://wiki.linuxcnc.org/cgi-bin/wiki.pl?MillingParameters)
File is imported and converted into a json structure.
'''
from tkSimpleDialog import *
from Tkinter import *
from tkFont import Font
from math import *
import PIL.Image
import PIL.ImageTk
from GeometricalFrame import *
import tkMessageBox
import os
import json
CR = "\n"
class MillingParameters(GeometricalFrame):
def init(self):
self.json_fn = "./millingparameters.json"
self.col_fmt = ["{:10}", "{:4d}", "{:10}", "{:05.3f}", "{:04.1f}", "{:05.1f}", "{:04.1f}", "{:5d}", "{}"]
self.colH1 = ["Material", "ToolID", "Tool", "Tool Diameter","Feed rate 1", "Feed rate 2", "Infeed rate", "Spindel-RPM", "Info"]
self.colH2 = ["(String)", "(int)", "(String)", "(mm)", "(mm/sec)", "(mm/min)", "(mm/min)", "(rpm)", "(String)"]
self.rows = []
self.__imageNames = []
self.__json = []
self.loadJSON()
self.materialList = self.getAllMaterials()
self.parameters = self.getMaterialParameterList("Metal")
#------------------------------------------------------------
# JSON handling stuff
#------------------------------------------------------------
def loadJSON (self):
print ("load {}".format(self.json_fn))
with open(self.json_fn, 'r') as f:
self.__json = json.load(f)
pass
def saveJSON(self):
print ("save {}".format(self.json_fn))
with open(self.json_fn, 'w') as f:
json.dump(self.__json, f)
pass
def getAllMaterials(self):
materials = []
for material in self.__json:
print ("Material {}".format(material))
materials.append(material)
return materials
def getMaterialParameterList(self, material):
parameters = self.__json[material]
print parameters
return parameters
#------------------------------------------------------------
# EntryGrid
#------------------------------------------------------------
#------------------------------------------------------------
# Widget logic
#------------------------------------------------------------
def _changeImage(self):
pass
def _frmIndividualContent(self):
self.init()
row = 0
#-----------------------------------------------------
# create a grid frame
#-----------------------------------------------------
self.frmTable = EntryGrid(
self.parentFrame,
self.colH1,
self.rows,
self.col_fmt,
title="Milling Parameters",
state="DISABLED"
)
self.frmTable.pack(expand=True, fill=BOTH)
#-----------------------------------------------------
self.frmButtonsIndividualContent.pack(expand=True, fill=BOTH)
pass
def __validation(self, nV, **kv):
# nothing
return True
def userInputValidation(self):
return True
def updateEntryGrid(self):
pass
def generateGCode(self):
return None
def loadMillingParameters(self):
pass
def saveMillingParameters(self):
pass