<commit_before>Face-Mill is a CNC programming utility that creates a climb milling CNC program which can be used to machine a rectangular flat surface.

In order to execute this program, you must first be able to navigate your computer's file directory from a console, and you must have Ruby 2.0.0 installed. Other Ruby versions may work as well, but are untested.

To execute this program, first download the .zip file and extract the contents to a directory of your choice. Then, access that directory from your console and execute:

```bash
ruby Face-Mill.rb
```

You will then be prompted to provide geometry and machining parameters. Type in your parameter value and press enter. Once you have finished providing inputs, a CNC program will appear in your console. This program only controls feed motions and feedrate speeds. Other control-specific parameters, such as spindle speed, coolant control, tool numbers, etc. will have to be manually added to this program before running it in the CNC machine.

CNC Machine Setup:
The tool will rapidly approach the workpiece in the +X direction from the -X direction. It will then start cutting in the +Y direction. On the machine, X=0 and Y=0 should be set to the furthest -X and -Y point on the workpiece, with empty space on the -X side of the workpiece. Before running your CNC program, move the tool to the empty space to the -X side of the workpiece, and set your tool at the Z depth for your desired axial depth of cut.

Here is a preview of a toolpath generated by Face-Mill:
![Toolpath Preview](/Toolpath-Preview.png)

Here is a video example of a CNC mill running a program generated by Face-Mill:
[![Face Milling Demo](http://img.youtube.com/vi/z4QGTZHnAik/0.jpg)](http://www.youtube.com/watch?v=z4QGTZHnAik)

Here is an example of a console session:

ruby Face-Mill.rb

What is the length of the material to be face-milled in the X direction?
3.0

What is the length of the material to be face-milled in the Y direction?
3.0

What is the tool radius?
0.125

What is the radial depth of cut?
0.225

What is the feedrate?
15.0

At the end of the program, the tool will retract to a safe height above the material before rapid motion to (X=0, Y=0).
What is the safe height for rapid XY motion?
0.25

Here is your CNC program: (Edit this to add spindle speed, coolant control, tool numbers, etc. as necessary)

   G0X-0.25Y-0.25  
   G1X0.1Y0.1F15.0  
   G1Y2.9  
   G1X2.9  
   G1Y0.1  
   G1X0.325  
   G1Y2.675  
   G1X2.675  
   G1Y0.325  
   G1X0.55  
   G1Y2.45  
   G1X2.45  
   G1Y0.55  
   G1X0.775  
   G1Y2.225  
   G1X2.225  
   G1Y0.775  
   G1X1.0  
   G1Y2.0  
   G1X2.0  
   G1Y1.0  
   G1X1.225  
   G1Y1.775  
   G1X1.775  
   G1Y1.225  
   G1X1.45  
   G1Y1.55  
   G1X1.55  
   G1Y1.45  
   G91G0Z0.25  
   G90  
   G0X0.0Y0.0  

This application was authored by <NAME> in 2015-2016. To contribute to this code base, create a pull request to https://github.com/edwardsCNC/Face-Mill<commit_msg>Added to toolpath caption for better clarity<commit_after>Face-Mill is a CNC programming utility that creates a climb milling CNC program which can be used to machine a rectangular flat surface.

In order to execute this program, you must first be able to navigate your computer's file directory from a console, and you must have Ruby 2.0.0 installed. Other Ruby versions may work as well, but are untested.

To execute this program, first download the .zip file and extract the contents to a directory of your choice. Then, access that directory from your console and execute:

```bash
ruby Face-Mill.rb
```

You will then be prompted to provide geometry and machining parameters. Type in your parameter value and press enter. Once you have finished providing inputs, a CNC program will appear in your console. This program only controls feed motions and feedrate speeds. Other control-specific parameters, such as spindle speed, coolant control, tool numbers, etc. will have to be manually added to this program before running it in the CNC machine.

CNC Machine Setup:
The tool will rapidly approach the workpiece in the +X direction from the -X direction. It will then start cutting in the +Y direction. On the machine, X=0 and Y=0 should be set to the furthest -X and -Y point on the workpiece, with empty space on the -X side of the workpiece. Before running your CNC program, move the tool to the empty space to the -X side of the workpiece, and set your tool at the Z depth for your desired axial depth of cut.

Here is a preview image of a toolpath generated by Face-Mill. The view is from a diagonal perspective to the flat surface of the face. Feed motions are represented with white lines.
![Toolpath Preview](/Toolpath-Preview.png)

Here is a video example of a CNC mill running a program generated by Face-Mill:
[![Face Milling Demo](http://img.youtube.com/vi/z4QGTZHnAik/0.jpg)](http://www.youtube.com/watch?v=z4QGTZHnAik)

Here is an example of a console session:

ruby Face-Mill.rb

What is the length of the material to be face-milled in the X direction?
3.0

What is the length of the material to be face-milled in the Y direction?
3.0

What is the tool radius?
0.125

What is the radial depth of cut?
0.225

What is the feedrate?
15.0

At the end of the program, the tool will retract to a safe height above the material before rapid motion to (X=0, Y=0).
What is the safe height for rapid XY motion?
0.25

Here is your CNC program: (Edit this to add spindle speed, coolant control, tool numbers, etc. as necessary)

   G0X-0.25Y-0.25  
   G1X0.1Y0.1F15.0  
   G1Y2.9  
   G1X2.9  
   G1Y0.1  
   G1X0.325  
   G1Y2.675  
   G1X2.675  
   G1Y0.325  
   G1X0.55  
   G1Y2.45  
   G1X2.45  
   G1Y0.55  
   G1X0.775  
   G1Y2.225  
   G1X2.225  
   G1Y0.775  
   G1X1.0  
   G1Y2.0  
   G1X2.0  
   G1Y1.0  
   G1X1.225  
   G1Y1.775  
   G1X1.775  
   G1Y1.225  
   G1X1.45  
   G1Y1.55  
   G1X1.55  
   G1Y1.45  
   G91G0Z0.25  
   G90  
   G0X0.0Y0.0  

This application was authored by <NAME> in 2015-2016. To contribute to this code base, create a pull request to https://github.com/edwardsCNC/Face-Mill
{'fraction_non_alphanumeric': 0.0574052812858783, 'fraction_numerical': 0.05806134164343119, 'mean_word_length': 3.131436314363144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3030497', 'n_tokens_mistral': 2137, 'n_tokens_neox': 1977, 'n_words': 913}