Lukich Posted November 8, 2004 Share Posted November 8, 2004 Hello again I was wondering if there's an expression in houdini that allows me to get a number of points in the group. Pointlist() returns a string with a list of those points, which is almost what I need. Is there a way to convert the pointlist output into an integer equal to the number of points? thanks a lot, Luka Quote Link to comment Share on other sites More sharing options...
stevenong Posted November 8, 2004 Share Posted November 8, 2004 Hi Luka, I would use a Delete SOP & delete points not in the group & use the npoints() to reference the Delete SOP. Cheers! steven Quote Link to comment Share on other sites More sharing options...
Lukich Posted November 8, 2004 Author Share Posted November 8, 2004 Thanks a lot, Steven! Amazing, I started doing precisely the same expression when you replied It's working!!! Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted November 8, 2004 Share Posted November 8, 2004 Hello again I was wondering if there's an expression in houdini that allows me to get a number of points in the group. Pointlist() returns a string with a list of those points, which is almost what I need. Is there a way to convert the pointlist output into an integer equal to the number of points?thanks a lot, Luka 14803[/snapback] Try this: float NPointsInGroup(string sop; string group_name) { float i = 0; string pt_list = pointlist(sop, group_name); float list_len = strlen(pt_list); float pt_num = 0; for(i = 0; i < list_len; i++) { if(substr(pt_list, i, 1) == "\x20") pt_num++; } return pt_num - 2; } Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted November 9, 2004 Share Posted November 9, 2004 Try this: float NPointsInGroup(string sop; string group_name) { float i = 0; string pt_list = pointlist(sop, group_name); float list_len = strlen(pt_list); float pt_num = 0; for(i = 0; i < list_len; i++) { if(substr(pt_list, i, 1) == "\x20") pt_num++; } return pt_num - 2; } 14807[/snapback] Interesting. Houdini's Custom expr function accepts hex value? I didn't know that. Quote Link to comment Share on other sites More sharing options...
edward Posted November 9, 2004 Share Posted November 9, 2004 argc(pointlist(sop_name, group_name)) Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted November 9, 2004 Share Posted November 9, 2004 Super! Quote Link to comment Share on other sites More sharing options...
aracid Posted November 9, 2004 Share Posted November 9, 2004 nice one ed aracid Quote Link to comment Share on other sites More sharing options...
Lukich Posted November 9, 2004 Author Share Posted November 9, 2004 very nice, indeed. thanks a lot, guys! 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.