Placement¶
placement
¶
Placing one part relative to another by mating their sides, and orienting the root.
Offset
dataclass
¶
Offset(distance: float, ref: SideRef | None = None)
A distance between the two parts along their mating arrises.
With ref, a side of the first part at one end of its arris, the
distance is from ref to the side of the second part facing the same
way, measured inwards. Without, it is from the start of the first arris
(by the right-hand rule) to the start of the second one.
Orientation
dataclass
¶
Which way two sides of a part face, and where its design box lies.
facing maps the names of two adjacent sides of the part (e.g.
right_end, ref_face) to the directions they face. The design box
is moved so that its lowest corner lies at at.
flush_with
¶
The second part is flush with the side ref of the first part.
mate
¶
mate(
a: SideRef,
b: SideRef,
flush: tuple[SideRef, SideRef],
position: Position = CENTERED,
across: Position = FLUSH,
gap: float = 0.0,
angle: float = 0.0,
) -> Location
Location of b.part in the frame of a.part.
Side b lies against side a (opposite normals). The sides flush[0] (of
a.part, adjacent to a) and flush[1] (of b.part, adjacent to b)
face the same way. Along the arris where each mating side meets its
flush side, the parts are positioned by position. Across it, across
sets flush[1] back from flush[0] by a distance (coplanar by default),
or centers the parts on each other. With gap, side b lies that far
from side a; a negative gap makes the parts overlap (e.g. at a mitre).
With angle, part b is then turned by that many degrees about the normal
of side a (counterclockwise, looking at side a), around the point the
two frames share: the start of b's arris with flush[1] (or its middle,
if centered), e.g. a brace lying diagonally across the back of a door.
orient
¶
orient(
at: Point = (0.0, 0.0, 0.0), **facing: Direction
) -> Orientation
Orient the root part of an assembly by the directions two of its sides face.
E.g. a stile standing up, its back edge to the right:
orient(right_end=UP, back_edge=RIGHT). Its design box lies in the
positive octant from at.