Additive summation

   3704   2   1
User Avatar
Member
41 posts
Joined: April 2013
Offline
Hi all,

I've been trying to do the following in a procedural way, without any success. I'd be delighted if somebody could help me.

I have n number of points. They all have a single float attribute attached. What I want it to have the n:th attribute to be the sum of all preceding attributes.

Eg.
beforeattr = 2
beforeattr = 3
beforeattr = 1.5

afterattr = 2
afterattr = 3 + 2 = 5
afterattr = 1.5 + 5 = 6.5

Is there a nice way to do this? I've tried FOR and WHILE loops in VOP SOP and tried using ForEach SOP without satisfactory results.

Best regards,
Elias
User Avatar
Staff
5161 posts
Joined: July 2005
Offline
You can use the Geometry CHOP to import the attribute into CHOPs, and then follow this up with an area CHOP. This will do the summation. Next, back in SOPs, append a Channel SOP to the SOP you fetched the geometry from, and fetch the attribute channel back from the Area CHOP.
User Avatar
Member
41 posts
Joined: April 2013
Offline
That's really clever! Thanks!

A good moment for me to scratch the surface of CHOPs as well.

Again, thanks!
  • Quick Links