I am trying to use the value of `line_width` in my custom post-processor script, however, the value always returns 0.4, even if I change it to something else in the GUI.
I even tried a clean install with only one printer with everything set to something else than 0.4, however, I still get this value when querying line_width.
I use the following code (also attached as plugin):
from collections import OrderedDict
from UM.Extension import Extension
from UM.Application import Application
from UM.Settings.SettingDefinition import SettingDefinition
from UM.Settings.InstanceContainer import InstanceContainer
from UM.Settings.DefinitionContainer import DefinitionContainer
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Logger import Logger
class TestPlugin(Extension):
def log(self, level, message):
Logger.log(level, f"TEST: {message}")
def __init__(self):
super().__init__()
self._application = Application.getInstance()
self._i18n_catalog = None
self._application.getOutputDeviceManager().writeStarted.connect(self._filterGcode)
def _filterGcode(self, output_device):
scene = self._application.getController().getScene()
self.log('d', "trying the global container")
global_container_stack = self._application.getGlobalContainerStack()
if not global_container_stack:
self.log('d', "no global container stack found")
return
# get setting from Cura
layer_height = global_container_stack.getProperty("layer_height", "value")
self.log('d', f"Layer height: {layer_height}")
I suspect that I somehow the line_width in the global container stack has other values as well, however, I have very little idea of how the container structure is build up. Should I be using a different container? What am I doing wrong? And if somebody could explain to me, what is even a container??
TestPlugin.zip