morcmorc Posted April 30, 2017 Share Posted April 30, 2017 Hi guys I struggle with this simple thing: I have a grid piped into an attribute wrangle running over primitives. In the wrangle I have a single var, delete. I use a for loop to iterate over all primitives and set delete to 1 at random. In a second for loop I delete the prim, if delete is 1. At least that's the plan. It doesn't work, because I can't read out the delete value in the if statement. Even if I just reassign delete to another var, I just get zeros. Would be great if someone could help me out here. Quote Link to comment Share on other sites More sharing options...
Skybar Posted April 30, 2017 Share Posted April 30, 2017 What exactly are you trying to do? When in primitive mode on the wrangle it already loops over all prims, so right now you are looping over all primitives for every primitive, twice. Also, I think it creates attributes the last thing it does - so you cannot access it until after that wrangle. I think it would work better if you instead made a variable instead of an attribute, but dont quote me on this. If you just want to delete random primitives do it like this: if(rand(@primnum) > 0.5) removeprim(0, @primnum, 1); Quote Link to comment Share on other sites More sharing options...
morcmorc Posted April 30, 2017 Author Share Posted April 30, 2017 Thanks for your reply. It was just an example, I don't want to randomly delete prims that way. But I didn't know that I cannot access the var until after the wrangle. That solved it for me. Thanks. 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.