Strange issue with conditional code

More
29 Nov 2023 19:08 #286810 by ckuecker
Strange issue with conditional code was created by ckuecker
Using LinuxCNC 2.10 and a Raspberry Pi 4 with the AXIS GUI. I am trying to cut a number of slots in a stack of three parts, making several passes to complete the depth.
When I load the following code, AXIS displays a rotating circle that just hangs there - sometimes if I hit ESC, it clears and I can run the code.
The cutter goes to the initial depth, and makes the cut. On the second pass, the cutter depth increases, but the program just keeps on looping, like it never sees the conditional at o110.
Any ideas? I also would like to have a means of displaying the variables in a message as the program runs.
%
(Flatware support #1)
#<count> = 3 (Number of parts)
#<width> = 0.75 (Thickness of part)
#<length> = [[#<width> * #<count>] + 0.75] (Length of cut)
#<depth> = -0.05 (Depth of each pass)
s18000 m03 (Spindle 10,000 RPM, turn on clockwise)
g20 (inch mode)
g90 (absolute mode)
g54 (fixture zero)
(First six slots)
#1 = #<depth> (current cut depth)
#2 = 0.1 (end cut depth)
g0 z[#<depth>] (initial cut depth)
o100 while [#1 LE #2]
g0 x0.45 (Start of first cut)
g0 y[#<length>] (make a cut)
g0 y0 (return to start)
#1 = [#1 + #<depth>]
o110 if [#1 GT #2]
#1 = #2
o110 endif
g0 z[#2] (go deeper)
o100 endwhile
%

Please Log in or Create an account to join the conversation.

More
29 Nov 2023 19:45 #286812 by rmu
Replied by rmu on topic Strange issue with conditional code
first, I would not cut with "G0" (use G1!)

second, you seem to start at z depth "-0.05", and add "-0.05" on each pass, and try to reach 0.1, that won't work.
The following user(s) said Thank You: ckuecker

Please Log in or Create an account to join the conversation.

More
30 Nov 2023 13:31 #286870 by ckuecker
Replied by ckuecker on topic Strange issue with conditional code
Did not know about g1. I'll try that.

Figured out my conditional problems. Writing g code is definitely not like writing C.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum