wick3dParticle Posted January 19, 2010 Share Posted January 19, 2010 Hello, Its been a while since I have been to the forums. I am a Maya guy trying to learn Houdini. I am currently running a network within a "for each" node. I would like to make groups of every iteration that meets the condition: nprims() <= 1 or create somewhat of a reverse switch node, where I can put in an if condition to drive if it continues to output 1 or output 2. This is probably an easy solution, but I am just not that familiar with Houdini. Thanks for the help. ~Ilan Quote Link to comment Share on other sites More sharing options...
Michael1 Posted January 19, 2010 Share Posted January 19, 2010 This should be what you're looking for. I created an attribute, if the number of primitives <= 1 then the attribute is given a value of 1, else its given a value of 0. Then I group based on this attribute. You could probably do this inside one large statement but it makes it simpler if its broken up. odforce_grouping.hipnc Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 20, 2010 Author Share Posted January 20, 2010 This should be what you're looking for. I created an attribute, if the number of primitives <= 1 then the attribute is given a value of 1, else its given a value of 0. Then I group based on this attribute. You could probably do this inside one large statement but it makes it simpler if its broken up. Michael, Thanks so much for your reply. Unfortunately, I don't think that it has solved my problem. I have tried this earlier but saw that it did not work. I still get groups with 0 prims in them. I am posting a scene with your solution included where I am trying to place it. (in the 'for each' node). Hopefully you or someone could say... that I am going about this the wrong way. Thanks, ~Ilan Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 20, 2010 Author Share Posted January 20, 2010 (edited) doublePost odforceIfProblem.hipnc Edited January 20, 2010 by wick3dParticle 1 Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 20, 2010 Author Share Posted January 20, 2010 And the problem file is... Quote Link to comment Share on other sites More sharing options...
graham Posted January 20, 2010 Share Posted January 20, 2010 Are you trying to only create groups when there are polygons? I'm a bit confused by your goals since your expression says if there are 0 or 1 primitives then group it, but then you say you don't want groups with no geometry in them. Using an expression in the Filter expression isn't the right way to go about this. The expression is run on a per prim basis, and so you will always get the same result, which is kind of wrong anyway. You want to either control the Enable toggle with an expression, or use a Switch to switch between a Group SOP with no expression, or the input before it. In the attached file I'm assuming you wanted to only create groups with prims in them. I have it set up both ways. They both use the expression nprims(opinputpath(".", 0)) > 0. This checks the first input geometry to see if there's geometry. If there is the group is created either by toggling the Enable on the Group SOP, or by switching to the always grouped input chain. odforceIfProblem.hipnc Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 20, 2010 Author Share Posted January 20, 2010 Are you trying to only create groups when there are polygons? I'm a bit confused by your goals since your expression says if there are 0 or 1 primitives then group it, but then you say you don't want groups with no geometry in them. Using an expression in the Filter expression isn't the right way to go about this. The expression is run on a per prim basis, and so you will always get the same result, which is kind of wrong anyway. You want to either control the Enable toggle with an expression, or use a Switch to switch between a Group SOP with no expression, or the input before it. In the attached file I'm assuming you wanted to only create groups with prims in them. I have it set up both ways. They both use the expression nprims(opinputpath(".", 0)) > 0. This checks the first input geometry to see if there's geometry. If there is the group is created either by toggling the Enable on the Group SOP, or by switching to the always grouped input chain. Thank you so much Graham! That was exactly what I was looking for. Thank you for taking the time to explain what was wrong with my approach. I ended up solving it a different way, which probably isn't the smartest way; but it got the job done. That being said I learned a lot from your scene, Thanks! ~Ilan odforceIfFixed.hipnc Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 20, 2010 Author Share Posted January 20, 2010 Hi again, So just to clarify something... Is nprims(opinputpath(".", 0)) > 0 the same as or shorthand for if(nprims(opinputpath(".", 0)) > 0,1,0) Quote Link to comment Share on other sites More sharing options...
graham Posted January 20, 2010 Share Posted January 20, 2010 Yep. It's just returning whether it's true (1) or not (0), which is good enough for the parameter Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted January 21, 2010 Author Share Posted January 21, 2010 Yep. It's just returning whether it's true (1) or not (0), which is good enough for the parameter Thanks for the help guys! I got it working, and learned some new things. Cheers, ~Ilan 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.