Skip to content

Instantly share code, notes, and snippets.

@imrahil
Last active July 16, 2018 01:20
Show Gist options
  • Save imrahil/796e13f4882310eab906 to your computer and use it in GitHub Desktop.
Save imrahil/796e13f4882310eab906 to your computer and use it in GitHub Desktop.
Parameterized GCODE Script for OctoPrint - quick and dirty bed / Z axis calibration
{% set x_count = parameters.x_count %}
{% set y_count = parameters.y_count %}
{% set x_step = printer_profile.volume.width / (x_count - 1) %}
{% set y_step = printer_profile.volume.depth / (y_count - 1) %}
{% set zhop = parameters.z_hop %}
{% set speed = parameters.travel_speed %}
{% set speed_z = parameters.z_speed %}
{% set pos_X = 0 %}
{% set pos_Y = 0 %}
M117 run {{ script.name }}
G28
G90
G1 Z{{ zhop }} F{{ speed_z }}
{% for m in range(x_count) %}
{% set pos_X = x_step * m %}
{% for n in range(y_count) %}
{% set pos_Y = y_step * n %}
G1 X{{ pos_X }} Y{{ pos_Y }} F{{ speed }}
G1 Z0
G4 P200
G1 Z{{ zhop }} F{{ speed_z }}
{% endfor %}
{% endfor %}
G28
controls:
- name: Simple bed calibration
children:
- name: Start
script: custom/calibration.gco
input:
- name: X count
default: 3
parameter: x_count
slider:
max: 10
min: 1
step: 1
- name: Y count
default: 3
parameter: y_count
slider:
max: 10
min: 1
step: 1
- name: Z hop
default: 1
parameter: z_hop
slider:
max: 4
min: 0.5
step: 0.5
- name: X/Y travel speed
default: 3000
parameter: travel_speed
- name: Z travel speed
default: 300
parameter: z_speed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment