# Generate Machine Trail — Quick Guide

This tool generates the occupied strip of an implement from a line layer.

In the current code flow, it turns the input line into a buffered result, using half of the informed width as the buffer distance.

## How to use

1. Open `Cadmus > Generate Machine Trail`.
2. Select the input line layer.
3. Enter the implement size in meters.
4. If needed, enable file output and choose the destination path.
5. If needed, select a QML file to apply style to the result.
6. Run the tool.

## What the plugin actually does

- Validates that the input is a vector line layer.
- Converts the distance entered in meters to the layer unit.
- Uses `buffer_distance = implement_size / 2`.
- If the only-selected option is enabled, processes only selected features.
- Runs the `Explode -> Buffer -> Save` pipeline.
- When file output is disabled, creates the final layer in memory.
- When file output is enabled, writes to the chosen path and automatically renames if the file already exists.
- Adds the final layer to the project if it is not already loaded.
- Applies the QML style only when that option is enabled and a file is provided.

## Synchronous and asynchronous execution

- The plugin reads the global setting `async_threshold_features`.
- If the layer has more features than that threshold, it runs in an asynchronous pipeline.
- If it is below the threshold, it runs synchronously.
- In both cases, the goal is to generate the same final output layer.

## Important behavior

- The implement value cannot be `0`.
- The input must be a line layer.
- The default output name is `Rastro_implemento`.
- The result represents the strip generated by a buffer around the processed lines.
- If you do not save to file, the result stays as an in-memory layer.

## When to use it

Use this tool when you want to represent the working width of an implement from trajectories, passes, or travel lines.

It is especially useful for:

- creating an operational coverage strip;
- visualizing occupied width in the field;
- generating a derived vector product from path lines.

## Notes

- Review the layer CRS to make sure the distance conversion makes sense.
- Since the buffer uses half of the informed width, confirm that the entered value is the full implement width.
- If you want to persist the result, prefer saving as `gpkg`.
