Jump to content
dpap

VOPS {Append data from a loop into an array} ??

Recommended Posts

A VOP performs a pointcloud lookup and uses while loop in oder to take advandage of the pcimport node to get distance,ptnum ,P etc.

How can I store the result of each loop in a while node in vops? Each loop gives me a point but I only get the last point out of the node( although I have set max number of points to a number higher than one.. )

Maybe somehow push/append them into an array so I can call the later on? If that is the way, arrays in vops need inline code (afaik..) and I haven't managed to figure i out... :blink:

One of my goals is to draw multiple lines that connect the look up point with a number of points on the pointcloud(= max number of points) without puting the VOP and the Foreach node into another ForEach node out side the vop (because it is not fast).

I hope all this makes sense ......thanks

ps. play a bit with the slider of "max number of points". Slide it from 1 to 4 and you'll see the line jumbing to the next point. I want to be able to store these points without movin the slider.. :(

post-9497-0-28020300-1381969198_thumb.jp

post-9497-0-23392000-1381969212_thumb.jp

Push in array.hip

post-9497-0-97427700-1381969490_thumb.jp

Edited by dpap

Share this post


Link to post
Share on other sites

Hello! I took a quick look at your scene and figured out a few things I would try to change.

Heads up, I have never created a matrix and generated attributes in a while loop. But is seems as you have to store a large amount of data and attributes in a single point so I tried a different method. But it might not be suitable for your purpose

In the vopsop I calculate the distance and direction between the floating point with the points in the geometry. I also added an interger attribute (in_range). You can then set the geometry points to in range or not depending on an user input. Thereafter delete all points which are not in range. Then copy stamp lines using the direction attribute and the length between the points of the geometry to the floating point. It might be easier to understand if you check out the scene.

You could probably do a for_each if you have other floating points.

*Edit*

forgot the file ofcourse

Push in array.hipnc

Edited by Hudson
  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your time and effort Hudson and sorry for late answer !

Although I would like to learn more about arrays, your approach is different and very cleaver. Maybe I have to start thinking in a new way when in houdini...

The bad think is that I am used to ICE and where arrays are very easy to use.Damn I thought I'd be in cg heaven when using Houdini :(

Maybe I'll try again the arrays approach another time.

Thank you again!

Share this post


Link to post
Share on other sites

its not a problem to use arrays in vex. take a look at the attached file. maybe this is what you are looking for.

hth.

petz

array.hipnc

  • Like 3

Share this post


Link to post
Share on other sites

Hi Petz! Thanks for your help! You actually nailed it!!! It gets the job done in a clean and tidy way!

You are right that arrays in Vex are not a problem but you have to know Vex for that to be true...

Although I understood your code, I am far from saying that I know Vex..

So, for guys like me Vops is the way to go, because I dont want to be a programer /* I wouldn't be a good one*/ but I really enjoy a "visual programing " workflow.

Long story short , for educational reasons I changed a little bit your code and tried to "translate" it from VEX into VOPs.

But as I expected : result==failure :blush:

I uploaded the file if someone wants to give it another crack..

And btw since I can set a "float array" at the inline code outpout type,

why can’t I declare an attribute of array type in my “attribute create” node

or my “add attribute node”??? Not very intutive...... :blink:

translating vex to vops.hipnc

post-9497-0-51900100-1382645256_thumb.jp

post-9497-0-29542200-1382645259_thumb.jp

post-9497-0-96910300-1382645260_thumb.jp

Edited by dpap

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

×