# Setting up a machine

A machine profile is everything ReliefCAM needs to know about your router to write a file it will
run safely. Every generated G-code file stays inside every limit in the profile.

## What every G-code file is checked for

Before a G-code file can be downloaded, it is checked against the profile and against the relief:

- **Rapids only above the work** — no rapid move passes through material.
- **Feeds and spindle speeds inside your machine's limits.**
- **Straight moves only** — no arcs, ramps or helical entries.
- **Lines short enough for a GRBL buffer** — 80 characters or fewer.
- **Cut in a simulator** — the toolpath is cut into virtual stock and compared with the relief you
  asked for. If the tool would go deeper than the tolerance anywhere, the job fails and the credit is
  returned.

## Controller

Choose the controller your machine runs. It decides the dialect of the G-code: the header, the
spindle and tool-change lines, the comment style and the number format. See the guide for your
controller under [Guides](https://reliefcam.com/docs).

## Work area

The X, Y and Z travel your machine can actually use. A piece larger than the X and Y travel, less
the margin you set in the project, is split into tiles that each fit.

## Feeds, speeds and rapids

- **Maximum XY and Z feed** — no cutting move in the file is faster.
- **Rapid rate** — used to estimate the job time; your controller decides how fast a rapid runs.
- **Spindle range** — each tool's speed must fall inside it. If your spindle is switched by hand,
  set spindle control to none and ReliefCAM writes no spindle commands.
- **Spin-up dwell** — how long to wait after starting the spindle before the first cut.

## Heights

**Safe Z** is the height every rapid move across the work happens at. It is measured from the top
of the stock, so it must clear any clamps. Rapids never pass through material: the only rapid below
safe Z is the descent to 1 mm above the stock before a plunge.

## Units and numbers

The output units (millimetres or inches) are what the file is written in, whatever units you read
the screen in. The number of decimal places, line numbers, the comment style and the file extension
can be set to suit your controller or sender. Every line is kept to 80 characters or fewer, because
that is the size of a GRBL line buffer.

## Tool changes

When a job uses more than one tool, the profile decides how the change happens:

- **One file per tool** — every operation gets its own file. Run them in order, changing the tool
  and setting its Z zero between files. This works on every controller.
- **M6 and pause** — one file; at each change the spindle stops, the file asks for the next tool
  (`T` and `M6`), and pauses (`M0`) until you resume.
- **M6 with G43 length offset** — one file; the tool length comes from the controller's tool table.
  Only for controllers that support it, and only if your tool table is set up.

## Start and end G-code

Anything you type here is copied into the file exactly as written, at the start and at the end. It is
not checked. Use it for things your machine needs — a probe routine, a dust-extractor relay — and
test it on its own first.
