gcode with a loop
29 Jan 2022 12:57 #233431
by mgm
gcode with a loop was created by mgm
Hello together
I tried to write a gcode with a loop, unfortunately what I expected does not happen.
When I call the code in MIDI I get to the tool change and then LCNC freezes!
I test this in the simulatin of axis in 2.8.2 in a VM.
Where is the problem?
Can someone help me?
What I want to do is to drill a row of holes and if possible with parameters to be flexible.
I tried to write a gcode with a loop, unfortunately what I expected does not happen.
When I call the code in MIDI I get to the tool change and then LCNC freezes!
I test this in the simulatin of axis in 2.8.2 in a VM.
o100 sub
#103=19 (Dicke der Platte)
#104=12 ( Tiefe der Bohrung)
#50=10 (Startpunkt 1. Bohrung)
#51=37 (Abstand von Vorderkante)
G21 (metric)
G90
G54
T3 M6
M03 S24000
G0 Z33.0000
G0 x[#50] y[#51] z25
(debug, hier bin ich)
#1 = 0
o101 do
(debug, parameter=1)
o110 if [#1 EQ 2]
#1 = 3
(msg, #1 hat value of 3)
o101 continue
o110 endif
G0 z[#103-#104]
g0 z25
#50 = [#50+32]
G0 x[#50]
#1 = [#1 LT 3]
o101 while [#1 LT 3]
(msg, loop done)
M5
o100 endsub
M2
Where is the problem?
Can someone help me?
What I want to do is to drill a row of holes and if possible with parameters to be flexible.
Please Log in or Create an account to join the conversation.
29 Jan 2022 14:54 #233441
by HansU
Replied by HansU on topic gcode with a loop
You have to increment your variable that controls the while loop:
#1 = [#1+#2]
Have a try with that:
#1 = [#1+#2]
Have a try with that:
o100 sub
#103=19 (Dicke der Platte)
#104=12 ( Tiefe der Bohrung)
#50=10 (Startpunkt 1. Bohrung)
#51=37 (Abstand von Vorderkante)
G21 (metric)
G90
G54
T3 M6
M03 S24000
G0 Z33.0000
G0 x[#50] y[#51] z25
(debug, hier bin ich)
#1 = 0
#2 = 1 (Abstand)
o101 do
(debug, parameter=1)
o110 if [#1 EQ 2]
#1 = 3
(msg, #1 hat value of 3)
o101 continue
o110 endif
G0 z[#103-#104]
g0 z25
#50 = [#50+32]
G0 x[#50]
#1 = [#1+#2]
o101 while [#1 LT 3]
(msg, loop done)
M5
o100 endsub
M2
Please Log in or Create an account to join the conversation.
29 Jan 2022 17:08 #233450
by mgm
Replied by mgm on topic gcode with a loop
Many thanks
Sometimes you look at it 100 times and can't see it!
Sometimes you look at it 100 times and can't see it!
Please Log in or Create an account to join the conversation.
Time to create page: 0.075 seconds