NxLibCommand

class nxlib.command.NxLibCommand(command_name, node_name=None, params={})

This class simplifies the execution of NxLib commands. The parameters() and result() methods provide access to the corresponding Parameters and Result nodes of the tree. The execute() method starts the command by writing the command name to the tree and allows for synchronous and asynchronous command execution.

Parameters
  • command_name (str) – Name of the command to execute.

  • node_name (str, optional) – Name of the execution slot the command should run in. By default the class will create a temporary slot used only by this instance of NxLibCommand, which is automatically deleted in the destructor.

assert_successful()

Checks whether the previous command execution is finished and was successful.

Raises

NxLibException – If the command execution was not successful.

execute(command_name=None, wait=True)

Executes the current command.

Parameters
  • command_name (str, optional) – Name of the command to execute. This overwrites the command name from the constructor. Defaults to None.

  • wait (bool, optional) – If True, the function waits until execution of the command is finished and throws an NxLibException if the command finished with an error. Defaults to True.

finished()

Checks whether the command execution has already finished.

Returns

True, if NxLib is not currently executing a command, i.e. the Command node is not exisintg or is Null. False otherwise.

Return type

bool

parameters()

The command’s Parameters node, that will be fetched before the command executes.

Returns

The NxLibItem in which the parameters are stored.

Return type

NxLibItem

result()

The command’s Result node after the command finishes.

Returns

The NxLibItem in which the results are stored.

Return type

NxLibItem

slot()

The slot, i.e. the NxLibItem, the NxLibCommand is running on.

Returns

The NxLibItem the command runs on.

Return type

NxLibItem

successful()

Checks whether the previous command execution was successful.

Returns

True if the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node under the Result node. False otherwise.

Return type

bool