def IsCommand(command_name): """Verifies that a command exists in Rhino. Useful when scripting commands found in 3rd party plug-ins. Parameters: command_name = the command name to test """ return rhcommand.IsCommand(command_name)
def InCommand(ignore_runners=True): """Determines if Rhino is currently running a command. Because Rhino allows for transparent commands (commands run from inside of other commands), this method returns the total number of active commands. Parameters: ignore_runners [opt] = If true, script running commands, such as LoadScript, RunScript, and ReadCommandFile will not counted. Returns: the number of active commands """ ids = rhcommand.GetCommandStack() return len(ids)
def LastCommandName(): """Returns the name of the last executed command Returns: str: the name of the last executed command Example: import rhinoscriptsyntax as rs rs.Command( "Line" ) print "The last command was the", rs.LastCommandName(), "command." See Also: Command IsCommand LastCommandResult """ id = rhcommand.LastCommandId return rhcommand.LookupCommandName(id, True)
def IsCommand(command_name): """Verifies that a command exists in Rhino. Useful when scripting commands found in 3rd party plug-ins. Parameters: command_name (str): The command name to test Returns: bool: True if the string is a command or False if it is not a command. Example: import rhinoscriptsyntax as rs cmdname = rs.GetString("Command name to test") if cmdname is not None: iscmd = rs.IsCommand(cmdname) if iscmd: print "The", cmdname, "command exists." else: print "The", cmdname, "command does not exist." See Also: Command InCommand """ return rhcommand.IsCommand(command_name)
def InCommand(ignore_runners=True): """Determines if Rhino is currently running a command. Because Rhino allows for transparent commands (commands run from inside of other commands), this method returns the total number of active commands. Parameters: ignore_runners [opt] = If true, script running commands, such as LoadScript, RunScript, and ReadCommandFile will not counted. Returns: the number of active commands Example: import rhinoscriptsyntax as rs commands = rs.InCommand() if commands > 0: print "Rhino is running", commands, "command(s)." else: print "Rhino is not running any command(s)." See Also: Command IsCommand """ ids = rhcommand.GetCommandStack() return len(ids)
def LastCommandName(): "Returns the name of the last executed command" id = rhcommand.LastCommandId return rhcommand.LookupCommandName(id, True)