Disable deletion of component

Hi I’m wondering if there is any way to disable deletion of components in grasshopper. I’m specifically trying to figure out if it’s possible to add a line of code within a ghpython component to prevent itself from being deleted accidentally. If anyone have any suggestions of how I might achieve this it’s greatly appreciated!

If an accidental delete happens, the user can undo that. I might be missing something but why do you want to prevent the user from deleting a component if mistakes are easily remedied?

You can put your relevant components in a cluster and use password protection.

Thanks for your response. If it’s for a simple mistake, ctrl-z would work but I have a simulation software within grasshopper and couple of components are blocking users from doing certain actions. The current one way of bypassing it is by deleting the component itself. I was able to lock the component position and prevent it from moving the component by using comp.Attributes.Pivot method in ghpython and setting the Pivot. I was wondering if something similar to be done so that it disables deletion and if possible also prevent disabling the component itself unless a certain condition is met.

Cluster password is easily breakable and doesn’t prevent actual deleting of components placed on canvas

OK…

Sure the cluster can still be deleted. A solution with Grasshopper player might be an option if the goal is to have a non-trained person use a Grasshopper definition and not alter it…

I fail to see how that is a “simple mistake”?
-wim

1 Like