vibesketch.render.scene

SVG from a KET scene, retaining each occurrence and its drawing coordinates.

One KET bond-length unit is the preset bond length in print points. KET’s y axis points up; SVG’s points down. The transform is shared by molecules and annotations, independent of the normalized reaction/species catalogue.

Module Attributes

Marks

atom indices and a palette colour, per group.

CANVAS_SHAPES

The shapes the canvas engine draws (Ketcher's simple objects).

SHAPES

the canvas's, and KET's polyline, which reaches a document only from a KET file or the API because Ketcher 3.18 cannot draw it.

MAX_POLYLINE

The most points a polyline may have.

Functions

highlight_options(mol, marks)

RDKit's DrawMolecule highlight arguments: the atoms, and bonds within one group.

scene_svg(canvas[, preset, marks, texts, ...])

Render a drawing, or return None for an empty canvas.

vibesketch.render.scene.Marks

atom indices and a palette colour, per group.

Type:

Highlights of a drawn molecule

alias of list[tuple[list[int], str]]

vibesketch.render.scene.highlight_options(mol, marks)[source]

RDKit’s DrawMolecule highlight arguments: the atoms, and bonds within one group.

Parameters:
Return type:

dict[str, Any]

vibesketch.render.scene.CANVAS_SHAPES = ('rectangle', 'ellipse', 'line')

The shapes the canvas engine draws (Ketcher’s simple objects).

vibesketch.render.scene.SHAPES = ('rectangle', 'ellipse', 'line', 'polyline')

the canvas’s, and KET’s polyline, which reaches a document only from a KET file or the API because Ketcher 3.18 cannot draw it.

Type:

The shapes figures print

vibesketch.render.scene.MAX_POLYLINE = 10000

The most points a polyline may have.

vibesketch.render.scene.scene_svg(canvas, preset=Preset(name='acs-1996', bond=14.4, line=0.6, size=10, spacing=0.18, bold=2.0, hash_spacing=2.5, margin=0.95, font='Roboto, sans-serif', stereo_labels=False), marks=None, texts=None, nanostructures=None)[source]

Render a drawing, or return None for an empty canvas.

texts gives, per molecule, text printed in its place, such as a peptide’s sequence; None draws the structure. nanostructures maps species ids to the generated nanostructures the drawing’s pictures show.

Unsupported chemistry or arrow modes are refused rather than omitted. Text is escaped plain text in the publication font, with line breaks kept.

Parameters:
Return type:

bytes | None