Fix offset of initial layer height

It would detect the height of the raft by looking at what the first Z coordinate is that it encounters on layer 0. This Z coordinate also includes the initial layer height though. If you pause lower than the initial layer height (but higher than 0), you'd expect to pause in the initial layer.
This commit is contained in:
Ghostkeeper 2018-08-17 11:24:39 +02:00
parent 9f190590b1
commit 6740c2bee9
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -28,7 +28,7 @@ class PauseAtHeight(Script):
"pause_height":
{
"label": "Pause Height",
"description": "At what height should the pause occur",
"description": "At what height should the pause occur?",
"unit": "mm",
"type": "float",
"default_value": 5.0,
@ -39,7 +39,7 @@ class PauseAtHeight(Script):
"pause_layer":
{
"label": "Pause Layer",
"description": "At what layer should the pause occur",
"description": "At what layer should the pause occur?",
"type": "int",
"value": "math.floor((pause_height - 0.27) / 0.1) + 1",
"minimum_value": "0",
@ -142,13 +142,14 @@ class PauseAtHeight(Script):
standby_temperature = self.getSettingValueByKey("standby_temperature")
firmware_retract = Application.getInstance().getGlobalContainerStack().getProperty("machine_firmware_retract", "value")
control_temperatures = Application.getInstance().getGlobalContainerStack().getProperty("machine_nozzle_temp_enabled", "value")
initial_layer_height = Application.getInstance().getGlobalContainerStack().getProperty("layer_height_0", "value")
is_griffin = False
# T = ExtruderManager.getInstance().getActiveExtruderStack().getProperty("material_print_temperature", "value")
# use offset to calculate the current height: <current_height> = <current_z> - <layer_0_z>
layer_0_z = 0.
layer_0_z = 0
current_z = 0
got_first_g_cmd_on_layer_0 = False
current_t = 0 #Tracks the current extruder for tracking the target temperature.
@ -195,11 +196,10 @@ class PauseAtHeight(Script):
# This block is executed once, the first time there is a G
# command, to get the z offset (z for first positive layer)
if not got_first_g_cmd_on_layer_0:
layer_0_z = current_z
layer_0_z = current_z - initial_layer_height
got_first_g_cmd_on_layer_0 = True
current_height = current_z - layer_0_z
if current_height < pause_height:
break # Try the next layer.