# Thread: Needing method for creating duplicate parts

1. You're assuming Brian's machine has the User Macro option installed?

2. I was just working on a macro to do multiples with a g52 shift. It was gonna use IF statements and counters and would have been much longer. Dis stuff is sweet. A variation on gars in just one axis could be used on each tool instead of running the whole program and then shifting (Tim the tool man grunt here...).

3. 070825-1635 EST USA

davek:

In general I tend to use the IF THEN approach. There are some advantages for restart at an arbitrary point.

If you have multiple tools in the program, which is the usual case, then you want to write the program with a subroutine for each tool. Let these subroutines be N1000, N1100, etc.

Create a main program

%
O6666 (looping program for matrix of M by N)

#510 = 1.25 (X increment between parts)
#511 = 0.75 (Y increment between parts)

#512 = 5 (number of parts in X direction)
#513 = 10 (number of parts in Y direction)

G54
(other startup stuff )

(first tool change stuff)
#520 = 1000 (first machining subroutine)
G97 P500 (call the looping program that in turn calls N1000)

(second tool change stuff)
#520 = 1100 (second machining subroutine)
G97 P500 (call looping, and in turn it calls N1100)

(and so on.)

M30

N500

#500 = 0 (X location relative to G54, initialized to 0)
#501 = 0 (Y location relative to G54, initialized to 0)

WHILE [#501 LT #512] DO2
G52 Y-#501

WHILE [#500 LT #513] DO1
G52 X#500
G97 P#520 (Subroutine call to your BobCad program for one tool to keep clutter out of these loops)
#500 = #500 + #510
END1

#500 = 0
#501 = #501 + #511
END2

M99

N1000
....
M99

N1100
....
M99

%

There maybe times when you use the same subroutine but with different tools. For example --- roughing, finish, and chamfer.

.

4. Originally Posted by gar
070825-1635 EST USA

......If you have multiple tools in the program, which is the usual case, then you want to write the program with a subroutine for each tool. Let these subroutines be N1000, N1100, etc.....
Just a minor point but it can catch errors.

Number the subroutine to match the tool; T1 - N1000, T2 - N2000, etc., and then if your subroutine has a subroutine it becomes N1100, N2100, etc.

Also if you are using Tool Comp your 'D's match the first digit in the line numbers; N1000 - D01, etc.

5. 070825-1952 EST USA

Geof:

Good suggestion.

.

6. Can you use a GOTO (or an IFTHEN) to jump back into a DOWHILE, as in this?

O0555
#101 = 2. (CLEARANCE)
#102 = 1. (REMOVAL)
#103 = .03 (DEPTH OF CUT)
#104 = .375 (CENTER OF PART
#105 = 9. (LENGTH OF PART)
#106 = 1500. (RPM)
#107 = 30. (FEED)
G90
T84
M6
M03 S#106
G55 G0 X-1.5 Y#104
G55 G0 G90 Z#101 G43 H84
WHILE[#102GT0]DO1
N1G00 Z[#102+.4]
G55 G0 X-1.5 Y#104
G00 Z#102
G01 X [#105+1.5] F#107
IF[#102EQ0]GOTO2
#102 = [#102-#103]
END1
#102=0
GOTO1
N2
G28 G91 Z0
M09
M05
G90 G53 X-15. Y0
M30

to face a part down the center with multiple passes. I'm assuming the DOWHILE checks the variable at the beginning of it.

Youse guys are awesome.

7. This thread is proving to show that while simple gets the job done, it does not add to your experience or efficiency where it pays to have other options and the knowledge to implement it.

One note of precaution I have learned in parametric programming is when using IF/Then statements of GE, LE, EQ and finding floating decimal point errors combined with variables and math functions to calculate X,Y, Z moves. Your logic may not agree with the binary logic. This can lead to another loop through a program outside of the expected envelope with unintended results. Whole number integers will not have this problem.

DC

8. Originally Posted by One of Many
This thread is proving to show that while simple gets the job done, it does not add to your experience or efficiency where it pays to have other options and the knowledge to implement it.....DC

I think someone just took at dig at simple old me .

9. Originally Posted by Geof
a dig at simple.
Wow, I didn't see that coming....twasn't my intention, but don't you fret, you have regained the center of attention!

DC

10. Originally Posted by One of Many
.... but don't you fret, you have regained the center of attention!

DC
You mean I briefly lost it . Horrors; I am mortified.

11. Double post deleted

12. Originally Posted by Geof
You mean I briefly lost it . Horrors; I am mortified.
It was the hyper-sensative paranoia in your "Dig" response that indicated there might be a chance you felt the loss of it, real or imagined.

I think I've heard it refered to as "It's all about me" syndrome!

DC

Page 2 of 4 First 1234 Last

### About CNCzone.com

We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

### Follow us on

Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.