# Creating waypoints while the code is running

**URL:** <https://forum.universal-robots.com/t/creating-waypoints-while-the-code-is-running/40517>\
**Category:** URScript\
**Created:** [July 10, 2025, 1:23pm UTC](https://forum.universal-robots.com/t/creating-waypoints-while-the-code-is-running/40517 "2025-07-10T13:23:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hayden.ntungwe](https://avatars.discourse-cdn.com/v4/letter/h/f475e1/32.png) [@hayden.ntungwe](https://forum.universal-robots.com/u/hayden.ntungwe)\
**Post date:** [July 10, 2025, 1:23pm UTC](https://forum.universal-robots.com/t/creating-waypoints-while-the-code-is-running/40517/1 "2025-07-10T13:23:03Z")

</div>

In my UR10 script I want to be able to us until contact to make it so that my tool keeps going until it makes contact with my item and from there it creates a waypoint at the spot where it made contact. Then I will move my arm certain distance until it makes contact with another point of the item and it will create another waypoint. From there I want it to go back to the first waypoint and move in the distance between the 1st and 2nd.

---

<div class="post-metadata">

**Author:** ![francis](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@francis](https://forum.universal-robots.com/u/francis)\
**Post date:** [July 11, 2025, 12:24am UTC](https://forum.universal-robots.com/t/creating-waypoints-while-the-code-is-running/40517/2 "2025-07-11T00:24:13Z")

</div>

you can get the contact points using get\_actual\_tcp\_pose() and save it in a variable.  
then use that variable as the parameter for your movej or movel.

---

<div class="post-metadata">

**Author:** ![hayden.ntungwe](https://avatars.discourse-cdn.com/v4/letter/h/f475e1/32.png) [@hayden.ntungwe](https://forum.universal-robots.com/u/hayden.ntungwe)\
**Post date:** [July 11, 2025, 5:49pm UTC](https://forum.universal-robots.com/t/creating-waypoints-while-the-code-is-running/40517/3 "2025-07-11T17:49:49Z")

</div>

Thankyou it worked fine
