scripting "fit to object" connection?

Post Reply
redpawfx
Posts: 26
Joined: Thu Jun 10, 2010 10:08 pm

scripting "fit to object" connection?

Post by redpawfx » Fri Sep 09, 2011 1:02 am

How if at all can you do this?

an example would be the k_volume daemon has a button to "fit to object"
but there doesent seem to be a way to script that since the connection to the "object" seems to
not be something we have access to?

any ideas or are we out of luck?
thanks
Johnc

User avatar
Alex
Site Admin
Posts: 143
Joined: Mon Jun 14, 2010 9:35 am

Re: scripting "fit to object" connection?

Post by Alex » Tue Nov 22, 2011 11:52 am

Hi Johnc,

for RealFlow objects there is a getBoundingBox() function that returns the minimum and maximum corner positions of the object bounding box.

From that point, making the k_volume (or whatever) transformation fit that box shouldn't be a big deal.

Code: Select all

(mincorner,maxcorner) = Cube01.getBoundingBox()

obj_scale = (maxcorner-mincorner)
obj_center = Vector.new()
obj_center += obj_scale
obj_center.scale( .5 )
obj_center += mincorner

k_Volume01.setParameter( "Position", obj_center )
k_Volume01.setParameter( "Scale", obj_scale )

Alex Ribao
RealFlow Team
Next Limit Technologies

Post Reply