Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: octavioa on October 15, 2007, 08:54:35 AM

Title: G code help
Post by: octavioa on October 15, 2007, 08:54:35 AM
Hello all -

Newbie to CNC - please be kind.

After searching thru the archives for the past week - no luck.

I have a small PC board (1" X 2") that has 3 holes drilled in it.  It is
'step & repeated' into a 6 X 8 array.  Using "Excel" and 'copy & paste'
I have programmed the job.  Something like about 150 lines of code. 
It seems like there should be a step & repeat command to do the same thing.

Embarassing I have to admit that I was part owner in a PC board house -
just never got into the NC end of the manufacturing.

Octavio
Title: Re: G code help
Post by: jimpinder on October 17, 2007, 08:34:06 AM
Yes - I am used to programming a computer with sub-routines so I got caught as well.

There are two ways - Gcode has a subroutine call M98 and the subroutine returns to the main program with an M99 code.
You can set up a group of offsets to move the table, and then call the sub-routine to drill.

If it is just a drilling an array, then you might prefer to write a macro in visual basic, where you might like to write "for x = 1 to 6, for y = 1 to 8, drill x,y" . Thats not the whole program of course but it could be just a few lines like that. Store the macro, put your workpiece in place and just call the macro.

I have several Visual Basic macros I have written for rounding the ends of bars, thining down axles and rods etc that take information from a set of DRO's I have inserted on a page, then I can call the macro's from within any program, just for that one job - then carry on the rest of the program.

If you are drilling an array of holes, then I think the macro would be the simpler bet - is it for drilling electronics boards or something similar ?
Title: Re: G code help
Post by: octavioa on October 18, 2007, 07:45:57 AM
Thanks Jim for the reply.

Indirectly it is for a PC board.

I will search the archives for info on using VB for suroutines.

Thanks again fo the help.

Octavio


Title: Re: G code help
Post by: jimpinder on October 19, 2007, 05:41:10 AM
Have a look at the Tutorials (at the top of the page).

Follow it through to the Cantasia site and have a look at the one called "Scripting Intro" . It tells you how to do it.
Title: Re: G code help
Post by: octavioa on October 19, 2007, 08:47:05 AM
Hi Jim,

Took me a while to find what you meant by the Cantasia site - almost gave up.

But I did finally find it and WOW - There is so much info there that I'll be viewing/learning
for many, many weeks/months.

Thanks for your time/response,
Octavio