Jump to content
CinnamonMetal

Store value of points in attribute

Recommended Posts

I know my code is not right, I'm iterating using a forEach SOP each piece, then within a point wrangler is the code below; I want to iterate over each piece and if the total number of points of each piece is less then a value export it as both a class and arbitrary attribute. Instead I get an attribute which is empty ? 

I've tried replacing detLoop with a numeric value but that doesn't work either.

int detLoop = detail(0,"iteration",0);
for(int i=detLoop;i<@numpt;i++){
    i@LargeChunk;
    i@class;
    }

 

Share this post


Link to post
Share on other sites

Hey, sometimes there is an issue when you try to get a detail attribute from the metadata import node with vex. Try to connect it to the second input of your wrangle, and in the detail just correct it to 

int detloop = detail(1,"iteration",0);

 

Cheers,

Share this post


Link to post
Share on other sites
7 hours ago, DonRomano said:

Hey, sometimes there is an issue when you try to get a detail attribute from the metadata import node with vex. Try to connect it to the second input of your wrangle, and in the detail just correct it to 


int detloop = detail(1,"iteration",0);

 

Cheers,

I'm still not getting any value for the attributes which I'm trying to write too, especially the attribute @LargeChunk. I did some modification to the code;

int detLoop = detail(1,"iteration",0);
for(int i=detLoop;i<@numpt;i++){
        if(i>1400 && i<2000){
            i@LargeChunk;
            i@class;
        }
    }

 

Share this post


Link to post
Share on other sites

If you want to get value of attribute you have to assign some value to this attribute. Right now you just declare attributes and they equal to 0. And second, if a chunk has less then 1400 points then if condition will never happen. If you'd provide a simple scene, i think it would be more easily to help.

  • Like 1

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

×