garf Posted April 5, 2019 Share Posted April 5, 2019 Having a brainfart here: I have a bunch of lines which I'm currently looping over and assigning the end points (ie. has 1 neighbour) into a group. What I now want to do is remove 1 or the other of these two points from the group. Someone show me what a donut I'm being, please! Quote Link to comment Share on other sites More sharing options...
ikoon Posted April 5, 2019 Share Posted April 5, 2019 Hi, I hope that I understood it right. I have attached the file. You could do "for each primitive" loop and wrangle something like this: int first = 0; int last = -1 + primvertexcount(0, @primnum); if (@ptnum == first) @Cd = {1,0,0}; if (@ptnum == last) @Cd = {0,0,1}; Or you could inside one Primitive wrangle: int first = 0; int last = -1 + primvertexcount(0, @primnum); int first_pt = primpoint(0, @primnum, first); int last_pt = primpoint(0, @primnum, last ); setpointattrib(0,"Cd",first_pt,{1,0,0}); setpointattrib(0,"Cd",last_pt,{0,0,1}); setpointgroup(0, "first", first_pt, 1) ; setpointgroup(0, "last", last_pt, 1) ; first_last.hiplc Quote Link to comment Share on other sites More sharing options...
celd Posted April 5, 2019 Share Posted April 5, 2019 I wanted to try a method which works independent of point numbers: int npoints = npoints(0); for (int i = 0; i<npoints; i++){ int group = inpointgroup(0,"end_point",i); if (group){ setpointgroup(0, "end_point",i, 0); break; } } You would put this in a detail wrangle after you create your end_point group and then replace "end_point" with whatever you named it. This probably is not the best method for heavy geometry. Quote Link to comment Share on other sites More sharing options...
anim Posted April 5, 2019 Share Posted April 5, 2019 just to select random end point per curve without any sop or vex for loops you can do (pointwrangle) int index = -(rand(@primnum) < 0.5); int pts[] = primpoints(0, @primnum); i@group_randomend = pts[index] == @ptnum; 2 Quote Link to comment Share on other sites More sharing options...
garf Posted April 5, 2019 Author Share Posted April 5, 2019 nice one cheers for the replies guys as ever - @anim's snippet did the business 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.