0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Autodesk Arnold Python API はじめの一歩

0
Last updated at Posted at 2026-05-03

Arnold Python APIのhelloworld.pyを試してみたら、以下、エラー。事前にArnoldのライセンスが認証されていないと、コマンドプロンプトには何も表示されない。

>python .\[helloworld.py](http://helloworld.py)
00:00:00    58MB         | log started Sun May  3 11:36:28 2026
00:00:00    58MB         | Arnold 7.4.5.2 [4370450a] windows x86_64 clang-20.1.8 oiio-2.6.3 osl-1.13.3 vdb-11.0.0 adlsdk-9.8.2.57 clmhub-3.1.1.43 rlm-17.0.1 optix-8.0.0 2026/03/31 01:51:04
00:00:00    58MB         | running on nurbs, pid=3364
00:00:00    58MB         |  1 x Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (4 cores, 8 logical) with 16217MB
00:00:00    58MB         |  Windows 10 (version 10.0, build 26200)
00:00:00    58MB         |  soft limit for open files changed from 512 to 2048
00:00:00    58MB         |
00:00:00    58MB         | Installing system handler with mask 255
00:00:00    98MB         | loading plugins from C:\Arnold-7.4.5.2-windows\bin\..\plugins ...
00:00:00    99MB         |  alembic_proc.dll: alembic uses Arnold 7.4.5.2
00:00:00   107MB         |  usd_proc.dll: usd uses Arnold 7.4.5.2
00:00:00   108MB         | loaded 2 plugins from 2 lib(s) in 0:00.04
Traceback (most recent call last):
  File "C:\Arnold-7.4.5.2-windows\[helloworld.py](http://helloworld.py)", line 8, in <module>
    AiMsgSetConsoleFlags( AI_LOG_INFO )
TypeError: this function takes at least 2 arguments (1 given)
00:00:00   111MB         |
00:00:00   111MB         | releasing resources
00:00:00    99MB         |  unloading 2 plugins
00:00:00    99MB         |   closing alembic_proc.dll ...
00:00:00    99MB         |   closing usd_proc.dll ...
00:00:00    99MB         |  unloading plugins done
00:00:00    99MB         | Arnold shutdown
00:00:00    99MB         | Installing system handler with mask 0

Arnold 7.x でAPIが変更されています。

AiMsgSetConsoleFlags のシグネチャが変わり、第1引数に レンダラーのユニバース (AiUniverse または None) が必要になりました。はい、Arnold 7.x でAPIシグネチャが変更されています

原因

Arnold 7 から AiMsgSetConsoleFlags()universe引数 が追加されました。

バージョン シグネチャ
Arnold 4〜6 AiMsgSetConsoleFlags(flags)
Arnold 7 AiMsgSetConsoleFlags(universe, flags)

修正方法

AiBegin() の戻り値(universeオブジェクト)を受け取って渡します。以下コマンドプロンプトから、(powershellではないです。)

 > set PYTHONPATH=C:\Arnold-7.4.5.2-windows\python\
 > python hello_world.py
hello_world.py
# set PYTHONPATH=C:\Arnold-7.4.5.2-windows\python\
# hello_world.py
#
from arnold import *

universe = AiBegin()

AiMsgSetConsoleFlags(universe, AI_LOG_INFO)

AiMsgInfo('Hello World')

AiEnd()

AiBegin() がuniverseを返すようになったのも Arnold 7 からの変更点です。None を渡してもデフォルトuniverseを使う場合は動作することがありますが、AiBegin() の戻り値を使うのが正しい書き方です。

00:00:00    58MB         | log started Sun May  3 11:40:38 2026
00:00:00    58MB         | Arnold 7.4.5.2 [4370450a] windows x86_64 clang-20.1.8 oiio-2.6.3 osl-1.13.3 vdb-11.0.0 adlsdk-9.8.2.57 clmhub-3.1.1.43 rlm-17.0.1 optix-8.0.0 2026/03/31 01:51:04
00:00:00    58MB         | running on nurbs, pid=12756
00:00:00    58MB         |  1 x Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (4 cores, 8 logical) with 16217MB
00:00:00    58MB         |  Windows 10 (version 10.0, build 26200)
00:00:00    58MB         |  soft limit for open files changed from 512 to 2048
00:00:00    58MB         |
00:00:00    58MB         | Installing system handler with mask 255
00:00:00    98MB         | loading plugins from C:\Arnold-7.4.5.2-windows\bin\..\plugins ...
00:00:00    98MB         |  alembic_proc.dll: alembic uses Arnold 7.4.5.2
00:00:00   107MB         |  usd_proc.dll: usd uses Arnold 7.4.5.2
00:00:00   107MB         | loaded 2 plugins from 2 lib(s) in 0:00.04
        | Hello World
        |
        | releasing resources
00:00:00   102MB         |  unloading 2 plugins
00:00:00   102MB         |   closing alembic_proc.dll ...
00:00:00   102MB         |   closing usd_proc.dll ...
00:00:00    96MB         |  unloading plugins done
00:00:00    96MB         | Arnold shutdown
00:00:00    96MB         | Installing system handler with mask 0

正常に動作しています!

| Hello World

が出力されており、成功です。

ログの流れを確認すると:

  1. Arnold 7.4.5.2 が起動
  2. プラグイン(alembic、USD)をロード
  3. Hello World を出力
  4. リソース解放 → シャットダウン

エラーなく綺麗に終了しています。AiBegin() の戻り値をuniverseとして受け取り、AiMsgSetConsoleFlags(universe, AI_LOG_INFO) に渡す修正が正しく効きました。

これでArnold 7 Python APIの基本的な起動パターンが確認できたので、次のステップ(シーン構築やレンダリング)に進める状態です。ありがとうございます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?