Rendering¶
Headless rendering of SysML diagrams to SVG/PNG.
The interactive widgets (longeron.diagrams) lay themselves out in the
browser. This module runs the same layout engine – elkjs 0.9.3, vendored
as _js/elk.bundled.js (EPL-2.0) – in a node subprocess instead, then
draws the result as styled SVG:
from longeron import diagrams, render
render.to_svg(diagrams.state_diagram(machine), “machine.svg”) render.to_png(model, “model.png”) # builds a view automatically
PNG conversion uses cairosvg when available (pixi environments include
it). Label sizes are estimated (the browser pipeline measures real glyphs),
so proportions differ slightly from the live widget.
- longeron.render.layout(elk_json)[source]¶
Run the vendored elkjs on an ELK JSON graph and return the layout.
- Return type: