Geo Nodes: strategy for tagging edges for later use that doesn't get destroyed by extrude edges?

I am generating some geometry via a series of extrude edges operations. After each extrude, I want to “save” the top edge for later use (I.e. tag it so that I can operate on it later). What I have done so far is use a “store named attribute” node to create a boolean attribute on the edges, and set it to true for these specific edges.

The issue I am running into is that the extrude edges node propagates the value of the boolean values to the next set of edges. That means that the newly created edges are now tagged with a value that they should not have.

I have three possible thoughts on how to deal with this situation, but I am wondering whether there are any better ways of handling this. (I haven’t implemented any of these yet, so there may be hidden gotcha’s I have not thought of)

The first is that I would separate out the edges that I want to extrude, remove the existing attributes, do the extrusion, give the newly extruded their new tags, and then join the geometry again afterwards. This feels clunky, and I need to individually disable every attribute that has been added to the mesh to this point.

The second is that I would do the extrusion, then use the top and side selection tags to turn OFF the boolean for any tags that had been carried over. This also feels very clunky, and as the mesh gets more complicated, I will have an ever expanding list of attributes that I need to go back and fix after each extrusion.

The third idea is that I would not store these edges using booleans, but rather as an integer (can’t store strings on edges as far as I know). So I would have to keep a written mapping table somewhere that tells me that integer 1 is a particular set of edges, integer 2 is a second set of edges and so on. Then, later, when I want to operate on specific edges I would have to do a compare on that stored attribute to re-create the selection. This seems like the best solution so far (and has the added benefit of only having a single attribute that I am carrying around), but it means I have an abstract number instead of an actual named attribute to specify a specific set of edges.

Does anyone have any better idea how to deal with this situation (that blender propagates attributes to new edges during an extrude)?

Thanks!

Yes essentially what I do for this type of situation is subtract the new edges from the pre-existing attribute with a boolean math node

Thanks. That was going to be my first solution, but once I have upwards of 20-30 attributes that I have to do that with it starts to get messy. For example, if I had to undo the attributes on each of the 25+ attributes I would have a pretty complex node tree (or node group) to fix each of these attributes.

Since I am only storing booleans, I think I have found a better way for my particular case.

In the following, simplified example I want to store the direction (in my case, front, back, left, or right) on each edge based on some criteria. I used to have four boolean attributes: Front, Back, Left, and Right, and I would set the value to True for any edges that matched the criteria for each direction.

Instead I now have a single integer attribute that will hold a value depending on the direction (1, 2, 3, or 4 - 0 is reserved for “undefined direction”). And I have a node group that can either set or query the direction using a menu switch (so that I don’t have to remember which integer corresponds to which direction).

Here is an image of that node group:

This lets me plug in the geometry and a selection and choose which direction to assign those edges.

If I do an extrusion that propagates the attribute values, I can use the top and side selections from this extrusion node and plug them into my node group above to quickly re-assign the new edges based on whatever criteria I want to use (or set them back to 0 to indicate no defined direction). Since it is a single attribute, I only have to do this once, no matter how many options I have on this attribute. In this case there are 4, one for each direction. But I also have another set of attributes that have over 25 possible values that would have previously been 25 different attributes.

Querying the value later uses the same node group. I just don’t plug anything into the geometry input or output, and use the selection output only. I have done some preliminary testing with this setup and it seems to work.

EDIT: I forgot to note that this ONLY works if each of the boolean attributes you are using are mutually exclusive. If not, then you are back to having to do it attribute by attribute.