Skip to content

look_of

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

Everything needed to draw one conveyor piece: each look field of its type, resolved.

A field the piece stores with a valid value keeps it; any other takes its default. Lengths are metres and colours are names or sRGB #RRGGBB; material() and guide_material() turn them into materials. "openings" lists the gaps in the side guides that the file stores, in metres; add exit_openings for the gaps diverts and merges cut.

Legs and drive, as the reference drawing places them: legs stand at 0.05 m from the start and then every leg_spacing metres along the path, none nearer than 0.05 m to the end; one more stands 0.05 m before the end when that is more than 0.3 m past the last leg. Each leg reaches from the floor to the underside of the rails (a leg_spacing of 0 means none). A pallet piece at or under RAISED_PALLET_M (0.2 m) high stands on the floor and has no legs by default; above it, legs every 1.5 m. The drive (drive_side under) hangs under the bed, at mid-length on a roller or pallet piece and 0.15 m from the end on a belt or chain; left or right hangs it at the same place and height beside the frame, 0.01 m outboard. Its top is 0.05 m under the conveying surface, and it never goes below the floor. A pallet's drive is always beside the frame (an under drive goes to the right), and on a low pallet piece it stands on the floor.

Parameters:

Name Type Description Default
params mapping

A CONVEYOR block's params (document.blocks[name].params).

required
factor float

Metres per unit of the piece's length unit, length_factor(document, params); it scales the openings, which the file stores in that unit, like the path.

1.0

Returns:

Type Description
dict

{field: value, ..., "openings": [{"side", "start", "end"}, ...]}; {} for a block that is not a typed conveyor piece. Never raises.

See Also

nagasim.appearance.length_factor : The factor for a piece. nagasim.appearance.material : The material a look value paints. nagasim.appearance.exit_openings : The guide gaps the exits cut.

Examples:

>>> from nagasim.appearance import look_of
>>> look = look_of({"type": "roller", "look": {"frame_color": "blue"}})
>>> look["frame_color"], look["roller_finish"], look["openings"]
('blue', 'zinc', [])