Package gaiasky.script


package gaiasky.script
Important: Since Gaia Sky 3.6.9 we have a new API (APIv2). It is the recommended way to interact with Gaia Sky, whether you are using Python, the REST server, or the internal console.

For backwards compatibility purposes, the old APIv1 (IScriptingInterface) will still be kept around. However, if you are starting with Gaia Sky scripting, it is strongly encouraged to use the new APIv2.

This package contains the definition and implementation of the Gaia Sky APIv1. This API has been used up until Gaia Sky 3.6.8. Since that version, APIv1 is implemented by calling APIv2 functions. This means that the actual method implementations are in APIv2.

Have a look at IScriptingInterface for a full listing of all the APIv1 calls. The implementation is in EventScriptingInterface. In order to access the APIv1 from a Python script, do this:

from py4j.clientserver import ClientServer, JavaParameters

gateway = ClientServer(java_parameters=JavaParameters(auto_convert=True))
gs = gateway.entry_point

# Here we can use gs to call APIv1 methods
gs.goToObject("Mars", 20.0, 4.5)
gs.startSimulationTime()

[...]

# Remember to shut down the connection before exiting
gateway.shutdown()