-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprinter_movement.cfg
122 lines (110 loc) · 3.38 KB
/
printer_movement.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
[homing_override]
axes: z
set_position_z: 0
gcode:
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'X' in params %} G28 X {% endif %}
{% if home_all or 'Y' in params %} G28 Y {% endif %}
[gcode_macro SET_CURRENT_ORIGIN]
description: Set the G-Code offset to the current location
gcode:
G92
[gcode_macro RETURN_TO_ORIGIN]
description: Move the toolhead to the current G-Code origin
gcode:
G0 Z0 ; first, move Z to zero
G0 X0 Y0 ; then, move X and Y to zero
[gcode_macro ENABLE_Z_AXIS]
description: Enables movements on the Z axis
variable_enable_z: 0 # Z AXIS STARTS AS DISABLED!
gcode:
SET_GCODE_VARIABLE MACRO=ENABLE_Z_AXIS VARIABLE=enable_z VALUE=1
RESPOND TYPE=error MSG='Z AXIS has been ENABLED.'
[gcode_macro DISABLE_Z_AXIS]
description: Disables movements on the Z axis
gcode:
SET_GCODE_VARIABLE MACRO=ENABLE_Z_AXIS VARIABLE=enable_z VALUE=0
RESPOND TYPE=error MSG='Z AXIS has been DISABLED.'
[gcode_macro G0]
description: Move the toolhead (rapid)
rename_existing: G0.1
gcode:
{% if printer['gcode_macro ENABLE_Z_AXIS'].enable_z and 'Z' in params %}
{% if 'F' in params %}
{% if 'X' in params and 'Y' in params %}
G0.1 X{params.X} Y{params.Y} Z{params.Z} F{params.F}
{% elif 'X' in params %}
G0.1 X{params.X} Z{params.Z} F{params.F}
{% elif 'Y' in params %}
G0.1 Y{params.Y} Z{params.Z} F{params.F}
{% endif %}
{% else %}
{% if 'X' in params and 'Y' in params %}
G0.1 X{params.X} Y{params.Y} Z{params.Z}
{% elif 'X' in params %}
G0.1 X{params.X} Z{params.Z}
{% elif 'Y' in params %}
G0.1 Y{params.Y} Z{params.Z}
{% endif %}
{% endif %}
{% else %}
{% if 'F' in params %}
{% if 'X' in params and 'Y' in params %}
G0.1 X{params.X} Y{params.Y} F{params.F}
{% elif 'X' in params %}
G0.1 X{params.X} F{params.F}
{% elif 'Y' in params %}
G0.1 Y{params.Y} F{params.F}
{% endif %}
{% else %}
{% if 'X' in params and 'Y' in params %}
G0.1 X{params.X} Y{params.Y}
{% elif 'X' in params %}
G0.1 X{params.X}
{% elif 'Y' in params %}
G0.1 Y{params.Y}
{% endif %}
{% endif %}
{% endif %}
[gcode_macro G1]
description: Move the toolhead (linear)
rename_existing: G1.1
gcode:
;RESPOND MSG='running G1 macro: enable_z={printer['gcode_macro ENABLE_Z_AXIS'].enable_z}'
{% if printer['gcode_macro ENABLE_Z_AXIS'].enable_z and 'Z' in params %}
{% if 'F' in params %}
{% if 'X' in params and 'Y' in params %}
G1.1 X{params.X} Y{params.Y} Z{params.Z} F{params.F}
{% elif 'X' in params %}
G1.1 X{params.X} Z{params.Z} F{params.F}
{% elif 'Y' in params %}
G1.1 Y{params.Y} Z{params.Z} F{params.F}
{% endif %}
{% else %}
{% if 'X' in params and 'Y' in params %}
G1.1 X{params.X} Y{params.Y} Z{params.Z}
{% elif 'X' in params %}
G1.1 X{params.X} Z{params.Z}
{% elif 'Y' in params %}
G1.1 Y{params.Y} Z{params.Z}
{% endif %}
{% endif %}
{% else %}
{% if 'F' in params %}
{% if 'X' in params and 'Y' in params %}
G1.1 X{params.X} Y{params.Y} F{params.F}
{% elif 'X' in params %}
G1.1 X{params.X} F{params.F}
{% elif 'Y' in params %}
G1.1 Y{params.Y} F{params.F}
{% endif %}
{% else %}
{% if 'X' in params and 'Y' in params %}
G1.1 X{params.X} Y{params.Y}
{% elif 'X' in params %}
G1.1 X{params.X}
{% elif 'Y' in params %}
G1.1 Y{params.Y}
{% endif %}
{% endif %}
{% endif %}