I'm looking for a way to "Id" duplicate arrays(SOLVED)

   2336   8   1
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
I have a set of prims that have a simple array, that have . the way the prims get generated is leaving a couple of duplicate prims that need an attribute for deleting while keeping one of the duplicates.

I can only find ways to find duplicates of the same number in the same array. eg. 1,2,3,4,4,4,5,6,7,87,56,

I need to find exact matching arrays?

eg.

prim0 = my_array1,2 "keep"
prim33 = my_array1,2 "remove"
prim85 = my_array1,2 "remove"
prim90 = my_array3,8 "keep"
prim96 = my_array3,8 "remove"
prim100 = my_array3,8 "remove"
Edited by Getyamamout - Jan. 26, 2024 18:03:35
User Avatar
Member
9380 posts
Joined: July 2007
Offline
You can for example create a string out of all array elements and that string will be your "id"

You can sort them before if same element different order arrays should be considered equal
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
I thought of this last night, and have made a single ID number, to match the arrays. But I still have the issue of not knowing how to ask the question, if another prim has the same value as a different one? "using vex" I keep making loops that end up checking the value of the one I'm checking against making it always be a duplicate even if it's not????
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
so I found idtoprim but can't get this to work ether ???
Edited by Getyamamout - Jan. 26, 2024 13:01:32

Attachments:
help.png (1.7 MB)

User Avatar
Member
5100 posts
Joined: Feb. 2012
Offline
Hi,

You can use the findattribval function:
https://www.sidefx.com/docs/houdini/vex/functions/findattribval.html [www.sidefx.com]

I wouldn't recommend joining integers like that as 121 could be 1, 21 and 12, 1 which are not the same arrays.

You have to use space separated (or another character) strings.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
@animatrix_ you make a good point about the integers. While not a problem at the moment as inputs and outputs only go up to 8. If I change anything it would certainly break as you say.

All I want is to remove the prims that have matching arrays. As they have the same inputs and outputs. meaning there a duplicate prim.

Translating the documents to do what I think they should do. and write it in vex is driving me crazy. making me get even more confused ... I will keep trying and check back soon...
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
so I have converted the array to a string but this just gives me another array exactly the same as before but in string format.

find attrib val is just giving -1

find attrib val count is giving 0

I am just getting totally lost. I don't know what I am doing. keep ending up in a big sloppy mess.
Edited by Getyamamout - Jan. 26, 2024 16:34:47

Attachments:
help.png (1.6 MB)

User Avatar
Member
9380 posts
Joined: July 2007
Offline
here is an example

there is an option Order Matters, that you can uncheck in case 2 arrays are considered identical with the same elements regardless of the order

Attachments:
ts_remove_prims_with_duplicate_arrays.hipnc (83.8 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
@tamte YOU MY FRIEND are an absolute SUPER STAR... THANK YOU SO MUCH it has done everything I wanted it to do.

I knew all that was needed were a couple of lines of vex.

I feel really bad for not being able to work this out myself.
You have gone out of your way to help. I am so grateful to everyone that helps.

this took about 10 seconds to understand what parts I needed. EXCELLENT work.

Attachments:
Solved.png (1.1 MB)

  • Quick Links