gcode filtering issue/question
21 Mar 2024 01:43 - 21 Mar 2024 01:47 #296420
by shasse
gcode filtering issue/question was created by shasse
I am using qtplasmac to run a fiber laser and I'd like to make a gcode program that can test various laser focus heights. I wrote the following that uses a while loop and materials via a magic comment inside the while loop:
but when I load the gcode file the filter adds an M02 right at the beginning:
There might be several problems with my approach, including basic gcode errors. However, I am primarily wondering about the feasibility of using a magic comment for dynamic materials inside of an O101 while loop. Secondarily I'm wondering what I messed up to have the M02 inserted at the beginning of the file.
Thanks!
Scott
G20 G64P0.004 G40 G49 G80 G90 G92.1 G94 G97 (preamble)
#3 = 0.5 (square size)
#4 = 0.25 (buffer between squares)
#5 = 10 (number of vertical squares)
#6 = 0.04 (starting cut height)
#7 = 0.005 (cut height increment)
#8 = 20 (feed rate)
#9 = 50 (cut amps is laser power 0-100)
G0 X0 Y0 (move to start position)
#1 = 0 (set counter to 0)
o101 while [#1 LT #5]
G0 X0 Y[[#3 + #4] * #1]
(a temporary material with varying cut height)
(o=0, ph=#6, pd=0, ch=[#6 + [#7 * #1], fr=#8, ca=#9)
(wait for QtPlasmaC to confirm that it successfully changed materials)
M66 P3 L3 Q1
f#<_hal[plasmac.cut-feed-rate]>
M3 $0 S#<_hal[qtplasmac.cut_amps-s]>
G1 X0 Y[[[#3 + #4] * #1] + #3]
G1 X#3 Y[[[#3 + #4] * #1] + #3]
G1 X#3 Y[[#3 + #4] * #1]
G1 X0 Y[[#3 + #4] * #1]
m5 $0
#1 = [#1 + 1] (increment the counter)
o101 endwhile
G20 G64P0.004 G40 G49 G80 G90 G92.1 G94 G97 (postamble)
m2
but when I load the gcode file the filter adds an M02 right at the beginning:
M02 (end program)
G20 G64P0.004 G40 G49 G80 G90 G92.1 G94 G97 (preamble)
#3 = 0.5 (square size)
#4 = 0.25 (buffer between squares)
#5 = 10 (number of vertical squares)
#6 = 0.04 (starting cut height)
#7 = 0.005 (cut height increment)
#8 = 20 (feed rate)
#9 = 50 (cut amps is laser power 0-100)
G53 G0 Z[[#<_ini[axis_z]max_limit> - 0.19685000000000002] * 1.000] (Z just below max height)
G00 X0 Y0 (move to start position)
#1 = 0 (set counter to 0)
O101 WHILE [#1 LT #5]
G00 X0 Y[[#3 + #4] * #1]
(a temporary material with varying cut height)
;temporary material #1000000
(o=0, ph=#6, pd=0, ch=[#6 + [#7 * #1], fr=#8, ca=#9)
M190 P1000000
M66 P3 L3 Q1
(wait for QtPlasmaC to confirm that it successfully changed materials)
M66 P3 L3 Q1
F#<_hal[plasmac.cut-feed-rate]>
M03 $0 S#<_hal[qtplasmac.cut_amps-s]>
G01 X0 Y[[[#3 + #4] * #1] + #3]
G01 X#3 Y[[[#3 + #4] * #1] + #3]
G01 X#3 Y[[#3 + #4] * #1]
G01 X0 Y[[#3 + #4] * #1]
M05 $0
#1 = [#1 + 1] (increment the counter)
O101 ENDWHILE
G20 G64P0.004 G40 G49 G80 G90 G92.1 G94 G97 (postamble)
M02
;qtplasmac filtered G-code file
There might be several problems with my approach, including basic gcode errors. However, I am primarily wondering about the feasibility of using a magic comment for dynamic materials inside of an O101 while loop. Secondarily I'm wondering what I messed up to have the M02 inserted at the beginning of the file.
Thanks!
Scott
Last edit: 21 Mar 2024 01:47 by shasse.
Please Log in or Create an account to join the conversation.
21 Mar 2024 02:50 #296429
by phillc54
Replied by phillc54 on topic gcode filtering issue/question
The M02 is being inserted because the magic comment line cannot be interpreted correctly, it is only a comment line so I don't think that numbered parameters are valid. I may be wrong on this...
There is no message returned in the Errors and Warnings dialog because it looks like we forgot to add one...
This is what it should look like:
There is no message returned in the Errors and Warnings dialog because it looks like we forgot to add one...
This is what it should look like:
Attachments:
The following user(s) said Thank You: shasse
Please Log in or Create an account to join the conversation.
21 Mar 2024 03:25 #296433
by shasse
Replied by shasse on topic gcode filtering issue/question
Sounds like perhaps a python code to generate static gcode might be the way to go then.
Thanks!
Thanks!
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
21 Mar 2024 04:34 #296437
by phillc54
Replied by phillc54 on topic gcode filtering issue/question
Please Log in or Create an account to join the conversation.
Moderators: snowgoer540
Time to create page: 0.135 seconds