vibesketch.document.apparatus

Laboratory apparatus pictograms drawn from ordinary shapes and text (#91).

Each pictogram is vibe-sketch’s own line art, made of the canvas engine’s rectangles, ellipses and lines only, like the TLC plate. So the canvas shows it, edits move or change its parts, and every figure prints it: SVG, PNG, PDF and the chemfig export’s TikZ picture. Nothing special is stored, and a pictogram is a schematic, not a drawing to scale. The canvas has no arcs, so a round-bottom flask is a circle with its neck drawn on top.

The geometry is in bond lengths, from the pictogram’s bottom centre with y pointing up, as KET’s coordinates do.

Module Attributes

APPARATUS

The pictograms, as shapes with their two points each.

Functions

with_apparatus(document, kind[, at, scale, ...])

document with the kind pictogram added.

Exceptions

ApparatusRefused

A pictogram that cannot be drawn as asked.

vibesketch.document.apparatus.APPARATUS: dict[str, list[tuple[str, tuple[float, float], tuple[float, float]]]] = {'beaker': [('line', (-0.8, 0.0), (-0.8, 1.8)), ('line', (0.8, 0.0), (0.8, 1.8)), ('line', (-0.8, 0.0), (0.8, 0.0)), ('line', (-0.8, 1.8), (-0.95, 1.95))], 'column': [('line', (-0.3, 0.8), (-0.3, 4.5)), ('line', (0.3, 0.8), (0.3, 4.5)), ('line', (-0.3, 0.8), (-0.06, 0.5)), ('line', (0.3, 0.8), (0.06, 0.5)), ('line', (-0.06, 0.5), (-0.06, 0.0)), ('line', (0.06, 0.5), (0.06, 0.0)), ('line', (-0.3, 3.2), (0.3, 3.2)), ('rectangle', (-0.2, 0.25), (0.2, 0.38))], 'condenser': [('line', (-0.12, 0.0), (-0.12, 4.0)), ('line', (0.12, 0.0), (0.12, 4.0)), ('rectangle', (-0.35, 0.6), (0.35, 3.4)), ('line', (0.35, 0.9), (0.75, 0.9)), ('line', (-0.35, 3.1), (-0.75, 3.1))], 'conical-flask': [('line', (-0.25, 2.2), (-0.25, 3.0)), ('line', (0.25, 2.2), (0.25, 3.0)), ('line', (-0.25, 2.2), (-1.0, 0.0)), ('line', (0.25, 2.2), (1.0, 0.0)), ('line', (-1.0, 0.0), (1.0, 0.0))], 'flask': [('ellipse', (-1.0, 0.0), (1.0, 2.0)), ('line', (-0.25, 1.9682458365518543), (-0.25, 3.0)), ('line', (0.25, 1.9682458365518543), (0.25, 3.0))], 'hotplate': [('rectangle', (-1.2, 0.0), (1.2, 0.5)), ('ellipse', (0.7, 0.12), (0.95, 0.38))], 'separatory-funnel': [('rectangle', (-0.15, 3.4), (0.15, 3.7)), ('line', (-0.15, 3.0), (-0.15, 3.4)), ('line', (0.15, 3.0), (0.15, 3.4)), ('line', (-0.15, 3.0), (-0.8, 2.5)), ('line', (0.15, 3.0), (0.8, 2.5)), ('line', (-0.8, 2.5), (-0.06, 1.0)), ('line', (0.8, 2.5), (0.06, 1.0)), ('line', (-0.06, 1.0), (-0.06, 0.0)), ('line', (0.06, 1.0), (0.06, 0.0)), ('rectangle', (-0.25, 0.45), (0.25, 0.6))], 'vial': [('rectangle', (-0.4, 0.0), (0.4, 1.6)), ('rectangle', (-0.45, 1.6), (0.45, 2.0))]}

The pictograms, as shapes with their two points each.

exception vibesketch.document.apparatus.ApparatusRefused[source]

Bases: ValueError

A pictogram that cannot be drawn as asked.

vibesketch.document.apparatus.with_apparatus(document, kind, at=None, *, scale=1.0, label=None)[source]

document with the kind pictogram added.

at is the pictogram’s bottom centre in KET coordinates; without it the pictogram stands to the right of everything drawn, centred on the drawing’s height. scale multiplies its size; label is written under it.

Parameters:
Return type:

Document