LoginSignup
0
0

More than 5 years have passed since last update.

RF Python Basic_01

Posted at

Vertion RealFlow10
Pythonの基本ができればRF_Pythonもサクサクかけますよ

今回はBatch Scriptを使用します。
:F10keyで表示できます。

:僕はこんな感じのlayoutにしてます。
Script view
Script_Setup..PNG

入門編


#Create Helloworld

word = "HelloWorld";
scene.message(word);

Scriptの実行はCtrl+Enterで実行されます。
日本語入力はErrorでますよぉ

MessagesにHelloWorldが表示されたら...
おめでとうございます!
実行成功です。


さて....

値や何かしらの演算結果をmessageに出力したい場合は
.message

scene
はモジュールとなっています。
sceneは変数にmappingする事ができます。

#into variable
moj = scene;
moj.message("helloWorld");

stringの連結は...

scene.message("hello"+"World");
word = "hello";

scene.message(word+"World");

確認済みっす。


vector module

vector ..PNG

# Create a new vector a compute its module.

vector = Vector.new( 1.0, 2.0, 3.0 );
scene.message( str( vector ) );

CGでおなじみの三次元コンポーネント
:Arg(引数)
:messageで出力する場合はstr()で囲う必要があります。
:floatの値を取得する場合は...

#get float component
vector = Vector.new( 1.0, 2.0, 3.0 );
vecX = vector.getX();
scene.message( str( vecX) );

Vector_operater.PNG


Edit_vectorfunction
set_function.PNG


僕が体感的に習得が難しかった部分は上記の2つでした。
この二つさえ抑えておけば、サックサクにScript書けると思います。

0
0
2

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