Jump to content

python; retreiving simulation impact points


MrGAG

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 ?

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...