Last updated on 7. 5. 2015 by Mark Fric

Getting started with Program interface

Program is an interface that allows you to call any functionality of the program or plugins from snippets, or another plugins, etc.

Program interface was created so that plugins and Snippets can call functions defined in another plugins or in the program library itself.
It is not possible to call some plugin function from another plugin or snippet directly – snippet doesn’t know what plugins are and how they work.

For example, you want to run Monte Carlo simulation in a snippet – but Monte Carlo feature is a plugin, it might not be even present in your installation, and snippet doesn’t have access to its source code, so it cannot create its classes and call its methods directly.

Luckily, you can use universal Program interface. It allows any plugin to register itself as a “program” and then receive calls from external modules that ask it to do something.

For example, you can call Monte Carlo from a snippet using simple:

Program.get(“MonteCarlo”).call(“run”, …settings…);

The get() method returns a program interface for “MonteCarlo” – if it exists. Then you can call “run” method of this interface, pass it some parameters and expect it to return some results.

Was this article helpful? The article was useful The article was not useful

Notify of
Inline Feedbacks
View all comments