Commit e837a271 authored by Guillaume Seguin's avatar Guillaume Seguin

Add option to track currently printing layer in 3D view (#487)

parent 235c53f1
...@@ -301,8 +301,11 @@ class GcodeViewMainWrapper(object): ...@@ -301,8 +301,11 @@ class GcodeViewMainWrapper(object):
def addgcodehighlight(self, *a): def addgcodehighlight(self, *a):
pass pass
def setlayer(self, *a): def setlayer(self, layer):
pass if layer in self.model.layer_idxs_map:
viz_layer = self.model.layer_idxs_map[layer]
self.parent.model.num_layers_to_draw = viz_layer
wx.CallAfter(self.Refresh)
def addfile(self, gcode = None, showall = False): def addfile(self, gcode = None, showall = False):
self.model = create_model(self.root.settings.light3d self.model = create_model(self.root.settings.light3d
......
...@@ -133,6 +133,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -133,6 +133,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.settings._add(ComboSetting("mainviz", "2D", ["2D", "3D", "None"], _("Main visualization"), _("Select visualization for main window."), "UI"), self.reload_ui) self.settings._add(ComboSetting("mainviz", "2D", ["2D", "3D", "None"], _("Main visualization"), _("Select visualization for main window."), "UI"), self.reload_ui)
self.settings._add(BooleanSetting("viz3d", False, _("Use 3D in GCode viewer window"), _("Use 3D mode instead of 2D layered mode in the visualization window"), "UI"), self.reload_ui) self.settings._add(BooleanSetting("viz3d", False, _("Use 3D in GCode viewer window"), _("Use 3D mode instead of 2D layered mode in the visualization window"), "UI"), self.reload_ui)
self.settings._add(BooleanSetting("light3d", True, _("Use a lighter 3D visualization"), _("Use a lighter visualization with simple lines instead of extruded paths for 3D viewer"), "UI")) self.settings._add(BooleanSetting("light3d", True, _("Use a lighter 3D visualization"), _("Use a lighter visualization with simple lines instead of extruded paths for 3D viewer"), "UI"))
self.settings._add(BooleanSetting("trackcurrentlayer3d", False, _("Track current layer in main 3D view"), _("Track the currently printing layer in the main 3D visualization"), "UI"))
self.settings._add(BooleanSetting("tempgraph", True, _("Display temperature graph"), _("Display time-lapse temperature graph"), "UI"), self.reload_ui) self.settings._add(BooleanSetting("tempgraph", True, _("Display temperature graph"), _("Display time-lapse temperature graph"), "UI"), self.reload_ui)
self.settings._add(BooleanSetting("tempgauges", False, _("Display temperature gauges"), _("Display graphical gauges for temperatures visualization"), "UI"), self.reload_ui) self.settings._add(BooleanSetting("tempgauges", False, _("Display temperature gauges"), _("Display graphical gauges for temperatures visualization"), "UI"), self.reload_ui)
self.settings._add(BooleanSetting("lockbox", False, _("Display interface lock checkbox"), _("Display a checkbox that, when check, locks most of Pronterface"), "UI"), self.reload_ui) self.settings._add(BooleanSetting("lockbox", False, _("Display interface lock checkbox"), _("Display a checkbox that, when check, locks most of Pronterface"), "UI"), self.reload_ui)
...@@ -446,7 +447,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -446,7 +447,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
layerz = self.fgcode.all_layers[newlayer].z layerz = self.fgcode.all_layers[newlayer].z
if layerz is not None: if layerz is not None:
self.curlayer = layerz self.curlayer = layerz
wx.CallAfter(self.gviz.setlayer, newlayer) if self.settings.mainviz != "3D" or self.settings.trackcurrentlayer3d:
wx.CallAfter(self.gviz.setlayer, newlayer)
def do_pront_extrude(self, l = ""): def do_pront_extrude(self, l = ""):
feed = self.settings.e_feedrate feed = self.settings.e_feedrate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment