6ril Posted April 3, 2016 Share Posted April 3, 2016 Hi, a concrete slab ( box with size 3, 0.2, 1.5) after a voronoi fracture, I'm with prim groups: piece0 piece1 piece2 ... I'd like to select a few of them (pieces at the border of the slab) I know how to do it manually in the viewport / component groups / enable group selection or press 9 but how can I use this in a procedural way ? Like in a group node, with a bounding box ? It will only group the primitives, is there a way to extend the selection to connected geo ? must be possible.. Quote Link to comment Share on other sites More sharing options...
djiki Posted April 3, 2016 Share Posted April 3, 2016 Yes. You can turn On the option CopyCellPointsAttribute to pieces primitives and chose "P" . That will bring you every fractured part have its "center" position attribute on every primitive. Then use Group node and group primitives by an expression where you can use something like distance(PartCenterPos, AnArbittraryPosOnSlab) > SomeThresholdValue . That will groups only those parts which distance from ArbittraryPositionOnSlab is greater than ThresholdValue. Expression would be: distance(prim("../voronoifracture1",$PR,"P",0),prim("../voronoifracture1",$PR,"P",1),prim("../voronoifracture1",$PR,"P",2),0,0,0)>2 replace 0,0,0 with let say centroid of your slab. distance(prim("../voronoifracture1",$PR,"P",0),prim("../voronoifracture1",$PR,"P",1),prim("../voronoifracture1",$PR,"P",2),centroid("../box1",D_X),centroid("../box1",D_Y),centroid("../box1",D_Z) )>2 Quote Link to comment Share on other sites More sharing options...
6ril Posted April 3, 2016 Author Share Posted April 3, 2016 thanks Djiki, I'll look into that. But, on a more general aspect, when not about voronoi pieces, would it be possible to select many groups with a group node (procedurally), as it is possible manually? Quote Link to comment Share on other sites More sharing options...
djiki Posted April 3, 2016 Share Posted April 3, 2016 (edited) Group node actually create new group (or edit/modify an existing group) by some criteria. You will use it only if you have to do group creation based on some calculation at cook time, you have a lot of option from bounding up to normals orientation etc. Check documentation for GroupNode. If you need only selection of already existing groups you can use simple string pattern with wildcards and other acceptable expressions in the group combo box which is presented at almost all SOP nodes. That way you tell that node to operate only over that group "selection". . It is easy especially if group names are logically created. For example you can select all groups starting with letter G just by typing G* to your group combo box.. p*1* will select all groups which name begins with letter "p" and in the rest of the name contains number 1 p*1 will select all groups which name begins with letter "p" and ends with number 1 !q* will select all except groups which starts with letter "q" p???1 will select all groups which names begins with letter "p" and have exact 3 any letters followed with 1 {?hand* ^?hand_*} will select all groups which name begins with any letter followed by word "hand" except groups which name begins with any letter followed by word "hand_" etc. EDIT: Lines from here to the end of text are corrected. Thank to other members of forum, they notice wrong statements. This is corrected version of text: @name= form will select groups based on name attribute not group names @name=g*1 will select groups based on attribute name but will filter only those items which name's value match pattern g*1. For example: if you have primitive string attribute name @name=*s* will select all primitives which value of name attribute contains letter "s" @P.x>15 will select all points with x coordinate greater than 15 etc Edited April 4, 2016 by djiki Quote Link to comment Share on other sites More sharing options...
6ril Posted April 4, 2016 Author Share Posted April 4, 2016 ok, I knew all this, but let me rephrase my question : I got many groups: d1 d2 d3 ... d1200 Is it possible to select all the groups inside a bounding (box or geo, just like the bounding method of the group node) ? Quote Link to comment Share on other sites More sharing options...
djiki Posted April 5, 2016 Share Posted April 5, 2016 Yes. You can use ForEach node, chose EachGroup as option and then inside the loop do testing per each group and decide should it be applied to SELECTED group. scene tells more than words (of my bad English) http://wikisend.com/download/164544/GroupSelectionByBoundingBox.hipnc 2 Quote Link to comment Share on other sites More sharing options...
6ril Posted April 5, 2016 Author Share Posted April 5, 2016 !!!! djiki have you made this file for my question? I hope not. But anyway, thanks a lot buddy! Thanks for your time. Much appreciated. So about the bounding selection of groups, what a complex flow : / I think I understand it, have to look a little more into it, and apply it to my scene. Will let you know, but in anyway, thanks again! Quote Link to comment Share on other sites More sharing options...
6ril Posted April 5, 2016 Author Share Posted April 5, 2016 works ! groups_select.hipnc Quote Link to comment Share on other sites More sharing options...
djiki Posted April 5, 2016 Share Posted April 5, 2016 Of course it works It is not fastest way but it is illustrative so anyone could understand it. Quote Link to comment Share on other sites More sharing options...
6ril Posted April 6, 2016 Author Share Posted April 6, 2016 Would I dare to inquire a faster way ? Quote Link to comment Share on other sites More sharing options...
anim Posted April 6, 2016 Share Posted April 6, 2016 Would I dare to inquire a faster way ? - there is several ways, to begin with, it's overall faster to use name attribute instead of groups for pieces - then if you don't really care about precise selection, you can pack the pieces using Assemble SOP with Create Packed Geometry Option, then your group will select the whole pieces, however only based on centroid, so only if centroid is in bbox or within group rules, the piece will be in the group - if you need more precision, you can keep it unpacked, create point group (by bbox or virtually any), then you can delete it and lookup what name attribute values are missing, and set group for all primitives with that name you can use one liner for that: if (nametopoint(1, @name) == -1) i@group_grppieces = 1; should be super fast since no ForEach is necessary for more clarity here is an example for this way with 2 methods 1. groups only pieces that are completely contiained within group 2. groups all pieces that are at least partially contained within group (instead of nametopoint() or nametoprim() you can use findattribval() as well) ts_group_whole_pieces_VEX.hip 1 Quote Link to comment Share on other sites More sharing options...
f1480187 Posted April 6, 2016 Share Posted April 6, 2016 (edited) General solution for groups is a Split SOP. All groups of first output are partial bound. All groups except groups of second output are full bound. bound_groups.hipnc Edited April 6, 2016 by f1480187 1 Quote Link to comment Share on other sites More sharing options...
djiki Posted April 6, 2016 Share Posted April 6, 2016 (edited) @asd: Original scene contains groups that changed over time. Turb function is animated, so topology is changing from frame to frame. That same apply to groups too. Every frame you could have different number of groups with different polygons. An overlapping group, you added, should be also created by a calculation and not with static poly numbers for scene to work properly on every frame. Try to move time slider of your scene. And yes, this is much faster solution as general solution. Edited April 6, 2016 by djiki Quote Link to comment Share on other sites More sharing options...
f1480187 Posted April 6, 2016 Share Posted April 6, 2016 Thanks! Replaced the post's attachment with a procedural selection. This group overlaps some other groups to make it more like a "group selection propagation" problem. Quote Link to comment Share on other sites More sharing options...
6ril Posted April 6, 2016 Author Share Posted April 6, 2016 (edited) I'm glad I asked thank you all for all this insight, I'm learning a lot thanks to you. Tomas (anim) your VEX approach is ACE ! Edited April 6, 2016 by 6ril Quote Link to comment Share on other sites More sharing options...
6ril Posted April 8, 2016 Author Share Posted April 8, 2016 (edited) Hey, I'm facing a pb, related to that group selection. I've done it at SOP level, but now I would need to use it in DOP. Unfortunately, those groups of pieces aren't available once I've imported the packed objects in my sim : / I'm trying to deactivate some pieces with a "active value" node, but all I have is a list of pieces (too many of them to manually select). All I'm trying to do is a cracking a ground, with a growing box from underneath. But I need the outer pieces of the fractured ground to stay still. I tried to not include them in the packed pieces (hence the original question of this thread), but as static objects, and it creates collision pb (the resulting object is concave and the concave option of bullet doesn't help) then I watched a tutorial (controlling your fracture in H13) where they use the "active value" node in DOP, to deactivate the fringe/outter pieces. I have a feeling that the complex method used in this tutorial can be easier in H15, but I'm struggling to find it :/ what I call a complex method in that tutorial is this: using a foreach in SOP to create a point at the centroid of each pieces, colour those points black, then attribute transfer the white colour of an object close to the fringe (outter border). Then in the "active value" node in DOP, there's an expression to look at each piece center point colour and if white then deactivate. sound complex for H15 because I think there's tools in the voronoi node to keep internal attributes and maybe facilitate this method. BUT, why not simply use a group of pieces in DOP ? The "active value" node got a group option, like most nodes... Can someone help me there ? here is a simple hip file, with the "active value" node deactivating all pieces. how to deactivate only the outter pieces ? activevalue.hipnc Edited April 8, 2016 by 6ril Quote Link to comment Share on other sites More sharing options...
anim Posted April 9, 2016 Share Posted April 9, 2016 yes is super simple look at the file activevalue_fix.hipnc 1 Quote Link to comment Share on other sites More sharing options...
6ril Posted April 9, 2016 Author Share Posted April 9, 2016 AHAHahahah that simple ! Indeed ! Thanks Tomas ! Again ! Quote Link to comment Share on other sites More sharing options...
kurzemnieks Posted November 24, 2016 Share Posted November 24, 2016 Thanks! This was exactly what I was looking for. Though it would be nice if there would be a built in SOP with such functionality as this seems to be a common operation to do with groups. 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.