Universal Robots Forum

Configure an assignmentnode

Hello everyone,

Does someone have an example how to add an assignmentnode in the tree and configure it with java?

We’re able to add the assignmentnode to the tree but we can’t configure it with an expression.

Looking forward to hearing from you.

any Solutions? I want to do the same Thing, but have Problems with the creatExpressionConfig

I got this code working for an Assingment Node.

Code:

	try {
		myMoveNode = programNodeFactory.createMoveNode();
		TreeNode rootTreeNode = programModel.getRootTreeNode(this);	
		
		try {	//Write var
				clearErrors();
				//Create a global variable with an initial value and store it in the data model to make it available to all program nodes.
				Start = variableFactory.createGlobalVariable("On");
				myDataModel.set(SELECTED_VAR, Start);
				System.out.print("variabele gemaakt");
				
			} catch (VariableException e) {
				setError(e.getLocalizedMessage());
				e.printStackTrace();
				System.out.print("variabele mislukt");
			}

			try {
				ExStartLas = urCapAPI.getValueFactoryProvider().createExpressionBuilder().append("False").build();
				
			} catch (InvalidExpressionException e) {
				setError(e.getLocalizedMessage());
				e.printStackTrace();			
			}

			myAssignmentNode = programNodeFactory.createAssignmentNode();
			myTreeNode = rootTreeNode.addChild(myAssignmentNode);
			myAssignmentNodeConfigFactory = myAssignmentNode.getConfigFactory();
			myAssignmentNodeConfig = myAssignmentNodeConfigFactory.createExpressionConfig(Start, ExStart);
			myAssignmentNode.setConfig(myAssignmentNodeConfig);
			
		} catch (TreeStructureException e) {
			e.printStackTrace();
		}

OK thx i will try it !