API, CLI, Embedding
Various ways to access Kiri:Moto's internals (2.6 and newer versions only)
Last updated
Various ways to access Kiri:Moto's internals (2.6 and newer versions only)
Last updated
The latest slicing engine code is served live at https://grid.space/code/engine.js
This can be embedded in your page then accessed with the following API calls. An example page is here.
The slicer engine is also available as a command-line utility
Example Device and Process settings which are defined in init.js around line 250
JSON dictionaries can be used for reference from the CLI package
Kiri:Moto is designed to be embedded in a page using an IFrame. The look and feel and other controls are available for the loaded page using a messaging API. An example page is here.
function
description
load(url)
load an STL referred to by url
clear()
remove all objects from workspace
parse(data)
parse the text or binary contents of an STL file
setMode(mode)
where mode comes from:[ "CAM", "FDM", "LASER", "SLA" ]
setListener(fn)
a function to receive engine progress messages
setDevice(options)
change default Device options
setProcess(options)
change default Process options
setController(options)
change default Core options
moveTo(x, y, z)
absolute move the origin of the loaded object
move(x, y, z)
relative move the origin of the loaded object
scale(x, y, z)
scale axes of the loaded object
rotate(x, y, z)
relative rotate axes of loaded object (in radians)
slice()
async slice of loaded object
prepare()
async path routing of slice data
export()
async gcode generation from routed paths
function
description
setFrame(id_obj)
id or object of IFrame with Kiri:Moto loaded
load(url)
load an STL referred to by url
clear()
remove all objects from workspace
parse(data)
parse the text or binary contents of an STL file
setMode(mode)
where mode comes from:[ "CAM", "FDM", "LASER", "SLA" ]
setDevice(options)
change default Device options
setProcess(options)
change default Process options
setController(options)
change default Core options
slice()
async slice of loaded object
prepare()
async path routing of slice data
export()
async gcode generation from routed paths
onmessage(fn)
function will receive all IFrame messages
onevent(event, data)
function will receive named messages
emit(event, data)
send named event with data payload
alert(msg, time)
show alert message with optional time in seconds
process(percent, message)
set progress bar (0.0 to 1.0) with optional message
Key
Output
Description
animate
CNC Animation Started
boolean.update
Boolean checkbox values sync'd
code.load
GCode or SVG code is being loaded / parsed
code.loaded
GCode / SVG code parsing complete
device.set
A new machine / device was selected
export
GCode / SVG export dialog is open
help.show
A Help dialog is open
init-done
App is fully initialized
init.one
App is starting to initialize
init.two
App is binding UI elements
key.esc
[ESC] key was pressed
keypress
A non-control or meta key was pressed
load.lib
A script extension was loaded
modal.show
A modal dialog is showing
mode.set
App mode changed: FDM, CNC, Laser, SLA
mouse.hover
Mouse is hovering over a feature of interest
mouse.hover.down
Mouse down on a feature of interest
mouse.hover.up
Mouse up on a feature of interest
platform.layout
Platform auto-layout was performed
preview.begin
Preview Mode calculations started
preview.end
Preview Mode calculations complete
preview.error
Preview Mode calculations encountered an error
Legacy: same as preview.end
range.updates
FDM Range records were changed
reload
App page will reload in 100ms
resize
App page was resized
selection.drag
Generated during object drag
selection.move
After object drag completes
selection.rotate
Selected objects were rotated
selection.scale
Selected objects were scaled
settings
Settings object changed
settings.load
Settings object was replaced
settings.saved
Settings object was saved
slice
Deprecated
slice.begin
Slicing calculations started
slice.end
Slicing calculations complete
slice.error
Slicing calculations encountered and error
slider.label
Slider labels changed
slider.pos
Slider position changed
slider.set
Slider values changed
view.set
View mode changed: slice, preview, animate
widget.add
An object was added to the workspace
widget.delete
An object was deleted from the workspace
widget.deselect
An object was de-selected
widget.rotate
An object was rotated
widget.select
An object was selected