# Build the Molds

Each mold is a **tool**: an asset of its own, with its own life, that can be mounted on a machine. In this lesson you'll
add `M-EC25-4` and `M-EC32-2`, give each its cavities, tell Kanoa how fast each one runs on Injection Press 1, and link
each cap to the mold that makes it.

A mold is set up in three places:

| What | Where |
| --- | --- |
| The mold, its cavities and its cycle rate on each machine | **Configuration → Ops → Tooling**: the tool's **Details**, **Positions** and **Cycle Rates** tabs |
| Which mold each cap needs on the press | **Configuration → Ops → Materials**, **Required Tooling** tab |
| A different rate for one cap with one mold (only if it needs one) | **Configuration → Ops → Materials**, **Production Rates** tab: edit the cap's rate and pick the **Tool** |

## Add the 4-Cavity Mold

::embed-section{src="../../../kanoa-ops/tooling/tools.md#adding-a-tool" collapsed="true" summary="Reference Materials: Adding a tool - Every field on the Details tab."}

:::action[Add M-EC25-4]

1. Navigate to **Configuration → Ops → Tooling** and click **Add a tool** (**+**).
2. On the **Details** tab, set **Tooling type** first, then enter the other fields below. Leave every field that isn't
   listed at the value it shows.

   | Field | Value |
   | --- | --- |
   | Name | `M-EC25-4` |
   | Tooling type | `Mold` |
   | Location | `CoreForge\Philadelphia\Molding` |
   | Life measured in | `Cycles` |
   | PM interval | `20000` |
   | Warn at % | `90` |

3. Click **Save**.

:::

Each tooling type has its own defaults for a new tool, set in the **Tool types** editor (see [Tool
Types](../../../kanoa-ops/tooling/tools.md#tool-types)). Picking **Mold** pre-fills its defaults: **Has positions**,
**Holds inserts** and **Scales output** are ticked, and **Life measured in** is *Cycles*. Every tooling type uses the
same Details tab; only these starting values differ.

The **Location** puts the mold in the Molding area, but what limits where it can be mounted is the location's **site**,
Philadelphia: the mold can go on any machine in Philadelphia that uses tooling, in any area. Injection Press 1 is the
only one today, which is why only it is offered. Its name must also be unique within the site, because a machine's tag
can mount a tool by name. With a PM every 20,000 shots and a warning at 90%, it will be *Due for PM* at 18,000 shots.

## Add Its Cavities

::embed-section{src="../../../kanoa-ops/tooling/positions.md" collapsed="true" summary="Reference Materials: Positions - Cavities, nests and stations, and blocked versus retired."}

:::action[Add four cavities]

1. On the **Positions** tab, click **Add position** four times.
2. Number the positions `1` to `4`, set each **Type** to `Cavity` and **Parts per cycle** to `1`.
3. Leave **Item (family tools)** empty on every cavity, then click **Save positions**.

:::

**Parts per cycle** counts parts: each cavity makes one cap a shot. A cavity with no item makes whatever item is
running. You'll set items on cavities only for a **family mold**, where different cavities make different caps, in [A
Family Mold](./6-a-family-mold.md).

## Set Its Cycle Rate on Injection Press 1

:::action[Set M-EC25-4's cycle rate]

1. On the **Cycle Rates** tab, pick `Injection Press 1` as the **Machine**.
2. Enter a **Cycle rate** of `6`, set **Per** to `Minute`, and click **Save rate**.

:::

The cycle rate is set per machine, because the same mold can run faster on one press than another. Only Philadelphia's
machines that use tooling are offered.

With `M-EC25-4` mounted, Injection Press 1's standard rate for `EC-25` will be 6 shots × 4 caps = **24 a minute**,
instead of the 20 from the press maker's quote.

## Add the 2-Cavity Mold

`M-EC32-2` makes the bigger cap. Its PM interval is set very low, so that you can see it come due in
[Tool Life](./4-tool-life.md) without waiting days. A real mold's interval is tens of thousands of shots.

:::action[Add M-EC32-2]

1. Click **Add a tool** (**+**) again and enter:

   | Field | Value |
   | --- | --- |
   | Name | `M-EC32-2` |
   | Tooling type | `Mold` |
   | Location | `CoreForge\Philadelphia\Molding` |
   | Life measured in | `Cycles` |
   | PM interval | `60` |
   | Warn at % | `80` |

2. Click **Save**.
3. On the **Positions** tab, add two positions numbered `1` and `2`, each a `Cavity` with **Parts per cycle** `1` and no
   item, and click **Save positions**.
4. On the **Cycle Rates** tab, pick `Injection Press 1`, enter `5` per `Minute`, and click **Save rate**.

:::

With `M-EC32-2` mounted, Injection Press 1's standard rate for `EC-32` will be 5 shots × 2 caps = **10 a minute**.

## Link Each Cap to Its Mold

The cavities say what a mold makes each shot, but nothing so far says that `EC-25` is made in `M-EC25-4`. That link is the
cap's **required tooling**. With it, an operator who starts an `EC-25` run without `M-EC25-4` on the press is warned,
and operations scheduled for `EC-25` reserve the mold.

::embed-section{src="../../../kanoa-ops/tooling/required-tooling.md#setting-it-up" collapsed="true" summary="Reference Materials: Required Tooling - Every field of the Required Tooling editor."}

:::action[Require M-EC25-4 for EC-25 and M-EC32-2 for EC-32]

1. Navigate to **Configuration → Ops → Materials** and select the **Required Tooling** tab.
2. Pick `EC-25` as the **Item** and click **Add a required tool** (**+**).
3. Set **Machine** to `CoreForge\Philadelphia\Molding\Injection Press 1`, **Needs** to *A specific tool* and **Tool** to
   `M-EC25-4`. Leave **Required** and **Enabled** ticked, and click **Save**.
4. Pick `EC-32` as the **Item**, and add `M-EC32-2` the same way.

:::

The list's **Check** column checks that the tool you picked can actually make the item, from the items on the tool's
cavities. It's empty when there's nothing to fix, and shows a warning when every cavity of the tool is set to a
different item.

Both rows are empty here. You left **Item (family tools)** empty on every cavity, and a cavity with no item makes
whatever item is running, so either mold can make either cap. It would warn if you required a family mold whose
cavities were all set to, say, `EC-32` for `EC-25`: that mold can never make an `EC-25`, so the requirement points at the
wrong tool.

Nothing has changed on Injection Press 1 yet: neither mold is mounted.

## Keep Each Mold on Its Press

The molds were built for Injection Press 1's platen and clamp. Philadelphia only has the one press today, but when a
second one arrives, nothing would stop someone mounting `M-EC25-4` on it. A **fit rule** says where a tool may be
mounted. A mold with no rules fits any machine in its site that uses tooling; once it has one, it only goes where its
rules allow.

::embed-section{src="../../../kanoa-ops/tooling/fit-rules.md#what-a-rule-says" collapsed="true" summary="Reference Materials: Fit Rules - What each field of a rule means."}

:::action[Keep both molds on Injection Press 1]

1. Navigate to **Configuration → Ops → Tooling**, select `M-EC25-4` and click the edit button.
2. Select the **Fits On** tab. It says *No rules: this tool fits any machine in its site that uses tooling*.
3. Leave **For** as *This tool* and **Fits** as *A machine*, set **On** to
   `CoreForge > Philadelphia > Molding > Injection Press 1`, leave **Enabled** ticked, and click **Save rule**.
4. Close the editor, open `M-EC32-2`, and add the same rule on its **Fits On** tab.

:::

The tab now says *This tool only mounts where one of these rules allows*. Mounting either mold on any other machine is
refused, and the scheduler won't reserve it for one. Leave **For** as *This tool*: *Every Mold* would put the rule on
every mold the plant has, including ones built for other presses.

:::check

Copy this script into the Ignition Designer Script Console (**Tools → Script Console**) and run it. It checks that
`M-EC25-4` and `M-EC32-2` are enabled Molds in the Molding area with their life in cycles and the PM intervals and
warnings above, that they have four and two cavities making 1 cap each with no item, that their cycle rates on
`Injection Press 1` are 6 and 5 a minute, that `EC-25` and `EC-32` require them on `Injection Press 1`, and that each
mold has a fit rule for `Injection Press 1`. Each check prints PASS or FAIL with what to fix. It doesn't change anything.

<details>
<summary>Show the check script</summary>

::check-script{src="ops/12-tooling/2-build-the-molds.py" title="checkLesson-buildTheMolds.py"}

</details>

:::
