Hello Guest it is April 19, 2024, 10:41:46 AM

Author Topic: loops in loops  (Read 2344 times)

0 Members and 1 Guest are viewing this topic.

loops in loops
« on: February 05, 2013, 12:51:01 PM »
I’m trying to cut multiple hearts on the same metal sheet. I omitted the part of the code that works ok. Getting a loop within a loop seems to be the challenge.


M98 P2 L4      (Main program calls for O2 to move axis 5 times)
M0



O2         (moves axis to different part of sheet to carve heart)
M98 P1 L32        (Calls O1 to cut heart in 0.1mm increments through ¼”metal)
#2=[#2-38]      (advances axis counter)
G52  Y#2      (moves axis to next heart in line)
M99

#1= -0.1
O1         (sub for carving hearts)
Bunch of lines of gcode that inscribe heart 
#1=[#1-.01]      (advances depth by 0.1mm increments)
M99

When I do this, the tool path generator will outline the number of hearts along the y axis but will not move beyond cutting the first. Help,valentines day is soon and I have three daughters.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: loops in loops
« Reply #1 on: February 05, 2013, 09:04:58 PM »
IF you are just Dry running the code for checking the code the display will show all the offsets BUT will only repeat the first section. It is a glitch in Mach3's toolpath code.

It should cut as programmed.  

(;-)TP
Re: loops in loops
« Reply #2 on: February 07, 2013, 08:32:11 PM »
Tried tonight and results were worse than expected. It would not go past first heart. Also it would randomly start at 0 or -10 on the z. Restarting Mach 3 will make it start at 0.

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: loops in loops
« Reply #3 on: February 08, 2013, 04:24:38 AM »
The highlighted red code should be inside the sub.  its in no mans land there.  Also make sure you have an end of line on the last line of the code.

Graham

O2         (moves axis to different part of sheet to carve heart)
M98 P1 L32        (Calls O1 to cut heart in 0.1mm increments through ¼”metal)
#2=[#2-38]      (advances axis counter)
G52  Y#2      (moves axis to next heart in line)
M99

#1= -0.1

O1         (sub for carving hearts)
Bunch of lines of gcode that inscribe heart
#1=[#1-.01]      (advances depth by 0.1mm increments)
M99
Without engineers the world stops