NxLibCommand¶
- class nxlib.command.NxLibCommand(command_name, node_name=None, params={})¶
This class simplifies the execution of NxLib commands. The
parameters()andresult()methods provide access to the correspondingParametersandResultnodes of the tree. Theexecute()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
slotthe command should run in. By default the class will create a temporary slot used only by this instance ofNxLibCommand, 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
Commandnode is not exisintg or is Null. False otherwise.- Return type
bool
- parameters()¶
The command’s
Parametersnode, that will be fetched before the command executes.- Returns
The NxLibItem in which the parameters are stored.
- Return type
NxLibItem
- result()¶
The command’s
Resultnode 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
ErrorSymbolnode under theResultnode. False otherwise.- Return type
bool
- wait()¶
Waits for the command execution to finish.
- Raises
NxLibException – If the command execution was not successful.