# Create Waypoints in MoveNodes with external Button

**URL:** https://forum.universal-robots.com/t/create-waypoints-in-movenodes-with-external-button/3764
**Category:** Java
**Created:** [March 4, 2019, 12:37pm UTC](https://forum.universal-robots.com/t/create-waypoints-in-movenodes-with-external-button/3764 "2019-03-04T12:37:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![andreas.enhuber](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@andreas.enhuber](https://forum.universal-robots.com/u/andreas.enhuber)
#### Post date: [March 4, 2019, 12:37pm UTC](https://forum.universal-robots.com/t/create-waypoints-in-movenodes-with-external-button/3764/1 "2019-03-04T12:37:16Z")

</div>

Hello,

I’m facing big trouble on how to create waypoints in MoveNodes.

A short explanation of what has to be done by my URCap: I need to create MoveP and MoveJ Nodes with some of the digital inputs of the controller. For example, pushbutton 1 creates a MovePNode with 1 Waypoint. If pushbutton 2 is pressed, another waypoint should be created.

The URCap Node is inserted into the node tree by the operator.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/c/c4292812fedac345671539293a6a1e8fd579da3b.png)

As long as this view is open, the URCap will recognize changes to the digital inputs. After pushbutton 1 is pressed it looks like this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/c/cf9683eac7344ea920c671f6ad68903752fb3196.png)

So far so good. But i can’t find a way to create a waypoint by pressing pushbutton 2. The tree should look like this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/4/42b5da80d71f4631c8c229c8e27e20568d2abe82.png)

I’m really looking forward for your answers.

Thanks in advance,  
Andreas

---

<div class="post-metadata">

### Author: ![thph](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@thph](https://forum.universal-robots.com/u/thph)
#### Post date: [March 8, 2019, 7:29am UTC](https://forum.universal-robots.com/t/create-waypoints-in-movenodes-with-external-button/3764/2 "2019-03-08T07:29:09Z")

</div>

It might help to take a look at this sample: [URCap Sample: Vision Template Builder](https://forum.universal-robots.com/t/sample-vision-template-builder/3782)  
Src → PickProgramNodeContribution.java

I would think that the code should look something like this:

TreeNode root = MoveP node  
root.addChild(Point\_2).

But check the out the API Reference for TreeNode/Program node and the sample.

[https://plus.universal-robots.com/api-reference/](https://plus.universal-robots.com/api-reference/)

---

<div class="post-metadata">

### Author: ![andreas.enhuber](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@andreas.enhuber](https://forum.universal-robots.com/u/andreas.enhuber)
#### Post date: [March 14, 2019, 5:05pm UTC](https://forum.universal-robots.com/t/create-waypoints-in-movenodes-with-external-button/3764/3 "2019-03-14T17:05:31Z")

</div>

Thank you for the hints.  
Got it working.

Regards
