Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: RedBlob on October 15, 2007, 07:40:51 AM

Title: Strange toolpath
Post by: RedBlob on October 15, 2007, 07:40:51 AM
Hi,

I have written the following code but I don't understand why the first subroutine work good and the second make a strange toolpath ( the tool goes on a wrong path ).

If I add the thirth subroutine the path is still wrong.

Can you help me ?

Where is my error ?

Thanks.
Maurizio




(#9001 = QUOTA OFFSET ASSE X )
(#9002 = QUOTA OFFSET ASSE Y )

(--------------------------------------------------------------------------)
(                 INIZIALIZZAZIONE MACCHINA                )
(--------------------------------------------------------------------------)

(- SELEZIONE PIANO XY INTERPOLAZIONE -)
G17

(- EXACT STOP MODE -)
G61

(- ABSOLUTE DISTANCE MODE -)
G90

(- NESSUNA CORREZIONE UTENSILE -)
G40

(- MANDRINO FERMO -)
M5

(- RESET OFFSET -)
G92.1


(--------------------------------------------------------------------------)
(                 POSIZIONAMENTO IN SICUREZZA          )
(--------------------------------------------------------------------------)

G01 Z200 F3000
G01 X0 Y0 F3000
 
M3
G04 P3


(--------------------------------------------------------------------------)
(         REALIZZAZIONE CONNETTORE DB9                )
(--------------------------------------------------------------------------)


(*** CONNETTORE DB9 IN ALTO SX *** )

G01 Z10 F3000

#9001=37.25
#9002=125.50

M98 P1001 L1


(*** CONNETTORE DB9 IN ALTO DX *** )

G01 Z10 F3000

#9001=100.75
#9002=125.50

M98 P1001 L1



(--------------------------------------------------------------------------)
(                 POSIZIONAMENTO IN SICUREZZA           )
(--------------------------------------------------------------------------)

G01 Z200 F3000
G01 X0 Y0 F3000


M5

M30




(**************************************************************************)
(**************************************************************************)
(                              SUBROUTINES                                 )
(**************************************************************************)
(**************************************************************************)



(**************************************************************************)
(* CONNETTORE DB9 SU PANNELLO 2 MM                                        *)
(**************************************************************************)

O1001

G01 Z10 F3000

G01 X[#9001] Y[#9002] F3000

G01 Z2 F3000

G01 Z-1 F120

G41
G01 X[#9001+0.00] Y[#9002+5.15] F120
G01 X[#9001-6.95] Y[#9002+5.15] F120
G03 X[#9001-9.45] Y[#9002+2.65] J-2.50 F120
G01 X[#9001-8.44] Y[#9002-2.65] F120              (QUOTA CORRETTA PER ESTETICA)
G03 X[#9001-5.98] Y[#9002-5.15] I2.5 F120
G01 X[#9001+5.98] Y[#9002-5.15] F120
G03 X[#9001+8.44] Y[#9002-3.08] J2.5 F120
G01 X[#9001+9.45] Y[#9002+2.65] F120
G03 X[#9001+6.95] Y[#9002+5.15] I-2.5 F120
G01 X[#9001+0.00] Y[#9002+5.15] F120
G01 X[#9001+0.00] Y[#9002+0.00] F120
G40

G01 Z2 F3000
G01 X[#9001-12.5] Y[#9002+0.00] F3000
G01 Z-1 F120

G41
G01 X[#9001-12.5] Y[#9002+1.6] F120
G03 X[#9001-12.5] Y[#9002-1.6] J-1.6 F120
G03 X[#9001-12.5] Y[#9002+1.6] J1.6 F120
G40

G01 Z2 F3000

G01 X[#9001+12.5] Y[#9002+0.00] F3000

G01 Z-1 F120

G41
G01 X[#9001+12.50] Y[#9002+1.6] F120
G03 X[#9001+12.50] Y[#9002-1.6] J-1.6 F120
G03 X[#9001+12.50] Y[#9002+1.6] J1.6 F120
G40

G01 Z10 F3000


M99

(**************************************************************************)


Title: Re: Strange toolpath
Post by: Graham Waterworth on October 15, 2007, 08:21:22 AM
In what way is the 2nd path wrong?

The only thing I can see wrong with the code is that Mach has no reference to the tool size for the G41's, you need to put a Px.xx or a Dnn

Where x.xx is the tool diameter and nn is a tool number for the offset containing the tool diameter.

If you have programed allowing for the tool size then the G41's are not needed.

Graham.
Title: Re: Strange toolpath
Post by: Lakeside design on October 15, 2007, 08:30:31 AM
G01 Z200 ? are you in metric mode also maybe this line is doing it to you (- RESET OFFSET -)
G92.1 is there a value for the x and y
you have one of these code file I just don't work with that often
Title: Re: Strange toolpath
Post by: RedBlob on October 15, 2007, 08:33:38 AM
Hi Graham,

If you load the code on Mach 3 you will see that the first object is OK.
The second object ( called the second time from the same subroutine ) has some jump form the second toolpath to the first toolpath.
You can see this problem also from the toolpath window.

I have also tried to work on CNC but the tool has been broken from this strange return to the first object.

If I write the same program without subroutines but with only one program the second object is OK.

The same problem will occour if I repeat 3-4-5 times the same subroutine.

I think that is a problem on program but I have not understand where !!!!

(http://c:\temp\immagine.jpg)
Title: Re: Strange toolpath
Post by: Graham Waterworth on October 15, 2007, 08:56:17 AM
Try this version, but change the tool dias in the marked lines.

Graham.

%

(#9001 = QUOTA OFFSET ASSE X )
(#9002 = QUOTA OFFSET ASSE Y )

G20 G17 G90 G40 G61
G00 Z200
X0 Y0
M3
G04 P3
Z10
#9001=37.25
#9002=125.50
M98 P1001 L1
G00 Z10
#9001=100.75
#9002=125.50
M98 P1001 L1
G00 Z200
X0 Y0
M5
M30

O1001
G00 Z10
X[#9001] Y[#9002]
Z2
G01 Z-1 F120

G41 P1. (change this for your cutter dia)

X[#9001+0.00] Y[#9002+5.15]
X[#9001-6.95] Y[#9002+5.15]
G03 X[#9001-9.45] Y[#9002+2.65] J-2.50
G01 X[#9001-8.44] Y[#9002-2.65]
G03 X[#9001-5.98] Y[#9002-5.15] I2.5
G01 X[#9001+5.98] Y[#9002-5.15]
G03 X[#9001+8.44] Y[#9002-3.08] J2.5
G01 X[#9001+9.45] Y[#9002+2.65]
G03 X[#9001+6.95] Y[#9002+5.15] I-2.5
G01 X[#9001+0.00] Y[#9002+5.15]
X[#9001+0.00] Y[#9002+0.00]
G40
G00 Z2
X[#9001-12.5] Y[#9002+0.00]
G01 Z-1

G41 P1. (change this for your cutter dia)

X[#9001-12.5] Y[#9002+1.6]
G03 X[#9001-12.5] Y[#9002-1.6] J-1.6
G03 X[#9001-12.5] Y[#9002+1.6] J1.6
G40
G00 Z2
X[#9001+12.5] Y[#9002+0.00]
G01 Z-1 F120

G41 P1. (change this for your cutter dia)

X[#9001+12.50] Y[#9002+1.6]
G03 X[#9001+12.50] Y[#9002-1.6] J-1.6
G03 X[#9001+12.50] Y[#9002+1.6] J1.6
G40
G00 Z10
M99

%

Title: Re: Strange toolpath
Post by: RedBlob on October 15, 2007, 09:42:24 AM
I have tried it but have the same behavior of my program.

The first object is OK.
After the CNC goes to the second object, make the first G01 code and now go to the coordinates of first object.
The result is a jump from the second to the first object for 3 times when he work on the same object.

If I load your Gcode on Mach3 l see the jump from a object to other.

Maurizio

(http://c:\temp\immagine.jpeg)
Title: Re: Strange toolpath
Post by: Lakeside design on October 15, 2007, 09:58:02 AM
After the CNC goes to the second object, make the first G01 code and now go to the coordinates of first object.

The result is a jump from the second to the first object for 3 times when he work on the same object.
Maurizio
(http://c:\temp\immagine.jpeg)
That tells me that your code is reading the first shift as a single G91 move. Then it is going back to G90. Have you thought about just using another offset like G55 and repeat the code?
you use those funny code [#9001-12.5] I just don't work with them so I'm not much of a help

(- RESET OFFSET -)
G92.1 is reset where G92 is offset coordinates and set parameters
Title: Re: Strange toolpath
Post by: RedBlob on October 15, 2007, 10:17:11 AM
Dear Lakeside,

I haven't programmed offset or G55 function.

I use the subroutine to repeat the same object in different position ( the object can be repeated 50-60 times on the same program ).

Regards
Maurizio
Title: Re: Strange toolpath
Post by: Lakeside design on October 15, 2007, 10:27:15 AM
I only sudjested an offset to get you around this issue. I know with subprogramming you can do a lot of thing. it the call out that your using that I don't use . a lot of times I just bolt stock down and do a repeat with another offset. But I also use cad/cam where as your trying to write by hand. Which is ok but I will always mess something up with hand coding...
Title: Re: Strange toolpath
Post by: Graham Waterworth on October 15, 2007, 11:01:37 AM
OK, lets try it this way.

Graham.

%

G21 G17 G90 G40 G61
G00 Z200
X0 Y0
M3
G04 P3
Z10
G52 X37.25 Y125.50
M98 P1001 L1
G00 Z10
G52 X100.75 Y125.50
M98 P1001 L1
G00 Z200
X0 Y0
M5
M30

O1001
X0 Y0
Z2.
G01 Z-1 F120
G41 P1. (change this for your cutter dia)
X0 Y5.15
X-6.95 Y5.15
G03 X-9.45 Y2.65 J-2.50
G01 X-8.44 Y-2.65
G03 X-5.98 Y-5.15 I2.5
G01 X5.98 Y-5.15
G03 X8.44 Y-3.08 J2.5
G01 X9.45 Y2.65
G03 X6.95 Y5.15 I-2.5
G01 X0 Y5.15
X0 Y0
G40
G00 Z2.

X-12.5 Y0
G01 Z-1
G41 P1. (change this for your cutter dia)
X-12.5 Y1.6
G03 X-12.5 Y-1.6 J-1.6
G03 X-12.5 Y1.6 J1.6
G40
G00 Z2.

X12.5 Y0
G01 Z-1 F120
G41 P1. (change this for your cutter dia)
X12.50 Y1.6
G03 X12.5 Y-1.6 J-1.6
G03 X12.5 Y1.6 J1.6
G40
G00 Z2.

G52 X0 Y0
M99

%
Title: Re: Strange toolpath
Post by: RedBlob on October 15, 2007, 11:25:38 AM
Hi Graham,

thank you for your help.
I have just tested that code and it work well.
If I use the G52 code all subroutines work well and the multiple object are OK.

But if I use the programming with expression ( like [#9001+2.35]) the software work not good.

I prefer to use the expression because the position of objecs are calculated with a numeric procedure ( the code I posted is only a part of a complex program).

Do you know why my code with expression don't work well ?
There is a reason ?
I have also seen that in the preview window the tool path is not correct ..... there are a lot of white lines that are not included in my theorical path of tool.
Do you Know bugs about programming with expression ?

Thanks.
Maurizio


Title: Re: Strange toolpath
Post by: Graham Waterworth on October 15, 2007, 11:31:12 AM
I think it is the fact that you are using #9001 and above, these are normally used by the system and may be getting corrupted. Art gives no guarantee that the # numbers work in all conditions.

You can use the G52 with # numbers

E.g.

#1=100.125
#2=120.000
G52 X#1 Y#2

I would keep away from the 9000+ numbers

Graham.
Title: Re: Strange toolpath
Post by: RedBlob on October 15, 2007, 11:35:35 AM
Dear Graham,

Thanks for your help and for your time !
Best Regards.

Maurizio