# How to program multiple of the same thing

**URL:** <https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361>\
**Category:** Technical Questions\
**Created:** [April 1, 2021, 2:13pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361 "2021-04-01T14:13:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnaylor](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nnaylor](https://forum.universal-robots.com/u/nnaylor)\
**Post date:** [April 1, 2021, 2:13pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/1 "2021-04-01T14:13:55Z")

</div>

Topic title is weird, no idea how to describe it.

I have a fixture, picture attached. Robot arm is at the bottom. Each rectangle contains the same printed circuit board for a gluing application. Machine is a CB3. Currently, I have 3 planes set up, one for each spot. I do the programming on the center one because in program mode it seems to be referenced only to the base. Then in the code I change the plane.

However, if the plane isn’t set up just right, there could be errors. Since I mathematically know the position and orientation of each spot, is there a way to enter that information to make it exact?

I’ve done offsets using pose addition, but that was only in 1 direction and had now angular changes. I’ve looked into the trans function, but details seem limited and I don’t quite understand it, especially since I never learned any sort to matrix math.

 ![Capture](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/a/a6a5d1b39ec777f8805bfb5d757169a38fe3a45e.jpeg)

---

<div class="post-metadata">

**Author:** ![sya](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sya/32/216_2.png) [@sya](https://forum.universal-robots.com/u/sya)\
**Post date:** [April 2, 2021, 2:45pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/2 "2021-04-02T14:45:40Z")

</div>

Hi,

First of all, you don’t have to set three planes for each of them. You can only set one but offset it.

These tree same shaped items should share the same circle center but only with rotation difference for each of them, perhaps 30 degrees.

Therefore, you could set a custom plane(feature) such as plane\_A in the robot based on the circle center, X and Y direction.

Teach your waypoints and path relative to the plane\_A for the middle item. For example, the feature set as the plane\_A under the moveL or moveP commands.

Then, offset the plane\_A with certain angle so you can run the same path codes for the middle item but have an offset movement for the right or left item.

For example, if each item’s difference is Z-axis 30 degrees rotation, you can call the script code pose\_trans(plane\_A, p[0,0,0,0,0,d2r(30)]) to rotate the plane\_A 30 degrees each time or use plane\_A[5]=plane\_A[5]+d2r(30) to get the same result. By doing so, you get the right item path. Follow steps above but with d2r(-30) offset to get the left item path.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/8/8699c14e89cfb55ceb4273a8bdfa8b45beccfdf4.jpeg)

---

<div class="post-metadata">

**Author:** ![nnaylor](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nnaylor](https://forum.universal-robots.com/u/nnaylor)\
**Post date:** [April 5, 2021, 12:24pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/3 "2021-04-05T12:24:23Z")

</div>

Thank you Sya. I think that has potential to work. Is it possible to set a plane at the origin of the base? The fixtures are designed to be based around that so all the tool paths are the same.

---

<div class="post-metadata">

**Author:** ![sya](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sya/32/216_2.png) [@sya](https://forum.universal-robots.com/u/sya)\
**Post date:** [April 6, 2021, 7:47am UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/4 "2021-04-06T07:47:52Z")

</div>

Hi @nnaylor:

You can try to set the base plane as a variable and what I said above changes from pose\_trans to pose\_add such as pose\_add(base, p[0,0,0,0,0,d2r(30)]).

I guess it should work.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/d/d5ab482b43d5e3eb1557bd5ae0d42136d02f66e4.png)

---

<div class="post-metadata">

**Author:** ![nnaylor](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nnaylor](https://forum.universal-robots.com/u/nnaylor)\
**Post date:** [April 6, 2021, 9:00pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/5 "2021-04-06T21:00:01Z")

</div>

HI Sya,

My initial test using this method did appear to work. Now I’ll have to implement it and see how it goes with a program.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/system/32/1_2.png) [@system](https://forum.universal-robots.com/u/system)\
**Post date:** [April 8, 2021, 9:00pm UTC](https://forum.universal-robots.com/t/how-to-program-multiple-of-the-same-thing/13361/6 "2021-04-08T21:00:56Z")

</div>

Closed on April 8, 2021, 9:00pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
