243 self.connect() |
255 self.connect() |
244 if self.filename is not None: |
256 if self.filename is not None: |
245 self.do_load(self.filename) |
257 self.do_load(self.filename) |
246 if self.settings.monitor: |
258 if self.settings.monitor: |
247 self.update_monitor() |
259 self.update_monitor() |
|
260 |
|
261 # -------------------------------------------------------------- |
|
262 # Lasercutter methods |
|
263 # -------------------------------------------------------------- |
|
264 |
|
265 def on_lc_printfile(self, event): |
|
266 # lc print button |
|
267 self.log("Priming Z axis to initial focus") |
|
268 line = self.precmd("G1 Z%.2f" % (self.settings.lc_z_focus + self.lc_material_thickness.GetValue())) |
|
269 wx.CallAfter(self.onecmd, line) |
|
270 self.lc_printing = True |
|
271 wx.CallAfter(self.printfile, None) |
|
272 |
|
273 def endcb_lasercut(self): |
|
274 # LASERCUT: Now check if we should do another print pass? |
|
275 self.log("event: endcb_lasercut") |
|
276 if self.lc_printing: |
|
277 self.log(" -> checking if something to do...") |
|
278 pass_count = self.lc_pass_count.GetValue() |
|
279 if pass_count > 1: |
|
280 time.sleep(0.5) |
|
281 if self.pass_current < pass_count: |
|
282 self.pass_current += 1 |
|
283 self.log("Starting lasercut pass # %i of %i" % (self.pass_current, pass_count)) |
|
284 if self.lc_pass_zdiff.GetValue() != 0: |
|
285 # move Z focus |
|
286 new_z = self.settings.lc_z_focus + self.lc_material_thickness.GetValue() + ( |
|
287 self.lc_pass_zdiff.GetValue() * (self.pass_current - 1)) |
|
288 self.log("Re-Positioning laser focus by %.1f mm to %.1f" % (self.lc_pass_zdiff.GetValue(), new_z)) |
|
289 line = self.precmd("G1 Z%.2f" % (new_z)) |
|
290 self.onecmd(line) |
|
291 time.sleep(0.5) |
|
292 |
|
293 # "click" print button again |
|
294 tmp = self.pass_current |
|
295 self.printfile(None) |
|
296 self.pass_current = tmp |
|
297 else: |
|
298 self.lc_printing = False |
|
299 wx.CallAfter(self.lc_printbtn.Enable) |
|
300 wx.CallAfter(self.lc_printbtn.SetLabel, _("Start cutting")) |
|
301 |
|
302 self.log("Resetting Z axis to initial focus") |
|
303 line = self.precmd("G1 Z%.2f" % (self.settings.lc_z_focus + self.lc_material_thickness.GetValue())) |
|
304 self.onecmd(line) |
|
305 else: |
|
306 self.lc_printing = False |
|
307 wx.CallAfter(self.lc_printbtn.Enable) |
|
308 wx.CallAfter(self.lc_printbtn.SetLabel, _("Start cutting")) |
|
309 |
|
310 |
|
311 def update_lc_settings(self, key, value): |
|
312 return True |
|
313 |
|
314 def _lc_add_settings(self, size): |
|
315 # first add the lasercutter options |
|
316 self.settings._add(StaticTextSetting("separator_lc_general", "General laser settings", "", group = "Laser")) |
|
317 self.settings._add(BooleanSetting("lc_melzi_hack", False, "Use Melzi M571 Hack instead M3/M5", "no description :)", "Laser"), self.update_lc_settings) |
|
318 self.settings._add(SpinSetting("lc_travel_speed", 120, 1, 300, "Travel speed in mm/s", "", "Laser"), self.update_lc_settings) |
|
319 self.settings._add(SpinSetting("lc_engrave_speed", 10, 1, 300, "Engrave speed in mm/s", "", "Laser"), self.update_lc_settings) |
|
320 self.settings._add(SpinSetting("lc_z_focus", 16, -80, 80, "Laser Z focus position", "", "Laser"), self.update_lc_settings) |
|
321 self.settings._add(SpinSetting("lc_pass_count", 1, 0, 20, "Default Number of cutting passes", "", "Laser"), self.reload_ui) |
|
322 self.settings._add(FloatSpinSetting("lc_pass_zdiff", -0.25, -2.0, 2.0, "Default Z movement after each cut", "", "Laser"), self.reload_ui) |
|
323 self.settings._add(FloatSpinSetting("lc_material_thickness", 4.0, 0.0, 80.0, "Default Material Thickness", "", "Laser"), self.reload_ui) |
|
324 |
|
325 self.settings._add(StaticTextSetting("separator_lc_bitmap", "PNG Bitmap processing", "", group = "Laser")) |
|
326 self.settings._add(FloatSpinSetting("lc_bitmap_speed_factor", 1.0, 0.1, 2.0, "Engrave speed factor", "", "Laser"), self.update_lc_settings) |
|
327 self.settings._add(SpinSetting("lc_dpi", 300, 25, 600, "Image DPI", "Image resolution for scaling", "Laser"), self.update_lc_settings) |
|
328 self.settings._add(SpinSetting("lc_grey_threshold", 0, 0, 255, "Grey threshold value for RGB", "", "Laser"), self.update_lc_settings) |
|
329 self.settings._add(BooleanSetting("lc_invert_cut", True, "PNG: Invert grey threshold", "Invert laser on/off logic", "Laser"), self.update_lc_settings) |
|
330 self.settings._add(BooleanSetting("lc_change_dir", True, "PNG: Change direction", "Engrave in both directions on Y Axis", "Laser"), self.update_lc_settings) |
|
331 |
|
332 self.settings._add(StaticTextSetting("separator_lc_hpgl", "HPGL processing", "", group = "Laser")) |
|
333 self.settings._add(FloatSpinSetting("lc_hpgl_speed_factor", 1.0, 0.1, 2.0, "Engrave speed factor", "", "Laser"), self.update_lc_settings) |
|
334 |
|
335 self.settings._add(StaticTextSetting("separator_lc_svg", "SVG processing", "", group = "Laser")) |
|
336 self.settings._add(FloatSpinSetting("lc_svg_speed_factor", 1.0, 0.1, 2.0, "Engrave speed factor", "", "Laser"), self.update_lc_settings) |
|
337 self.settings._add(FloatSpinSetting("lc_svg_smoothness", 0.2, 0.1, 10.0, "Smoothness", "Smoothness of curves (smaller value = smoother curve)", "Laser"), self.update_lc_settings) |
|
338 self.settings._add(SpinSetting("lc_svg_width", 50, 1, 9999, "Width (mm)", "Image width", "Laser"), self.update_lc_settings) |
|
339 self.settings._add(SpinSetting("lc_svg_height", 50, 1, 9999, "Height (mm)", "Image height", "Laser"), self.update_lc_settings) |
|
340 self.settings._add(ComboSetting("lc_svg_scalemode", "original", ["original", "scale", "stretch"], "Scaling mode", "scale/stretch to above dimensions", "Laser"), self.update_lc_settings) |
|
341 self.settings._add(BooleanSetting("lc_svg_offset", True, "Calculate offset to X=0, Y=0", "If enabled, move image to origin position", "Laser"), self.update_lc_settings) |
|
342 |
248 |
343 |
249 # -------------------------------------------------------------- |
344 # -------------------------------------------------------------- |
250 # Main interface handling |
345 # Main interface handling |
251 # -------------------------------------------------------------- |
346 # -------------------------------------------------------------- |
252 |
347 |
942 Printrun. If not, see <http://www.gnu.org/licenses/>.""" |
1037 Printrun. If not, see <http://www.gnu.org/licenses/>.""" |
943 |
1038 |
944 info.SetLicence(licence) |
1039 info.SetLicence(licence) |
945 info.AddDeveloper('Kliment Yanev') |
1040 info.AddDeveloper('Kliment Yanev') |
946 info.AddDeveloper('Guillaume Seguin') |
1041 info.AddDeveloper('Guillaume Seguin') |
|
1042 info.AddDeveloper('Malte Di Donato') |
947 |
1043 |
948 wx.adv.AboutBox(info) |
1044 wx.adv.AboutBox(info) |
949 |
1045 |
950 # -------------------------------------------------------------- |
1046 # -------------------------------------------------------------- |
951 # Settings & command line handling (including update callbacks) |
1047 # Settings & command line handling (including update callbacks) |
952 # -------------------------------------------------------------- |
1048 # -------------------------------------------------------------- |
953 |
1049 |
954 def _add_settings(self, size): |
1050 def _add_settings(self, size): |
|
1051 self._lc_add_settings(size) |
|
1052 |
955 self.settings._add(BooleanSetting("monitor", True, _("Monitor printer status"), _("Regularly monitor printer temperatures (required to have functional temperature graph or gauges)"), "Printer"), self.update_monitor) |
1053 self.settings._add(BooleanSetting("monitor", True, _("Monitor printer status"), _("Regularly monitor printer temperatures (required to have functional temperature graph or gauges)"), "Printer"), self.update_monitor) |
956 self.settings._add(StringSetting("simarrange_path", "", _("Simarrange command"), _("Path to the simarrange binary to use in the STL plater"), "External")) |
1054 self.settings._add(StringSetting("simarrange_path", "", _("Simarrange command"), _("Path to the simarrange binary to use in the STL plater"), "External")) |
957 self.settings._add(BooleanSetting("circular_bed", False, _("Circular build platform"), _("Draw a circular (or oval) build platform instead of a rectangular one"), "Printer"), self.update_bed_viz) |
1055 self.settings._add(BooleanSetting("circular_bed", False, _("Circular build platform"), _("Draw a circular (or oval) build platform instead of a rectangular one"), "Printer"), self.update_bed_viz) |
958 self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer")) |
1056 self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer")) |
959 self.settings._add(BooleanSetting("clamp_jogging", False, _("Clamp manual moves"), _("Prevent manual moves from leaving the specified build dimensions"), "Printer")) |
1057 self.settings._add(BooleanSetting("clamp_jogging", False, _("Clamp manual moves"), _("Prevent manual moves from leaving the specified build dimensions"), "Printer")) |