mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Create UsePrevProbeMeasure.py
I wrote this plugin to override the G29 in the start code. When used, instead of probing the bed, it retrieves the last probing measurement from EEPROM and ensures bed leveling is activated.
This commit is contained in:
parent
78ee666919
commit
e04dc2dcb1
1 changed files with 46 additions and 0 deletions
46
plugins/PostProcessingPlugin/scripts/UsePrevProbeMeasure.py
Normal file
46
plugins/PostProcessingPlugin/scripts/UsePrevProbeMeasure.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Cura PostProcessingPlugin
|
||||
# Author: Amanda de Castilho
|
||||
# Date: January 5,2019
|
||||
|
||||
# Description: This plugin overrides probing command and inserts code to ensure
|
||||
# previous probe measurements are loaded and bed leveling enabled
|
||||
# (searches for G29 and replaces it with M501 & M420 S1)
|
||||
# *** Assumes G29 is in the start code, will do nothing if it isn't ***
|
||||
|
||||
from ..Script import Script
|
||||
|
||||
class UsePrevProbeMeasure(Script):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def getSettingDataString(self):
|
||||
return """{
|
||||
"name": "Use Previous Probe Measurements",
|
||||
"key": "UsePrevProbeMeasure",
|
||||
"metadata": {},
|
||||
"version": 2,
|
||||
"settings":
|
||||
{
|
||||
"usePrevMeas":
|
||||
{
|
||||
"label": "Use last measurement?",
|
||||
"description": "Selecting this will remove the G29 probing command and instead ensure previous measurements are loaded and enabled",
|
||||
"type": "bool",
|
||||
"default_value": false
|
||||
}
|
||||
}
|
||||
}"""
|
||||
|
||||
def execute(self, data):
|
||||
text = "M501 ;load bed level data\nM420 S1 ;enable bed leveling"
|
||||
if self.getSettingValueByKey("usePrevMeas"):
|
||||
for layer in data:
|
||||
layer_index = data.index(layer)
|
||||
lines = layer.split("\n")
|
||||
for line in lines:
|
||||
if line.startswith("G29"):
|
||||
line_index = lines.index(line)
|
||||
lines[line_index] = text
|
||||
final_lines = "\n".join(lines)
|
||||
data[layer_index] = final_lines
|
||||
return data
|
Loading…
Add table
Add a link
Reference in a new issue