You can download Arnold here. The Arnold download (aka the Arnold SDK) includes the Arnold library, the Arnold C++ API, the API docs, and the Python bindings for the Arnold API.
To use the Arnold Python API, you need to add the Arnold python folder to the PYTHONPATH:
Here’s a “hello world” written with the Arnold Python API:
# # hello_world.py # from arnold import * AiBegin() AiMsgSetConsoleFlags( AI_LOG_INFO ) AiMsgInfo( 'Hello World' ) AiEnd()
Here’s a quick breakdown of the script.
- You need to import the arnold module.
- An Arnold session always starts with AiBegin() and ends with AiEnd(). You have to call AiBegin() to initialize Arnold and enable the Arnold API. Try commenting it out and see what happens…
- We need to call AiMsgSetConsoleFlags() to set the log verbosity level (otherwise we won’t see our “Hello World”, because the default level is AI_LOG_NONE).
- AiMsgInfo() sends our “Hello World” to the log.
Assuming that Python in is your PATH, you can run the hello world script like this:
and that will give you this output:
C:\solidangle\arnold\scripts>python helloworld.py | log started Wed Mar 04 14:31:40 2015 | Arnold 220.127.116.11 windows icc-14.0.2 oiio-1.4.14 rlm-11.2.2 2015/02/26 15:08:42 | running on StephenBlair-PC with pid 33812 | 1 x Intel(R) Xeon(R) CPU E3-1240 V2 @ 3.40GHz (4 cores, 8 logical) with 16338MB | Windows 7 Professional Service Pack 1 (version 6.1, build 7601) | | Hello World | | releasing resources | Arnold shutdown
For documentation, you use the Arnold SDK documentation. It’s for the C++ API, but the Python API is basically a one-to-one wrapper around the C++ API.
You can find the docs in the doc/api/index.html folder of the Arnold installation.
AiBegin() and AiEnd() are part of the Rendering API.
AiMsgSetConsoleFlags() and AiMsgInfo() are part of the Message Logging API, so go there to check out the possible flags, and what other logging functions are available.