Skip to content

SCIRun Python API 0.2

Dan White edited this page Jan 28, 2016 · 29 revisions

TODO TODO TODO

The API contains global functions for network editing, module state modification, and data object extraction and insertion.

Global functions

  • scirun_add_module("ModuleName")

    • Adds a new instance of a module to the network. Returns the module ID as a string.
  • scirun_remove_module("ModuleID")

    • Removes the module specified by the ID string.
  • scirun_execute_all()

    • Executes the entire current network.
  • scirun_module_ids()

    • Returns a list of all module ID strings in the current network.
  • scirun_connect_modules("ModuleIDFrom", fromIndex, "ModuleIDTo", toIndex)

    • Connects ports between two modules by index. From is the output, To is the input.
  • scirun_disconnect_modules("ModuleIDFrom", fromIndex, "ModuleIDTo", toIndex)

    • Used to disconnect two modules, with the same syntax as connecting.
  • scirun_get_module_state("ModuleID", "StateVariableName")

    • Returns the value of a the specified module state variable.
  • scirun_set_module_state("ModuleID", "StateVariableName", value)

    • Sets the specified module state variable's value.
  • scirun_dump_module_state("ModuleID")

    • Returns a dictionary with the entire state of the specified module.
  • scirun_get_module_transient_state("ModuleID", "StateVariableName")

    • Returns the value of a the specified module transient state variable.
  • scirun_set_module_transient_state("ModuleID", "StateVariableName", value)

    • Sets the specified module transient state variable's value. Used to pass data values (strings, matrices, fields [coming soon]) back to modules.
  • scirun_get_module_input_type("ModuleID", portIndex)

    • Returns the type of the input data object on the specified port.
  • scirun_get_module_input_object("ModuleID", "PortName")

    • Returns a special PyDatatype wrapper object containing a copy of the data on the specified input port, by name.
  • scirun_get_module_input_value("ModuleID", "PortName")

    • Returns a Python object containing a copy of the data on the specified input port.
  • scirun_get_module_input_object_by_index("ModuleID", portIndex)

    • Returns a special PyDatatype wrapper object containing a copy of the data on the specified input port, by port index.
  • scirun_get_module_input_value_by_index("ModuleID", portIndex)

    • Returns a Python object containing a copy of the data on the specified input port, by index.

    //boost::python::def("scirun_set_module_input_value", &NetworkEditorPythonAPI::scirun_set_module_input_value); //boost::python::def("scirun_set_module_input_value_by_index", &NetworkEditorPythonAPI::scirun_set_module_input_value_by_index);

    boost::python::def("scirun_save_network", &NetworkEditorPythonAPI::saveNetwork); boost::python::def("scirun_load_network", &NetworkEditorPythonAPI::loadNetwork); boost::python::def("scirun_import_network", &NetworkEditorPythonAPI::importNetwork); boost::python::def("scirun_quit", &SimplePythonAPI::scirun_quit); boost::python::def("scirun_force_quit", &SimplePythonAPI::scirun_force_quit); }

Clone this wiki locally