# Cutting Diagrams

## Computing Cutting Diagrams

Cutting diagrams can be solved by a class of algorithms known as [**Bin Packing**](https://en.wikipedia.org/wiki/Bin_packing_problem), albeit with a few twists. We are looking for an *optimal* cutting plan, but what is optimal? The criterion most often used to define optimality is the *least number of bins* necessary to pack a set of boxes. Other criteria to optimize include the size and number of offcuts produced (one large is better than many small), the total length of needed cuts, the number of times the panel needs to be rotated, the number of top-level through cuts, ...

Our cutting diagram algorithm includes further restrictions to the general problem:

* all cuts must be **guillotine cuts**, that is they must cut through the panel or the offcut and cannot be stopped in the middle or make turns.
* parts to be placed onto a panel may or may not be rotated by 90° depending upon the material (wood **grain direction** or none).
* the generation must be **deterministic**, that is, it must always give the same solution for the same input. The cutting diagram is not saved in the model, but recomputed every time.

{% hint style="warning" %}
Cutting diagrams are not available for material of type **Solid Wood**, because they are not meaningful in that context.
{% endhint %}

## Limitations

Bin Packing problems are notoriously difficult. Even if we cannot guarantee to find a perfect solution, our algorithm tries very hard to find an acceptable solution.

{% hint style="warning" %}
Cutting diagrams that do not look as you expected do not constitute bugs, and should not be reported as such.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opencutlist.org/features/parts/parts-list/cutting-diagrams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
