Jump to content

Select one or other in group

Recommended Posts

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!

Link to comment
Share on other sites

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 );


setpointgroup(0, "first", first_pt, 1) ;
setpointgroup(0, "last",  last_pt, 1) ;



Link to comment
Share on other sites

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);

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.

Link to comment
Share on other sites

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;


  • Like 2
Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...