Skip to main content

Module scene

Module scene 

Source
Expand description

What a machine looks like, as data. A machine never renders; a front end draws these parts. Coordinates in metres: x to the right, y into the depth, z up.

Structs§

Aabb
A box with its edges along the scene’s axes: an obstacle, or a part of the machine that can hit one (Machine::collision_bodies). Metres, in scene coordinates.
Arrow
A force that acts at a place in the machine, drawn as an arrow: on what (owner_key, a translation key) and how much, in newtons, along the scene’s axes.
Capsule
A capsule: every point within radius of the segment from from to to. A slanted rod, arm or shaft as a part that can hit an obstacle (Machine::collision_capsules), where a box along the scene’s axes around it would be up to its length wider than it. Metres, in scene coordinates.
Label
A live value shown in the 3D view next to the part it belongs to, e.g. a motor’s speed. Both keys are translation keys; the front end formats “owner value unit”.
Obstacle
An obstacle of the config ([[obstacles]]), and whether a part of the machine touches it now. With effects.crash it pushes back on a part that goes into it with stiffness (N/m) times the depth and damping (N s/m) times the speed into it.
Part
Scene

Enums§

Shape

Constants§

BELT_COLOR
The colour of a belt strip at pretension; its highlight shifts it.
MOTOR_PART
The id of a motor’s housing in the scene (drive_unit): the k-th such part is motor k’s, and the simulation colours it by the warmth of that motor’s winding.

Functions§

belt
Draws a belt along a path in the x-z plane at depth y: one strip per path segment, and teeth at a fixed spacing of belt length counted from the start of the path.
belt_along
belt with the belt length of each path point given (along, rising) rather than taken from the drawn path: for a drawn path that is not the belt’s length, e.g. a span drawn sagging larger than it is. Each tooth keeps its place in belt length and sits on the drawn segment whose ends’ belt lengths hold it, at the same share between them.
drive_unit
Draws a motor with gearbox and belt pulley at centre (x, z), the pulley in the belt plane at depth y and the motor behind it. A cross on the pulley turns with the pulley, a bar on the hub turns with the motor shaft, so both speeds can be seen.
heat_color
The colour of the heat scale at a temperature rise of heat times the rated one: cold blue, yellow at half, red at the rated rise, and magenta beyond it.
idler
Draws a free-running pulley with a bar that shows its rotation.
on_circle
A point on a circle, for laying a belt path around a pulley. turn is in radians from +x.
part_color
The colour a 3D view draws a part in: where its warmth is computed (Part::heat) the heat scale in its place; otherwise its own colour, shifted towards red by belt tension above pretension (highlight up to 1, at twice the pretension) and towards blue below it (-1 at no tension).
scene_boxes
The boxes among parts (as a machine draws them in its scene) whose id is one of ids, turned or not: what Machine::collision_bodies takes for the parts that move with the tool. A machine passes only the parts it needs: drawing the whole scene every base step made the live check about three times as slow as the run without it.