seth_ro18 Posted August 10, 2010 Share Posted August 10, 2010 Hi, I'm trying to create multiple groups in a VOP SOP network, each group name containing the current point number, mygroup_<ptnum>. I format the name of each group with a Print node, which formats the string correctly, but apparently only passes mygroup_0 to the Create Point Group node, no matter what ptnum is. I'm attaching a file that hopefully makes this clearer. Am I using the Print node incorrectly? Is there a better way to do this? Thanks! createMultipleGroupsInVOPSOP.hipnc Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted August 10, 2010 Share Posted August 10, 2010 (edited) There are two versions in file, one coded with InlineVOP and second clear VOP solution. So totally now you got 200 groups, 100 from Inline and 100 from Vops. Cheers createMultipleGroupsInVOPSOP_FIX.hipnc Edited August 10, 2010 by SWANN Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted August 10, 2010 Share Posted August 10, 2010 Ofcourse if you want to create groups from point numbers of points that contains some attributes and you don't want names with points that don't contain attrib you have to add a little more code. Example below. Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted August 10, 2010 Share Posted August 10, 2010 (edited) As I sad in previous post, example below... forgot to atach file . EDIT: little mistake in code, dont initilize i to $ptnum, instead initialize it to 0. BTW. If you heavn't knew this, in H11 you can create groups with Python directly now, you don't need some funky self made solutions. createMultipleGroupsInVOPSOP_FIX2.hipnc Edited August 11, 2010 by SWANN Quote Link to comment Share on other sites More sharing options...
seth_ro18 Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks for the solution and extra tips, that's very helpful! I'm curious, in the inline solution, there is a for-loop creating multiple groups each time the VOP SOP is run. If I understand right, the VOP network runs for each point passed into it, so it seems multiple groups are being created by the loop for each point passed through the network. It seems the following code should create a group for the current point (without needing the for-loop), then since the VOP network iterates through each point (creating a group each time), the extra for-loop is not needed: string groupName = sprintf("neighbor_grp_INLINE_%d", i); newgroup(groupName); But that turns out to be incorrect. Why is that? Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted August 11, 2010 Share Posted August 11, 2010 (edited) string groupNormalName = sprintf("neighbor_grp_NORMAL_%d", $ptnum); addgroup(groupNormalName, $ptnum); $out = groupNormalName; if you print this code you will see that it creates 100 names with different point number. But it doesn't create 100 strings how you think. VOPs are SIMD (single instruction, multiple data) so that means they apply one instruction to all data, so in this example it adds ONE string (not 100 strings) to all points and when you print it it reads point number from point you are reading this string from, $ptnum is like local expression, but it's still one string "neighbor_grp_NORMAL_$ptnum". The same is with addgroup. MMB and you will see that it created one group and applied it to all points, it doesn't created 100 groups, only one operation and use it for multiple data. But it's group so you will not get multiple names of a group if you read it from another point, on each point group is the same. Edited August 11, 2010 by SWANN Quote Link to comment Share on other sites More sharing options...
seth_ro18 Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks, that makes sense. I could not find a good explanation of this in the docs so I appreciate your help! 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.