Houdini Tip of the Day - Deleting Glue Constraints with Color

So last time I was talking about  activating RBD objects with the Active Value DOP and also with Glue Contraint Networks. I recently figured out how to delete glue constraints based on the distance a particular object is away from them.
It's fairly straightforward and by no means an advanced-level technique.

So basically what we are going to be doing is taking an object you have and scattering points on it and then assigning a particular color to those points. Then that color will be transferred to the glue network, and then we will promote that color value to the primitive level and then throw down a Delete SOP and delete what is colored.

Here's what your Network will look like at the end. Very simple but very effective.

By default, when you make a Glue Constraint Network it will look like this (inside the DOP Network)

Also, when you make a Glue Constraint Network, Houdini will make a separate Geometry node that will house a few nodes like "Connect Adjacent Pieces" and an "Attribute Create" that is making a few attributes for the Glue Constraint Network. 

Here's what you should have so far

Now what you need to do is make an object (in my case I made a sphere) that will be used to delete the Glue Constraints. Animate this object so that is encompasses the part of your object that you want to delete the constraints on. 
In my case, I wanted it to animate from being small to encompassing the whole wall.

My sphere starts off small

Over a few frames it grows to fully encompass the whole Glue Constraint Network

Now that I have that, after my sphere object I dropped down an "ISO Offset SOP" followed by a "Scatter SOP". I left the settings for these nodes at their defaults because we don't need an incredibly dense amount of points on our sphere. Just enough to evenly cover the surface.
 Okay now we need to apply color to the Glue Constraints and to the sphere. On the stream that has the Glue Constraints, drop down a Color SOP and set the color to pure black (0,0,0). And on the stream with the sphere, drop down a Color SOP and set the color to pure red (1,0,0).

Now I need to transfer the attributes from my red colored points onto my black colored Glue Constraints. To do this, I need an "Attribute Transfer SOP".
Drop one down and connect the output of the black Color SOP to the first input and output of the red Color SOP to the second input. 

If I play through the animation of my sphere I can see that as it gets closer to my Glue Constraints it slowly changes their color from black to red

It's important to point out here that if you are working at a much larger scene scale than the Houdini defaults (like I am) then you will need to increase the "Distance Threshold" value on the "Conditions" tab in the "Attribute Transfer" node. For instance, because I'm working in such a large scene scale I had to increase that value to 200.

Okay so far so good. Almost there!

Now after the Attribute Transfer SOP, drop down an "Attribute Promote SOP" and set the Original Name value to "Cd" (because we want to promote the color). Also make sure to change the "New Class" value to "Primitive" because we want to promote the red color that was on the Points from the Scatter SOP onto the Glue Constraints (which are technically a piece of geometry with polygons).

If you are interested in what this is actually doing, you can middle mouse click on the Attribute Transfer SOP and then on the Attribute Promote SOP and you will notice that it is taking the "Cd" Attribute that exists on the Point level and moving it to the Primitive level.

So really you can think of the Attribute Promote SOP as the Attribute Move SOP (at least that's what I call it)

Middle mouse on the Attribute Transfer SOP

Middle mouse on the Attribute Promote SOP

Finally, I need to delete any color that is not black (so in this case, delete everything that's red).
After the Attribute Promote SOP, drop down a Delete SOP and in the "Group" field, put "@Cd.x>0".
What this simple expression is saying is "take the attribute called 'Cd' " (@Cd), look for color value in the X (so in this case it would be looking for R because XYZ = RGB), and if that color value is above 0, delete it.

Now when you do that your constraints should look something like this

And that's it! Pretty simple but very effective because now you can animate any object and control how it breaks apart. You could even fracture your object more based on where your animated object is (I'll have to go through that in further detail at another time).

And again, just for clarity, your full node graph should look similar to this:

That's it!
Hoped this helped!