Jump to content

Component Groups - group selection


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by djiki
Link to comment
Share on other sites

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) ?

Link to comment
Share on other sites

!!!! 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! :)

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

@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 by djiki
Link to comment
Share on other sites

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 by 6ril
Link to comment
Share on other sites

  • 7 months later...

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