In some of our definitions using Human UI, we ask the user for initial objects which are processed and then baked.
Since the processed objects are meant to replace the initial ones, the later should be deleted.
I tried to use the “Create Rhino Command Button” to do this, by feeding it a command that selects the initial objects and deletes them, but it doesn’t work : I need to deleted them manually.
The new objects are created though.
I understand this is a case of possible infernal loop, since : if the initial objects are deleted, there is no more input for the definition to process, and there would be no more objects to bake…
Yet, this problem comes up very often, and I’d like to know if there is a “Clean and reliable” way of dealing with it.
(Here an example of a definition that will create mortise and tenon features on steel plates)
I think this is what you’re after. RhinoCommon has a helpful “Replace” method that will swap out an object while preserving its properties, and that seems to do the trick here, with a little scheduled-solution magic.
that script is only set up to work with Breps. this one should work with breps and curves. For additional types it will have to be similarly extended. replace geometry.gh (5.2 KB)