Commit 12e5f221 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add a bit of documentation

parent 63d5e28c
These notes explain how to load a model and render it as a statachart
This can be done for example using ptpython3
# Import the opengeode library to access the parser
import opengeode
# Make sure Qt is initialized to render the model
app = opengeode.init_qt()
# Parse a model
ast, _, _ = opengeode.ogParser.parse_pr([''])
# ast is of type opengeode.ogAST.AST (check
# Extract the SDL process
process = ast.processes[0] # type: opengeode.ogAST.Process
# Create a scene and a view to render the process as a statechart
scene = opengeode.SDL_Scene('statechart')
view = opengeode.SDL_View(scene)
# Transform the AST of the process into a graphviz graph
graph = opengeode.Statechart.create_dot_graph(process, basic=True)
# Then render the graph (requires graphviz)
opengeode.Statechart.render_statechart(scene, graph)
# Enable the view and run the application
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment