I have a router that needs to machine using 3 tolls (3mm, 2mm, 1mm diameter) first with 3mm than it needs to change the tool and continue with 2mm...

So i need to solve how to change the tool. Tool changer is home made and use a stepper motor for tool changing, it needs a line from parallel port, and when this line is UP (5 Volt, 3.3 Volt) the tool is grabbed and holded, when the line is Down (0 Volt) the tool is released and and wait for the line to go UP to grab the next tool (tool changer needs 3 seconds to release the tool and another 3 seconds to grab the tool)

After the tool has changed i need to measure the length of the tool, this is made by hitting a switch.

Tool changing and length measuring need to be done automatically.

This is a portion of code...

N2601 X-21.594 Y25.522
N2602 X-21.718 Y25.462
N2603 X-22.282 Y24.701
N2604 Z15. F20000
N2605 X0 Y0
N2606 Z85.
( Dia: 2 Raio: 1 )
N2607 T2 M6
N2608 S30000 M3
N2609 G0 X0 Y0 A0
N2610 Z5. H2
N2611 G1 X0 Y0 A-180. F5000
N2612 X-26.368 Y-24.439
N2613 Z1.
N2614 Z-2.5 F2250
N2615 X-26.097 Y-24.307 F3000
N2616 X-25.345 Y-23.772
N2617 X-24.694 Y-23.17
N2618 X-24.669 Y-23.136
N2619 X-24.42 Y-22.539

So what do i need, a macro, a brain, or something else?
Where do i start?

If you have done this before please share, i will help you too with what i can.

Thank you,
Dan