magneto Posted October 14, 2012 Share Posted October 14, 2012 (edited) Hi, I have a point attribute that's a float and I want to sum their values for each point but up until the current point, so like: ptnum - value 0 - 3 1 - 2 2 - 6 3 - 5 4 - 1 5 - 7 6 - 2 So their values would be calculated as follows: 0 -> 3 1 -> 3 + 2 = 5 2 -> 3 + 2 + 6 = 11 3 -> 3 + 2 + 6 + 5 = 16 etc Is there a quick and elegant way to do this? Or do I have to use 2 foreach sops? Thanks Edited October 14, 2012 by magneto Quote Link to comment Share on other sites More sharing options...
bloomendale Posted October 14, 2012 Share Posted October 14, 2012 You can use For loop in VOP SOP. Quote Link to comment Share on other sites More sharing options...
rdg Posted October 14, 2012 Share Posted October 14, 2012 I'd try expressionChop and would probably fail. 1 Quote Link to comment Share on other sites More sharing options...
bloomendale Posted October 14, 2012 Share Posted October 14, 2012 (edited) here is example using vop sop. 3ak_sumuptopoint.hipnc Edited October 14, 2012 by bloomendale 1 Quote Link to comment Share on other sites More sharing options...
kgoossens Posted October 14, 2012 Share Posted October 14, 2012 Use a combination of a delete node/range and an attribute promote set to sum. Summation.hipnc 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted October 14, 2012 Author Share Posted October 14, 2012 Thanks alot guys, I don't know much about chops, but kgoossens, you need to use a foreach in your example, right? That's similar to how I ended up doing. @bloomendale, your solution is also pretty compact so I might use that Quote Link to comment Share on other sites More sharing options...
kgoossens Posted October 14, 2012 Share Posted October 14, 2012 (edited) Thanks alot guys, I don't know much about chops, but kgoossens, you need to use a foreach in your example, right? That's similar to how I ended up doing. No, no for each has been used. did you check the file? the summation happens in the attribute promote, so you'l find the value it in the prim attribute Edited October 14, 2012 by kgoossens Quote Link to comment Share on other sites More sharing options...
magneto Posted October 14, 2012 Author Share Posted October 14, 2012 Yes I did, I saw the prim attribute but there was no foreach sop inside I am not sure how you can repeat this for each point without the foreach sop, that's why I asked. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted October 14, 2012 Share Posted October 14, 2012 Yes I did, I saw the prim attribute but there was no foreach sop inside I am not sure how you can repeat this for each point without the foreach sop, that's why I asked. Okay, my bad. I misread what you needed. Quote Link to comment Share on other sites More sharing options...
magneto Posted October 14, 2012 Author Share Posted October 14, 2012 Np man Quote Link to comment Share on other sites More sharing options...
edward Posted October 16, 2012 Share Posted October 16, 2012 Geometry CHOP -> Area CHOP -> Channel SOP ? 4 Quote Link to comment Share on other sites More sharing options...
magneto Posted October 16, 2012 Author Share Posted October 16, 2012 (edited) Thanks Edward. I tried to do it but not sure how you can solve it with chops. Would you really be able to accumulate attribute values like I described? Edited October 16, 2012 by magneto Quote Link to comment Share on other sites More sharing options...
Darric Posted October 17, 2012 Share Posted October 17, 2012 (edited) It takes a little bit more than in his post, but it works. Nice idea, Edward. sum.hip Edited October 17, 2012 by Darric 1 Quote Link to comment Share on other sites More sharing options...
bloomendale Posted October 17, 2012 Share Posted October 17, 2012 It takes a little bit more than in his post, but it works. Nice idea, Edward. Quickiest way as it seems, especially if replace attribcreate with vopsop. Quote Link to comment Share on other sites More sharing options...
magneto Posted October 17, 2012 Author Share Posted October 17, 2012 Thanks guys, I get it now. Very interesting stuff Quote Link to comment Share on other sites More sharing options...
ben Posted October 17, 2012 Share Posted October 17, 2012 The same in python. Of course it's way slower than the chop et vop versions. sum.hip 1 Quote Link to comment Share on other sites More sharing options...
zarti Posted September 30, 2013 Share Posted September 30, 2013 It takes a little bit more than in his post, but it works. Nice idea, Edward. thanks for transnoding Edward's post . anyway CHOPs solution isnt as accurate as thePython method .. not sure Why? but i do not have time to investigate actually . The same in python. Of course it's way slower than the chop et vop versions. your scene / otl doesnt open in my H11 , so i wrote few lines myself and it works perfectly . and fortunately for my case speed isnt an real issue . .cheers 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.