Skip to content

piece_length_m

Python reference for nagasim.appearance.piece_length_m. Provisional: it may change between minor versions, see Appearance.

A conveyor piece's length along its path, in metres.

It is the sum of piece_segments' lengths, whatever the belt's length unit; guide_runs(length, openings, side) and the placement rules of the Appearance page take it.

Parameters:

Name Type Description Default
document ModelDocument

The model, ModelDocument.load(path).

required
name str

The CONVEYOR block's name.

required

Returns:

Type Description
float or None

The length in metres; None in the cases piece_start returns None.

See Also

nagasim.appearance.piece_segments : The segments it sums. nagasim.appearance.guide_runs : The guide stretches over this length.

Examples:

>>> from nagasim.appearance import ModelDocument, piece_length_m
>>> doc = ModelDocument({"simulation": {"length_unit": "millimeters"}, "blocks": [
...     {"name": "Belt", "type": "CONVEYOR",
...      "params": {"type": "belt", "path": [{"straight": 2500}]}}]})
>>> piece_length_m(doc, "Belt")
2.5