Jamshid63 Posted January 17, 2018 Share Posted January 17, 2018 HI I know This is a kind of basic and lazy stupid question. the question is how do you find if there is same piece number has been shared by two or more pieces ? For eg:- if you made 4 or 5 different fracture using the combination of voronoi and Boolean and you don't really know that if you named them correctly . but during the sim you noticed that some pieces are together. and you are lazy to go through all the pieces number in geo spreadsheet. what would be the easy and quick way to find two or more pieces are sharing the same piece number. ?? Like a filter or something. i usually go to the view port and press 9 and toggle to name. then i move the mouse around the pieces. but then you dont really know if some pieces are shared with some really small piece. Quote Link to comment Share on other sites More sharing options...
beliveau.maxime Posted January 18, 2018 Share Posted January 18, 2018 Hi Jamshid, This sounds a lot like a python thing to do. I've seen one of my sups do it before where you basically create a new list if a certain name exists more than once. I have a bit of free time today so I'll try to come up with a basic hip file. Keep you posted! Quote Link to comment Share on other sites More sharing options...
beliveau.maxime Posted January 18, 2018 Share Posted January 18, 2018 Got it! There's probably a more efficient way of doing this, but I'm currently learning python First one, create a point attribute = 0 for all packed objects. Then plug in your packed geo in a python sop and copy this inside. Then if the point attribute repeat is equal to 1 you know that piece's name is doubled at least. node = hou.pwd() geo = node.geometry() all_list = list() for point in geo.points(): repeat = point.attribValue("repeat") name = point.attribValue("name") if name not in all_list : all_list.append(name) elif name in all_list : repeat = 1 point.setAttribValue("repeat", repeat) for point in geo.points(): if repeat == 1 : print name I'd love to know how python experts would write this Quote Link to comment Share on other sites More sharing options...
Jamshid63 Posted January 19, 2018 Author Share Posted January 19, 2018 14 hours ago, beliveau.maxime said: Got it! There's probably a more efficient way of doing this, but I'm currently learning python First one, create a point attribute = 0 for all packed objects. Then plug in your packed geo in a python sop and copy this inside. Then if the point attribute repeat is equal to 1 you know that piece's name is doubled at least. node = hou.pwd() geo = node.geometry() all_list = list() for point in geo.points(): repeat = point.attribValue("repeat") name = point.attribValue("name") if name not in all_list : all_list.append(name) elif name in all_list : repeat = 1 point.setAttribValue("repeat", repeat) for point in geo.points(): if repeat == 1 : print name I'd love to know how python experts would write this Thanks for your effort Maxime. But i am really sorry. i never tried python scripting, so i dont know how to execute this above script. Is there any other way to find/fix that problem? Quote Link to comment Share on other sites More sharing options...
Parboil Posted January 23, 2018 Share Posted January 23, 2018 You can check for multiple of the same attribute value using the findattribvalcount() function in vex. I used this in a Attribute Wrangle set to Primatives string val = prim(0, "name", @primnum); int attrib_clash = findattribvalcount(0, "prim", "name", val); if (attrib_clash > 1){ setprimgroup(0, "clash", @primnum, 1, "set"); } Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 24, 2018 Share Posted January 24, 2018 13 hours ago, Parboil said: You can check for multiple of the same attribute value using the findattribvalcount() function in vex. I used this in a Attribute Wrangle set to Primatives string val = prim(0, "name", @primnum); int attrib_clash = findattribvalcount(0, "prim", "name", val); if (attrib_clash > 1){ setprimgroup(0, "clash", @primnum, 1, "set"); } yeah but...for a fragment that has say 10 faces/prims....they are all named piece123...so without even checking anything, you already know they have the same name...which is NOT a clash coz they're physically from the same piece... Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 24, 2018 Share Posted January 24, 2018 (edited) here's how to check visually with colors...ie. separate pieces with same name would get same color for inspection... You'll need my convert suffix HDA... but can be done without if you are a master wrangler... vu_showclashes.hipnc Edited January 24, 2018 by Noobini Quote Link to comment Share on other sites More sharing options...
Parboil Posted January 24, 2018 Share Posted January 24, 2018 12 hours ago, Noobini said: yeah but...for a fragment that has say 10 faces/prims....they are all named piece123...so without even checking anything, you already know they have the same name...which is NOT a clash coz they're physically from the same piece... Awh think i misunderstood what was being asked. If you want to convert "Name" attribute into an integer and strip the "piece" you can try this. I've also made a new group per piece i@p = atoi(strip(@name, "piece")); string grp_name = sprintf("newGroup%d", @p); setprimgroup(0, grp_name, @primnum, 1, "set"); @Cd = random(@p); 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 24, 2018 Share Posted January 24, 2018 (edited) yes Steven Knipping has shown the sprintf technique, i did the HDA for ease of use for non-coders Edited January 24, 2018 by Noobini 1 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.