Jump to content
Sign in to follow this  
MrGAG

python; retreiving simulation impact points

Recommended Posts

Hi everyone ,

I am trying to find an alternative to using sop solver in order to create points at impact location in rbd simulation.

The only way I know to do that is to use a sop solver to merge a point at every impact position. the problem is that if found sopsolver terribly time consuming. sop solver is very handy when it comes to complicated stuff like dynamically deform some geometry, but all I want to do is use impact data stored in sim files and create points at this position( if there's a easiest way, I'd be glad to hear from that)

So I tried to build some python code to achieve that.

def printRecords():
    obj = hou.node("/obj/AutoDopNetwork").simulation().objects()
    sphere = obj[1]



    for i in range(1,50) :
        myStr = hou.expandString("fcur "+str(i))
        dopNode = hou.node("/obj/AutoDopNetwork/")

        hou.setFrame(i)
        print sphere.findAllSubData("Impacts")


        if(sphere.findSubData("Impacts")):
            print "data"

nothing fancy ... I just move time slider from frame to frame, and try to print out some infos about impact data

the problem is, even though time slider is going from frame to frame, print statement always give me thes same result for all the frames. ( actually it seems to only take into account the frame number whitch my time slider is on to when I execute the python function )

What am I missing here ?

How do I make python aware of the time slider position to be able to retreive correct data ?

Share this post


Link to post
Share on other sites

Here's an example of using a Python SOP to do it all. You can also do it in SOPs basically almost exactly the same as you would with a SOP solver.

Are you attempting to do it with Python in a Python DOP? Those have issues caching their data and things don't work so well when scrubbing, but I'd say it is a better idea just doing it in SOPs either using Python or just SOP operators.

sop_dopimpacts.otl

Share this post


Link to post
Share on other sites

Here's an example of using a Python SOP to do it all. You can also do it in SOPs basically almost exactly the same as you would with a SOP solver.

Are you attempting to do it with Python in a Python DOP? Those have issues caching their data and things don't work so well when scrubbing, but I'd say it is a better idea just doing it in SOPs either using Python or just SOP operators.

Hello Man, thanks for sharing, very great tool

Share this post


Link to post
Share on other sites

that is exactly what I was trying to do !!

you are the best, thanks for sharing

Are you attempting to do it with Python in a Python DOP?

Actually I was trying to do that in houdini session module. I should have thought of a python Sop

thank you very much

Share this post


Link to post
Share on other sites

Attached is a newer version of the asset. I accidentally uploaded the a version that was a bit older. In the newer I removed some options that were useless and made a couple minor changes changes. The help card also had a description that wasn't even for this operator.

sop_dopimpacts.otl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×