Using a command button to run a command, best practice? Rhinocommon


#1

I’ve got a docked panel with a command button on it. I would the click even to run the same code as a rhinocommon command I created. What is the best practice, do I have two separate copies of the code to execute (one in the rhinocommon command and one in the button click event), or do I run the command from the button so there is only one copy? If the latter, how do I do this?

Thanks,
Sam


(Steve Baer) #2

Have your buttons run commands through RhinoApp.RunScript. Never make a copy of your code; one version is eventually going to not match the other.


(Menno Deij - van Rijswijk) #3

The best practice is called DRY


#4

Thanks guys, this very likely saved me from pulling out all my hair some day down the road, whats left of it anyway :slight_smile: