Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: haydn on February 07, 2011, 06:15:28 PM

Title: Nesting Parts
Post by: haydn on February 07, 2011, 06:15:28 PM
I have several items of code which were nested using using fanuc code. I want to run them on mach3 but it can't handle the fanuc variables.  Does anyone know a work around for this? The parts are nested in rows and columns, it's the # variable that spits it back out, example code below.

Thanks

(Standard Fanuc)

(3 rows 2 columns)
(x step 50, y step 40)

O100 (PART1.NC)
 
G90 G17
G80 G49 G40
G54
G91 G28 Z0
G90
M01
N1 M6 T1
(T1 ENDMILL DIA 6.0 R0. MM )
G90 G00 G40 G54
G43 H1 D31 G0 X7.5 Y-3. Z10. S1000 M3
M8
#21 = 0
WHILE [#21 LT 3] DO 1
#22 = 0
WHILE [#22 LT 2] DO 2

(PROFILE)

G0 X7.5 Y-3. Z10.
   Z2.
G1 Z-3. F33
   X30. F100
G3 X33. Y0. R3.
G1 Y20.
G3 X30. Y23. R3.
G1 X0.
G3 X-3. Y20. R3.
G1 Y0.
G3 X0. Y-3. R3.
G1 X7.5
G0 Z10.
G10G91 L2 P1 X50. Y0. Z0.
G90
#22 = #22 + 1
G1
END 2
G10G91 L2 P1 X-100. Y40. Z0.
G90
#21 = #21 + 1
G1
END 1
G10G91 L2 P1 X0. Y-120. Z0.
G90
M30
Title: Re: Nesting Parts
Post by: BR549 on February 07, 2011, 08:20:17 PM
It is not the # variables that is the problem, it is the conditional code that is the problem.  Mach does not do conditional code
Title: Re: Nesting Parts
Post by: kf2qd on February 09, 2011, 05:38:57 PM
You need to change the section that offsets the parts - it looks to me to be a 3 x 4 array pattern that it is cutting. you have 3 positions in X 0, 50 and 100, and 4 posuitions in Y 0,40, 80 ,120


so where your while statements are you would need to put something like this (THis may not work as written, just looked at your code and then read the book) I would be more likely to use work offsets as there are some other advantages.

(position 1)
M98 P001
G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X-100. Y40. Z0.G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X-100. Y40. Z0.M98 P001
G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X50. Y0. Z0.
M98 P001
G10G91 L2 P1 X-100. Y40. Z0.
M98 P001
G10G91 LM98 P0012 P1 X0. Y-120. Z0.
END
and replace  where (profile) is in the code
and stick  an M99 whereright after the G0 Z10.0