origami_simulator
pleat.origami_simulator ¶
Open a crease pattern in Origami Simulator (https://origamisimulator.org/).
Origami Simulator imports a crease pattern via a postMessage handshake: it
announces {from:'OrigamiSimulator', status:'ready'} to its parent frame (when
embedded) or opener (when popped out), then accepts
{op:'importFold', fold:<FOLD object>}. We embed the pattern as FOLD JSON in a
self-contained page and reply to whichever OS window reports ready.
Two entry points:
- :func:
origami_simulator-- show OS folding a pattern: inline in the cell under Jupyter (Notebook / Lab / VS Code), or in the system browser from a script. - :func:
origami_simulator_button-- a button that embeds OS inline when clicked (lazy; good for the static docs, where auto-loading many at once would be heavy).
origami_simulator ¶
Show Origami Simulator folding the crease pattern G.
In a Jupyter environment (Notebook, Lab, VS Code) this embeds OS inline in the cell output (resizable via height); it can be called off any line and several times in one cell. From a plain script it opens OS in the system browser.
Pass new_tab=True to force the browser even from a notebook - useful in VS
Code, where the inline Fullscreen button is blocked by the webview.
Source code in pleat/origami_simulator.py
origami_simulator_button ¶
Display a button that embeds Origami Simulator inline when clicked.
Like :func:origami_simulator but lazy -- nothing loads until the reader
clicks, so a page with many patterns does not spin up a WebGL instance for each
on load. title sets the button label.