3 Replies - 2064 Views - Last Post: 10 December 2010 - 03:46 PM Rate Topic: -----

#1 RealiDreams  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 09-December 10

RealFlow and Python integration

Posted 10 December 2010 - 03:22 PM

Hello all,

I use RealFlow, a dynamics/fluids simulation program, and it uses Python scripting. So, I got Python for Dummies ebook, I started to read it and I just couldn't grasp the idea. I am a Graphic Designer/2D and 3D Animator. I just couldn't see how Python would integrate into the RealFlow program.

Could someone tell me what I would be able to do with python in RealFlow?

I'm just curious. I think Python is the hardest program I've ever attemted to learn on my own.

I can't grasp why I would use something like this in RealFlow:
>>> 3.2 # canonical
3.2000000000000002
>>> str(3.2) # nice
'3. 2'
>>> repr(3.2) # canonical
'3.2000000000000002'
>>> print 3.2 # nice
3.2 


and what the hell does this mean?:
>>> "monty python" # This is an expression and a
literal.
'monty python'
>>> x = 25 # This is a statement. 25 is a
literal.
>>> x # This is an expression.
25
>>> 2 in [1, 2, 3] # This is also an expression.
True
>>> def foo(): # This is a statement.
... return 1 # return is a statement; 1 is an
expression.
...
>>> foo() # foo is a name; foo() is an
expression.
1


Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: RealFlow and Python integration

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: RealFlow and Python integration

Posted 10 December 2010 - 03:31 PM

Hello friend. The first 4 lines you used were examples of how Python doesn't have ABSOLUTE precision. Think of the fraction 1/3, if we were to write that as a decimal, the value would be .333333333333333333333333333333333333- forever. Values in a computer are stored in binary code, ie 1's and 0's. In binary, the value 3.2 can't be expressed as a rational number. That being said, it's very accurate up to 17 digits, so try not to worry too much about precision.

The next set of stuff is really kind of silly. basically it means that "Monty Python" is a value called a string (ie a literal). x=25 is an expression. The expression says, make the variable x point to the value of 25. Being able to assign values to variables is important, but don't over think it. x = 25 just means that for the time being, x is referring to the value of 25. It's as simple as that (This is referred to as an assignment statement because x is being ASSIGNED the value of 25. clever, yes?)

I'm not going to lie, your book kind of sucks haha. They're getting bogged down in technical details and failing to see the big picture. People with PhD's often do that... I'd really recommend finding some online tutorials to help you learn. I personally would suggest starting with my blog, (surprise, surprise, right?). Just go to the earliest post and work your way to the present. My blog is intended for people with NO programming experience, so you should be fine. I use Python 3, and it's entirely possible that your book uses Python 2, but the languages are so similar that you shouldn't run into any significant problems.

Good luck!

This post has been edited by atraub: 10 December 2010 - 03:35 PM

Was This Post Helpful? 1
  • +
  • -

#3 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: RealFlow and Python integration

Posted 10 December 2010 - 03:33 PM

Another good resource for learning Python is Learn Python The Hard Way.
Was This Post Helpful? 0
  • +
  • -

#4 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: RealFlow and Python integration

Posted 10 December 2010 - 03:46 PM

I forgot to answer your other question ^_^

You can create a Python script to supply realflow with the data that you want to test. Using a scripting language, you can more easily test VERY complex situations

This post has been edited by atraub: 10 December 2010 - 03:55 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1