RhinoCode: can Python commands use ordinary command behavior?

My plug-in is written in Python and built with RhinoCode, which generates C# command wrappers.

Setting a command’s type to Normal still generates a wrapper with CommandStyle(Style.ScriptRunner). Consequently, commands can nest: I start command A, type command B, and exiting B returns to A. I want ordinary behavior like Line/Move, where the second command cannot start.

The available settings seem to give me either transparent or ScriptRunner behavior, rather than ordinary commands.

Our workaround is a build postprocessing step using Mono.Cecil to remove the ScriptRunner flag from selected wrappers before packaging. This works in our tests; those commands use RhinoCommon directly and don’t call RunScript.

Is this workaround safe, or does RhinoCode require ScriptRunner for an internal reason? Is there a supported way to disable it, or am I playing with fire?

Hi @Stefano_Menci,

RhinoCode currently adds ScriptRunner to every command it generates, so scripts that call rs.Command or RhinoApp.RunScript work as if typed at the command line. The command type setting can’t turn it off at the moment.

Your post-processing workaround is fine, as long as those commands never call rs.Command or RhinoApp.RunScript. Without the flag they behave like ordinary commands: no nesting, and a single undo record.

– Dale