Hello Guest it is March 29, 2024, 09:48:05 AM

Author Topic: M98 to make multiple different parts on the same sheet.  (Read 4408 times)

0 Members and 1 Guest are viewing this topic.

M98 to make multiple different parts on the same sheet.
« on: April 01, 2012, 12:30:36 PM »
Does anybody have an M98 guide? I found out the hard way, for example, that the (external file) subroutine doesn't belong in the same directory as the calling code, but in the MACH3/subroutines directory. Also, I figured out external subroutines don't work if there isn't an invisible carriage return after the M99 in the called routine. Now I can call up the SAME subroutine (cuts one part) and use M52 to duplicate it 10 times at different parts of the sheet. I can repeat this with a different part on a different sheet. As long as all the parts are the same, no problem. But if I call several routines for several different parts on the same sheet, the whole thing gets messed up. Parts beyond the first part show a tool path with those nasty large loops (not circles) for G2 arcs which suggest that the absolule coordinates have been wrongly set with G90.1. All the parts are using the same absolute coordinates and all the parts are similar. What could cause a subroutine to be somehow corrupted by running a prior subroutine?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M98 to make multiple different parts on the same sheet.
« Reply #1 on: April 01, 2012, 01:21:07 PM »
Are you using tool comp in any of your files??  Can you post an example of a complete program that fails?

(;-) TP
Re: M98 to make multiple different parts on the same sheet.
« Reply #2 on: April 01, 2012, 02:32:04 PM »
Yes, I have cutter radius compenstation in each of the subroutine files. I switch it off again with G40 when the routine returns, else G52 will not work. The first two calls to the same subroutine are fine, but the call to the next one has those funny arcs in it. Thanks for helping!

Calling program first:
% cut full sheet
% =========================================
G17 (cancel tool length offset)
G80 (cancel motion mode)
G50 (reset all scale vectors to 1.0)
G49 (cancel tool length offset)
G40 (cancel cutter radius compensation)
G90 (set absolute distance mode)
G21 (set units to mm)
G40 (cancel cutter offset)
G52 X0 Y0
% G54 (apply zero point offset)
G0 Z6

% cut first frame
M98 (front_frame.txt)
G40
G52 X80
M98 (front_frame.txt)
G40
G52 X0 Y30
M98 (rear_frame.txt)
M30 (stop and rewind)

front_frame.txt:

G0 Z10
F100
% cut bolt slots
% =========================================
G0 X-20.3 Y15
G1 Z0
G1 X-20.5 Y9
G0 Z6
G0 X20.3  Y15
G1 Z0
G1 X20.5  Y9
G0 Z6

% cut holes
% =========================================
F25
G0 X24  Y-4
G1 Z-.1
G0 Z6
G0 X-24 Y-4
G1 Z-.1
G0 Z6

% cut outline
% =========================================
G0 X0 Y10    (go to lead-in position)
G41 P1.59   (apply cutter offset)
F100
G1 Z0
G1 X0  Y6   (start cut at bottom of V)
G1 X20 Y20   (cut right side of V)
G1 X22 Y20   (cut short flat top)
G0 Z0.5      (leave cling-on of 0.5mm)
G2 X24 Y18 R2.5   (top right rounded corner)
G1 Z0
G1 X28 Y0   (right edge to zero mark)
G1 X30 Y-8   (continuation of right edge)
G2 X28 Y-10 R2   (rounded lower right corner)
G1 X6 Y-6
G1 X-6 Y-6
G1 X-28 Y-10
G2 X-30 Y-8 R2   (rounded left corner)
G1 X-28 Y0   (left edge to zero mark)
G1 X-24 Y18   (left edge to top)
G0 Z0.5
G2 X-22 Y20 R2.5 (rounded top left)   
G1 Z0
G1 X-20 Y20   (short flat top left)
G1 X0 Y6
G1 X2 Y7.4
G0 Z10
M99

rear_frame.txt:
G0 Z10
% Rear frame
% =========================================
F100
% cut clip slot
% =========================================
G0 X28.5 Y22
G1 Z0
G1 X28.5 Y14
G1 X31.5 Y14
G1 X31.5 Y22
G0 Z6
% cut outline
% =========================================
G41 P1.59              (apply cutter offset)
G0 X-4 Y-4
G1 Z0
G1 X0 Y4
G1 X10 Y27
G2 X14 Y28 R2.5
G1 X30 Y18
G1 X46 Y28
G2 X50 Y27 R2.5
G1 X60 Y4
G2 X58 Y2 R1.7
G1 X36 Y6.8
G1 X24 Y6.8
G1 X2 Y2
F25
G0 Z0.2
G2 X0 Y4 R1.7
G1 X0 Y4
G0 Z10
M99


   

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M98 to make multiple different parts on the same sheet.
« Reply #3 on: April 01, 2012, 08:14:46 PM »
AH that part of toolcomp and SUBs is broken.

If you want it to work you would need to program the subs WITHOUT ToolComp. Then it will run OK.

BUT NOT with tool comp active beyond the first nested loop.

AND it is NOT going to be fixed in MAch3, Before you ask.(;-)

(;-) TP
Re: M98 to make multiple different parts on the same sheet.
« Reply #4 on: April 02, 2012, 12:34:59 AM »
OK. Well I least I won't spend further hours wrackjng my brain to figure out what I did wrong. Thanks.
Re: M98 to make multiple different parts on the same sheet.
« Reply #5 on: October 02, 2012, 03:47:56 AM »
i don't know i think it could work did you try to put the g40 in the sub program before the m99 instead of the main program before the g52 also call a g90 and a g90.1 in the sub

you could try a code like this but i use g10 line




IF YOU WANT TO DO A MULTI FIXTURE PROGRAM YOU COULD TRY THIS


O0001
#101=1(tool number)
#102=-.02(TAPPER BLOCK)
G90
G10  L2 P1 X-10. Y-10.  Z-10.(G54 WORK OFFSET)
G10  L2 P2 X-10. Y-11.  Z-10.(G55 WORK OFFSET)
G10  L2 P3 X-10. Y-12.  Z-10.(G56 WORK OFFSET)
T#101 M6
M0
#1=54(STARTING OFFSET)
G0 G90 G#1 X0.5 Y0. S1200 M3
G43 H#101 D#101 Z1.
G0 Z0.1
M98 P0002 L3 (HOW MANY TIMES IT TAKES YOU TO GET TO FINAL OFFSET)
G0 Z10.
M30

O0002
G0 G90 G90.1 G#1 X0.5 Y0. S1200 M3
G0 Z0.1
g1 z-.1
G1 X5. Z[-.1+#102] F20.(TAPPER BLOCK)
G0 Z.1
#1=[#1+1](CURENT OFFSET PLUS 1)
M99
%