Jump to content

[SOLVED] vex groups question


Recommended Posts

Hi,

Probably easy question, but what would be the way to make this vex code shorter and work for more @id`s, so I don`t have to copy the same line of code multiple times?

if(@fid == 0)
    i@group_fid0 = 1;
    
if(@fid == 1)
    i@group_fid1 = 1;
    
if(@fid == 2)
    i@group_fid2 = 1;
    
if(@fid == 3)
    i@group_fid3 = 1;        

 

I basically want to make a group for all primitives with same id.

I`m guessing it can be done using arrays, but I`m not too good with them.

Thanks

Janis

Link to comment
Share on other sites

26 minutes ago, ikoon said:

Hi Janis,
I assume that @fid is an integer. You can run this in a prim wrangle:


string group_name = "fid" + itoa(i@fid);
setprimgroup(0, group_name, @primnum, 1, "set");

 

Perfect. This is what I was looking for. Thanks

 

26 minutes ago, Sepu said:

Use the partition Sop.

Nice one. This works nicely as well with fid`rint(@fid)`

 

Thanks guys!

Cheers

Janis

Link to comment
Share on other sites

  • cudarsjanis changed the title to [SOLVED] vex groups question

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.

Guest
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...