remove specific value from array

   1628   4   0
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi!

I added primitive numbers to an array representing the front and back of the geo (a box). Now, I would like to remove values from the array if they are at the bottom of the geo.

I've taken care of grouping primitives at the front, back and bottom and tested them. And now, I don't know how to remove the bottom primitives numbers from the array. I tried toggle but it only works partially.


if((i@group_back == 1) || (i@group_front == 1))
    {
    setdetailattrib(0, "possible", @primnum, "append");
    }

if((i@group_bottom == 1))
    {
    setdetailattrib(0, "possible", @primnum, "toggle");
    }

-Olivier

Attachments:
how_to_remove_from_array.JPG (159.9 KB)

User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
In detail mode you could loop/iterate over the number of primitives using the ‘index/count’ of the loop for the any of the array type functions to suit your purpose, e.g. array(), append(), removeindex()…etc.
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Ah! removeindex is what I needed.

Thanks!

-Olivier
User Avatar
Member
8539 posts
Joined: July 2007
Offline
Sounds more like you need removevalue()
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Oh nice! I'll surely use that function later on.

I ended placing and if statement inside an if statement.
//array of possible top door placement

if((i@group_back == 1) || (i@group_front == 1))
    {
    if(i@group_bottom != 1)
        {
        setdetailattrib(0, "possible", @primnum, "append");
        }
    }

Attachments:
top_door_placement_if_statements.JPG (79.7 KB)

  • Quick Links