-
Notifications
You must be signed in to change notification settings - Fork 0
/
filament.py
179 lines (158 loc) · 5.45 KB
/
filament.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# mapping adapted from https://github.com/spuder/OpenSpool/blob/main/firmware/conf.d/automation.yaml
def generate_filament_brand_code(filament_type, filament_brand, filament_variant):
filament_sub_brand = ""
filament_brand_code = ""
if filament_type == "TPU":
if filament_brand == "Bambu":
filament_brand_code = "GFU01"
filament_sub_brand = "TPU 95A"
else:
filament_brand_code = "GFU99"
filament_sub_brand = "TPU"
elif filament_type == "PLA":
if filament_brand == "PolyTerra":
filament_brand_code = "GFL01"
filament_sub_brand = "PolyTerra PLA"
elif filament_brand == "PolyLite":
filament_brand_code = "GFL00"
filament_sub_brand = "PolyLite PLA"
elif filament_brand == "Bambu":
if filament_variant == "Basic":
filament_brand_code = "GFA00"
filament_sub_brand = "PLA Basic"
elif filament_variant == "Matte":
filament_brand_code = "GFA01"
filament_sub_brand = "PLA Matte"
elif filament_variant == "Metal":
filament_brand_code = "GFA02"
filament_sub_brand = "PLA Metal"
elif filament_variant == "Impact":
filament_brand_code = "GFA03"
filament_sub_brand = "PLA Impact"
else:
filament_brand_code = "GFA00"
filament_sub_brand = "PLA Basic"
else:
filament_brand_code = "GFL99"
filament_sub_brand = "PLA"
elif filament_type == "PETG":
if filament_brand == "Overture":
filament_brand_code = "GFG99" # Placeholder code
filament_sub_brand = "PETG"
else:
filament_brand_code = "GFG99"
filament_sub_brand = "PETG"
elif filament_type == "PET-CF":
if filament_brand == "Bambu":
filament_brand_code = "GFT00"
filament_sub_brand = "PET-CF"
else:
filament_brand_code = "GFG99"
filament_sub_brand = "PET-CF"
elif filament_type == "ASA":
filament_brand_code = "GFB98"
filament_sub_brand = "ASA"
elif filament_type == "ABS":
if filament_brand == "Bambu":
filament_brand_code = "GFB00"
filament_sub_brand = "ABS"
else:
filament_brand_code = "GFB99"
filament_sub_brand = "ABS"
elif filament_type == "PC":
if filament_brand == "Bambu":
filament_brand_code = "GFC00"
filament_sub_brand = "PC"
else:
filament_brand_code = "GFC99"
filament_sub_brand = "PC"
elif filament_type == "PA":
filament_brand_code = "GFN99"
filament_sub_brand = "PA"
elif filament_type == "PA-CF":
if filament_brand == "Bambu":
filament_brand_code = "GFN03"
filament_sub_brand = "PA-CF"
else:
filament_brand_code = "GFN98"
filament_sub_brand = "PA-CF"
elif filament_type == "PLA-CF":
filament_brand_code = "GFL98"
filament_sub_brand = "PLA-CF"
elif filament_type == "PVA":
filament_brand_code = "GFS99"
filament_sub_brand = "PVA"
elif filament_type == "Support":
if filament_variant == "G":
filament_brand_code = "GFS01"
filament_sub_brand = "Support G"
elif filament_variant == "W":
filament_brand_code = "GFS00"
filament_sub_brand = "Support W"
else:
filament_brand_code = "GFS00"
filament_sub_brand = "Support W"
else:
print(f"Unknown filament type: {filament_type}")
return {"brand_code": filament_brand_code,
"sub_brand_code": filament_sub_brand
}
def generate_filament_temperatures(filament_type, filament_brand):
filament_min_temp = 150
filament_max_temp = 300
if not filament_type:
print("Skipping temperature generation as filament_type is empty.")
return
if filament_type == "TPU":
if filament_brand == "Generic":
filament_min_temp = 200
filament_max_temp = 250
else:
print(f"Unknown temperatures for TPU brand: {filament_brand}")
filament_min_temp = 200
filament_max_temp = 250
elif filament_type == "PLA":
if filament_brand == "Generic":
filament_min_temp = 190
filament_max_temp = 240
else:
print(f"Unknown temperatures for PLA brand: {filament_brand}")
filament_min_temp = 190
filament_max_temp = 240
elif filament_type == "PETG":
if filament_brand == "Generic":
filament_min_temp = 220
filament_max_temp = 270
else:
print(f"Unknown temperatures for PETG brand: {filament_brand}")
filament_min_temp = 220
filament_max_temp = 270
elif filament_type == "ASA":
if filament_brand == "Generic":
filament_min_temp = 240
filament_max_temp = 280
else:
print(f"Unknown temperatures for ASA brand: {filament_brand}")
filament_min_temp = 240
filament_max_temp = 280
elif filament_type == "PC":
if filament_brand == "Generic":
filament_min_temp = 250
filament_max_temp = 300
else:
print(f"Unknown temperatures for PC brand: {filament_brand}")
filament_min_temp = 250
filament_max_temp = 300
elif filament_type == "PA":
if filament_brand == "Generic":
filament_min_temp = 260
filament_max_temp = 300
else:
print(f"Unknown temperatures for PA brand: {filament_brand}")
filament_min_temp = 260
filament_max_temp = 300
else:
print(f"Unknown filament type: {filament_type}")
return {"filament_min_temp": filament_min_temp,
"filament_max_temp": filament_max_temp
}