In GH, I have a script which auto-references from a layer, does some things, then automatically bakes the result onto the same layer, both using Elefront components. I keep the script running in the background as I work in Rhino.
When I set both the input and output components to work automatically, GH gets stuck in an infinite loop and bakes a thousand or so of the same object. The input component reads whatever new geometry was just baked onto the layer, which I understand to be the correct behavior for the component.
What I’d like is for the input component to auto-reference when anything on the layer changes, except when new geometry is baked from the output component. I’m wondering if there is an option for that in Elefront, or some relatively easy script fix?
@Brayton_Orchard do you want the script to ignore all geometry baked with the “wires” BakeName or, just recent geometry baked with the “wires” BakeName?
@elevelle, just recent geometry with the ‘wires’ bakename, as in from the last bake. I want to reference all of the ‘wires’ geometry when I move a card (which the wires are connected to). I’m trying to mimic the directed-acyclic-graph of Grasshopper in a Rhino document to make knowledge graphs, if that clarifies my question.
@Brayton_Orchard I think I get what you are after. As you have noticed, referencing the output of a node back into the same node in a DAG breaks the graph as it is no longer directed in a manner that doesn’t form a loop. What you need to do here is ensure that the geometry that you bake doesn’t get operated on. Since the bake is “refreshed” every time you run the bake command, the following bit of GH will ensure that the referenced baked objects don’t get passed on to the bake component, resulting in the infinite loop you found yourself in.
I am assuming in this case, whatever is is updating the “wires” layer is not influenced by the output of this script, otherwise, you know, more looping. All you need to do is get the User Attributes of each referenced object and check to see if it’s BakeName matches whatever you want to ignore. If the BakeName matches the string you wish to ignore, you can cull it from the list.
That makes sense, but since I want to use the geometry with the ‘wires’ designation to re-reference, I may be running into the inherent limitations of DAGs, like you mentioned. I think what I’m looking for is an option for the Elefront reference components to be triggered only by user-driven input in Rhino (moving/modifying/creating objects), not by newly baked objects. I’ve attached the definitions for reference (these are RH8 files fyi).
yeah, I am not super clear on what you are trying to achieve, ha.
I don’t have RH8, so I won’t be able to check your files, but is there any particular reason you are baking new elements to the same layer as the other objects? Since you are using eleFront to “listen” to the wires layer for changes, why not just bake the changed objects to a different layer, like “wire-new”, that way the update will only happen when the content on the “wire” layer is modified from upstream on the graph. The issue here is that you working inside the same node on the graph and changing the input to that node with the output of your script. To do what I think you are asking about and keep everything on the same layer that is being listened to, you need to find a clever way to store the state of the objects on prior to the last trigger and evaluate if the objects have changed or not. If the objects haven’t changed and you ignore the newly baked content, then the rest of the script doesn’t execute.