Hello Guest it is April 18, 2024, 03:36:41 PM

Author Topic: Excel Gcode generator: To drill n holes at n(x,y) at a n(x,y) depths  (Read 3669 times)

0 Members and 1 Guest are viewing this topic.

Offline B2

*
  •  3 3
    • View Profile
Thought I should share my first Gcode.   It was written to drill a lot of holes at locations of my choice.  I needed to do a lot of these so I wrote an Excel spread sheet to generate the Gcode (lots of comments).    I was building a dolly for my mill from 4 steel plates and wanted to drill caster mounting holes plus some others at each end of each plate.  So I needed a new program for each end of each plate (8 programs) each with > 16 holes that need to precisely match the hole locations in one of the other plates!  I ran these programs while the mill was still on the pallet!  Assembled the 4 steel plates to the dolly casters to make a "picture frame," mounted the mill to this and wheeled it into a tight area in my basement, then unmounted the dolly and put the mill base on the dolly before mounting the mill to the base.

Attached is my a spread sheet to generate an arbitrary number of drill holes at your defined locations plus a few notes and examples. The depth of each hole can even vary, but I did not do this.   The locations are pasted or typed into the colored box cells area (T139 to V162)  at the lower right side of the spread sheet and then these locations first appear above the colored cells in a column and also appear in the lines of Gcode at the left of the spread sheet.  The code is located at the left side of the spread sheet between cell locations A1 to P172 .  Just copy these cells and paste them into notepad to strip out the Excel control codes.  (Don't copy the column containing the  /*/) (There should be no tabs generated, but there is white space that Gcode execution ignores.)

The concept is that a subroutine (cell: A51, code line O9052) is called to supply the hole data  and then a subroutine is called (spread sheet cell:A31, code line O9051) to do the drilling, this is then repeated.  The program loops until done with all "n" holes.  You have to specify n and supply n(x,y) location values.  The spread sheet assembles the code commands with the specific data to be used into the individual lines of code.   So the main program is really very short. 

Modify as you like:  I was moving a large piece of steel and so the clamps were high.  So the z-height retract position is high before going on  to the next hole location.

Have fun,
Dave

PS.  I have attached the spread sheet and a number of Gcode txt files I used to drill the 4  steel plates used to make my dolly. (~ 80 holes).

Have fun,

Dave

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Excellent work Dave, than you for sharing it with the community.

Tweakie.

btw. Welcome.
PEACE