Nerox Posted October 4, 2009 Share Posted October 4, 2009 Hi, I can remember I've seen a post according to this issue, but I can't find it anymore. I wonder, is it possible to use expressions or local variables inside VOPS? What I'm basicaly trying to do is generate a group for each point with the idnumber in it. The expression would be: grp_$ID, for instance. Another option would be to concat a string (grp_) with the id variable from the globals. But as far as I can see there doesn't seem to be a concat node in VOPS. Is there a way to do this without a loop, because there might be a large number of points which would slowdown the entire thing drastically, which I tend to ovoid. Quote Link to comment Share on other sites More sharing options...
realer Posted October 5, 2009 Share Posted October 5, 2009 in vops i sadly see no other way then via a loop.. but its rather straightforward.. inside the loop connect a print and a addgroup to the loops _i value and the print to the groups name input.. this creates a group per loop for whatever you loop through the loop hope it helps Quote Link to comment Share on other sites More sharing options...
anim Posted October 5, 2009 Share Posted October 5, 2009 if you are in SOPs then Partition SOP does what you want just set it to Points and specify grp_$ID as a rule (assuming you have point id attribute on geometry) in POPs you have to do it in VOPs, luckily there is a concat function in VEX so you can use Inline VOP to concat two strings or use pure VEX to do this (i tried it in POPs, but it didn't update group name for each point even though the names was correctly printed to the console, maybe it is not build to do such things i didn't try realer's method, but i find looping through all points for each point highly uneffective) and for your first question, there is no possibility to use expressions inside the VOP network, because it gets compiled before it is used, but you can use expressions on the parameters you promoted up by Parameter VOP Quote Link to comment Share on other sites More sharing options...
Nerox Posted October 5, 2009 Author Share Posted October 5, 2009 (edited) if you are in SOPs then Partition SOP does what you want just set it to Points and specify grp_$ID as a rule (assuming you have point id attribute on geometry) in POPs you have to do it in VOPs, luckily there is a concat function in VEX so you can use Inline VOP to concat two strings or use pure VEX to do this (i tried it in POPs, but it didn't update group name for each point even though the names was correctly printed to the console, maybe it is not build to do such things i didn't try realer's method, but i find looping through all points for each point highly uneffective) and for your first question, there is no possibility to use expressions inside the VOP network, because it gets compiled before it is used, but you can use expressions on the parameters you promoted up by Parameter VOP I thought that the partition sop couldn't handle just points or per point, I should have verified that ;-). I hope it's fast enough tough. Realer's solution to use a loop sounds interesting, but I'm not sure if it will serve the purpose I'm looking for. This grouping thing, including the point id, is because for example I want to be able to get the posX attribute value, of a certain point with a certain id. On a mesh with changing number of points over time, so using point numbers isn't an option. That's how I came up with the solution to create groups and include the points id in the groupname. I only need to figure out how to use the inline vop to concat grp_ with the id number. I have no experience in vex, so I think this is going cause me a lot of so called 'fun' ;-). Edit: I'm thinking about something like this, yet it doesn't seem to work: out1 = string concat(string grp_, int $id); Edited October 5, 2009 by Nerox Quote Link to comment Share on other sites More sharing options...
bhaveshpandey Posted October 5, 2009 Share Posted October 5, 2009 inline code VOP could help to an extent....but I guess its more like scripting in bits and pieces than using specific expressions.. i definitely have found it very useful. Quote Link to comment Share on other sites More sharing options...
anim Posted October 5, 2009 Share Posted October 5, 2009 ... I'm thinking about something like this, yet it doesn't seem to work: out1 = string concat(string grp_, int $id); here is the example of inline vop for this case but as i told you it seems that the addgroup is not creating new group for each point as you can see the output to the console prints all group names correctly, but there is only one group created inline.hipnc Quote Link to comment Share on other sites More sharing options...
Nerox Posted October 6, 2009 Author Share Posted October 6, 2009 here is the example of inline vop for this case but as i told you it seems that the addgroup is not creating new group for each point as you can see the output to the console prints all group names correctly, but there is only one group created That's just to bad, I've tried to add a create group node in your vop, unfortunately it doesn't seem to make a difference. Also specifing a group before the vop doesn't help ether. So I think your right, the add group isn't designed to create groups each time point a point is processed. Which does make sense if you think about it. Luckly the partition sop does the job, but I'm not sure if this will help me any further since I need to be able to check in vops if a group exists and query the point that's in it. Do you know how I can open up the console? Sometimes it opens on a error, it would be rather logical if it would be located under Window. 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.