# piece_start

Python reference for `nagasim.appearance.piece_start`. Provisional: it may change between minor versions, see [Appearance](../../appearance.md).

`nagasim.appearance.piece_start`

```python
piece_start(document: ModelDocument, name: str)
```

Where a conveyor piece starts on the floor: its position and heading.

The pose is the block's `layout_position` and `layout_rotation`, in plan
coordinates: x east and y south in metres, and a heading in degrees clockwise on screen,
0 pointing east and 90 south. A piece is drawn from here along its `path`.

Parameters
----------
document : ModelDocument
    The model, `ModelDocument.load(path)`.
name : str
    The CONVEYOR block's name.

Returns
-------
Pose or None
    `Pose(x, y, heading)`; None for a missing block, a block that is not a CONVEYOR, a
    piece with no `path` (the reference drawing shows it as a flat tile) or a path the
    engine refuses. An unplaced piece starts at (0, 0).

See Also
--------
nagasim.appearance.piece_segments : The pieces of path laid from this pose.
nagasim.appearance.piece_pose : The pose at a distance along the path.

Examples
--------
>>> from nagasim.appearance import ModelDocument, piece_start
>>> doc = ModelDocument({"blocks": [{"name": "Belt", "type": "CONVEYOR",
...     "layout_position": [2, 3], "layout_rotation": 90,
...     "params": {"type": "roller", "path": [{"straight": 4}]}}]})
>>> piece_start(doc, "Belt")
Pose(x=2.0, y=3.0, heading=90.0)
>>> piece_start(doc, "Missing") is None
True
