kumiki.drawings.drawing¶
Flat import path
kumiki/__init__.py re-exports everything on this page via from kumiki import *, so every name below is also available directly as kumiki.Drawing -- you do not need to import from the submodule path shown in the heading above.
kumiki.drawings.drawing
¶
Drawings: Drawing, Viewport, Subdivision and page sizes. The dimensions on a drawing are in measure.py.
ELEVATION_IDS
module-attribute
¶
ELEVATION_IDS: Mapping[str, ViewportId] = {'front': ViewportId('0.0.0'), 'top': ViewportId('0.0.1'), 'right': ViewportId('0.1.0'), 'preview': ViewportId('0.1.1')}
SHOP_DRAWING_IDS
module-attribute
¶
SHOP_DRAWING_IDS: Mapping[str, ViewportId] = {'front': ViewportId('0.0.0'), 'right': ViewportId('0.0.1'), 'back': ViewportId('0.0.2'), 'left': ViewportId('0.0.3'), 'preview': ViewportId('0.1')}
Drawing
dataclass
¶
Drawing(name: str, timbers: Sequence[PerfectTimberWithin] = (), drawing_id: Optional[DrawingId] = None, viewports: Optional[Sequence[Viewport]] = None, page: Optional[Page] = None, measurements: Mapping[ViewportId, Sequence[Measure]] = dict())
A drawing: a name, the timbers it draws, and its viewports.
measurements
class-attribute
instance-attribute
¶
measurements: Mapping[ViewportId, Sequence[Measure]] = field(default_factory=dict)
__post_init__
¶
Source code in kumiki/drawings/drawing.py
walk
¶
walk() -> Iterator[Tuple[ViewportId, Viewport]]
Yield every viewport with its id, depth first, parents before children.
Source code in kumiki/drawings/drawing.py
measurements_by_viewport
¶
measurements_by_viewport() -> Dict[str, Tuple[Measure, ...]]
Return the drawing's measurements, keyed by viewport id.
Source code in kumiki/drawings/drawing.py
leaves
¶
leaves() -> Iterator[Tuple[ViewportId, Viewport]]
Return every leaf viewport (one with a camera) with its id.
get_viewport_id
¶
get_viewport_id(viewport: Viewport) -> ViewportId
Return the id of viewport (its position in the tree).
Source code in kumiki/drawings/drawing.py
viewport_at
¶
viewport_at(viewport_id: ViewportId) -> Optional[Viewport]
Return the viewport with id viewport_id, or None.
Source code in kumiki/drawings/drawing.py
Page
dataclass
¶
The sheet's size in real units.
Portion
dataclass
¶
Share
dataclass
¶
Share(value: Numeric = 1)
A share of the room left by fixed-size siblings: Share(1), Share(1) split it in half.
SplitDirection
¶
Subdivision
dataclass
¶
Subdivision(direction: SplitDirection, portions: Sequence[Portion], gap: Numeric = 0)
Viewport
dataclass
¶
Viewport(label: Optional[str] = None, padding: Numeric = 0, subdivision: Optional[Subdivision] = None, measurements: Sequence[Measure] = (), rect: Optional[Rect] = None, z: int = 0)
One view on a sheet, and the views inside it.
A leaf (no subdivision) gets a camera; a container's children fill its cell. rect and z
place a floating root viewport and are ignored inside a subdivision. A viewport doesn't know its
id or position; Drawing does. Compared by identity.
is_leaf
property
¶
Return whether this is a view (gets a camera) rather than a container.
__post_init__
¶
Source code in kumiki/drawings/drawing.py
Measure
dataclass
¶
Measure(anchor_a: FeatureHandle, anchor_b: FeatureHandle, kind: Optional[MeasurementKind] = None, measure_id: Optional[MeasurementId] = None, placement: Optional[MeasurementPlacement] = None, plane: MeasurementPlaneSpec = FROM_VIEWPORT)
A dimension between two features in one viewport.
Identity is the two anchors, the kind, and measure_id (for the same pair measured more than
once). Changing a kind changes identity.
wire_anchors
¶
wire_anchors(frame: Frame) -> Optional[Tuple[FeaturePath, FeaturePath, Optional[MeasurementPlacement]]]
Return both anchors as wire paths in sorted order, with the placement to match (offset negated if
swapped), or None if either isn't in frame.
NOTE Some day we may support asymmetric measurements.
Source code in kumiki/drawings/measure.py
pair_identity
¶
pair_identity(frame: Frame) -> Optional[Tuple[Tuple, Tuple]]
Return the two anchors' identities in wire order, or None if either isn't in frame.
Source code in kumiki/drawings/measure.py
MeasurementDirection
¶
MeasurementFeature
¶
Bases: Enum
What a feature acts as, after any projection, for measuring.
MeasurementKind
dataclass
¶
MeasurementKind(operation: MeasurementOperation, space: MeasurementSpace, direction: MeasurementDirection = PERPENDICULAR)
What a dimension measures: operation, space and (for a distance) direction.
direction
class-attribute
instance-attribute
¶
direction: MeasurementDirection = MeasurementDirection.PERPENDICULAR
__post_init__
¶
Source code in kumiki/drawings/measure.py
__str__
¶
as_wire
¶
from_wire
classmethod
¶
from_wire(value) -> Optional[MeasurementKind]
Source code in kumiki/drawings/measure.py
parse
classmethod
¶
parse(text: str) -> MeasurementKind
Parse a kind from its composed name.
Source code in kumiki/drawings/measure.py
MeasurementOperation
¶
MeasurementPlacement
dataclass
¶
MeasurementPlacement(offset: Optional[float] = None, along: Optional[float] = None, flip: bool = False)
Where a dimension is drawn: offset from the features, along them, and flip for an angle's supplement.
from_wire
classmethod
¶
from_wire(value) -> Optional[MeasurementPlacement]
Return a placement from {"offset", "along", "flip"}, each optional.
Source code in kumiki/drawings/measure.py
MeasurementSpace
¶
columns
¶
columns(*children: Union[Viewport, Subdivision, Portion], gap: Numeric = 0) -> Subdivision
Return a subdivision setting children left to right. A bare Viewport takes Share(1).
Source code in kumiki/drawings/drawing.py
covering_page
¶
covering_page(subdivision_or_viewport: Union[Viewport, Subdivision], **options) -> Viewport
Return a floating viewport covering the whole sheet.
Source code in kumiki/drawings/drawing.py
default_viewports_for
¶
Return the default layout: a shop drawing for one timber, elevations for several.
elevation_viewports
¶
Return three world elevations and a preview, two rows of two.
Source code in kumiki/drawings/drawing.py
rows
¶
rows(*children: Union[Viewport, Subdivision, Portion], gap: Numeric = 0) -> Subdivision
Return a subdivision stacking children top to bottom. A bare Viewport takes Share(1).
Source code in kumiki/drawings/drawing.py
shop_drawing_viewports
¶
Return a shop drawing layout: a piece's four long faces down the left, a preview beside them.
Source code in kumiki/drawings/drawing.py
kinds_for
¶
kinds_for(feature_a: MeasurementFeature, feature_b: MeasurementFeature, space: MeasurementSpace, parallel: Optional[bool] = None) -> Tuple[MeasurementKind, ...]
Return the kinds a pair admits, best first. Projected-space features must already be projected.