I’m manipulating a mesh in Rhino and referencing it in Grasshopper to run an optimization with Kangaroo. Once I’m happy with the result, the optimized mesh is baked. The Grasshopper Rhino Bake Content component is set to Update which should delete the old mesh and bake the new mesh.
This process of manipulation / baking can include many repetitions where I’m tweaking geometry, run the Kangaroo optimization, bake, manipulate, bake again and so on.
During my manipulation in Rhino, a mesh can become invalid.
When the Bake Content component input contains an invalid mesh, the previously baked object is deleted but no new mesh is baked, hence I loose my input. I came up with a workaround while writing this post:
The geometry description is compared against the word ‘Invalid*’.
When the object is invalid, the Content Input on the Bake Component is delayed by 0.2 seconds and within the delay, a C# script expires the Bake Component. The valid object is not being replaced.
I might be wrong but could the Bake Content component maybe be altered so it first checks whether in input is valid before deleting what has been baked previously?
One observation I have about invalid objects - this is from my experience with scripts, where created invalid objects are also normally blocked from being added to the document - is that sometimes it’s actually good to have a result even if it is invalid. For example, an invalid mesh might just need a little fixing once it’s baked to make it good. Maybe even in some kind of external editor if Rhino isn’t up to the task. But since you can’t add it to the document, you can’t even attempt the repair, nor even really know what’s wrong…
I have a vague recollection of a workaround that allowed adding invalid objects to the document, but i can’t find it anymore… Having the option to do so as an expert method would be good (IMO).
maybe just filter on the Button side of the definition ?
depending on your wish feed null / true / false into the Bake-Content.
not sure if “null” as text is interpreted correctly.
I re-uploaded the file in my post above, it wasn’t the last version.
The problem is that the button has no effect.
When the input goes invalid, the Bake Content component simply triggers again without having to do anything. I’ll upload a video in a bit.
@Helvetosaur I don’t need to bake the invalid mesh. The mesh is already in the document and one reason the mesh is invalid is that I need to reset Kangaroo before an output mesh is created. Sorry it’s complicated…
All I need is that the Bake Content component does not overwrite / delete the invalid mesh.
I figured out one of my problems was a script which had no output when the Kangaroo solver got stuck and needed a reset.
I think this eliminates the problem in my case. Still, if the geometry is an invalid mesh, the Model Object component shows it as Model Mesh. Maybe the Model Object component needs a tweak so it complains? I don’t know.
When objects have been baked with a button on the Bake input of the Bake Content component, changing the layer input on the Model Object component to another layer deletes what has been baked before. This cannot be undone. The only option to get the deleted objects back is to close the Rhino document and open it again, given that the file has been saved.
After testing and using the Bake Content component for weeks, since it has been released and on most of my applications, I’m convinced that adding a custom criteria would be a very useful addition to the current update criteria of the Bake Content component. I believe a custom criteria like a combination of a user text and layer name would be more versatile than only relying. I don’t have the skills to program my own Bake component, don’t want to use EleFront again and I also think many users would benefit from a custom update criteria.
@kike have you been able to reproduce this problem?