# Creating a parts library

**URL:** <https://forum.universal-robots.com/t/creating-a-parts-library/42929>\
**Category:** Technical Questions\
**Created:** [June 16, 2026, 10:00am UTC](https://forum.universal-robots.com/t/creating-a-parts-library/42929 "2026-06-16T10:00:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian.shutes](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@brian.shutes](https://forum.universal-robots.com/u/brian.shutes)\
**Post date:** [June 16, 2026, 10:00am UTC](https://forum.universal-robots.com/t/creating-a-parts-library/42929/1 "2026-06-16T10:00:40Z")

</div>

Morning all. I have a UR10 with a WireTank dispenser for an effector. We stake a lot of PC boards around here. I’m beginning to get my head around variable waypoints and scripted moves, just enough to be dangerous and overly ambitious. My plan is to create a library of parts that I can drop into a program as subprograms to speed up programming of our hardware. Am I going to be able to use multiple copies of the same subprograms within the main program without running into proplems with duplicate variable and waypoint names?

I write the programs for the parts using a single fixed waypoint on the front left corner. My current attempt at this is to create the various staking locations using variable waypoints, scripted and direction motions. The waypoints are being generated by creating variables using the physical dimensions of the component. I am having trouble getting the variable waypoints to behave as expected.

For example, I have a quad pack that is 57mm square and 8mm tall. Waypoint FL\_1 is the front left corner of the part. The variables X\_Long and Y\_Wide are 57, Z\_High is 8. Variable waypoint FL\_2 should be (FL\_1 + Y\_Wide). FL\_3=(FL\_1 + X\_Long + Y\_Wide) and so forth. This seems simple, but I cannot get it to work with _pose\_trans_ or _pose\_add_. What am I missing to get these waypoints to work?

---

<div class="post-metadata">

**Author:** ![mattd](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mattd](https://forum.universal-robots.com/u/mattd)\
**Post date:** [June 23, 2026, 8:35am UTC](https://forum.universal-robots.com/t/creating-a-parts-library/42929/2 "2026-06-23T08:35:51Z")

</div>

Unfortunately the way subprograms seem to be handle is that before they are run (or compiled??) all of the script files are stuck together… so you need to make sure you don’t use variable names in multiple subprograms other wise you will have issues.

Scoping of variables with subprograms is quite hard to control.

Regarding the variable waypoints. It may be easier to create a feature plane (where FL\_1 is) and then you do all your other ways points in the coordinate system of that feature plane.

So then you can just move to X,Y,Z coordinates directly if you specify tool orientation, or get the tool orientation from the current position (or another taught waypoint). This is an example of how I am doing it.

```auto
global FoundPose = get_target_tcp_pose() #get the current blade pickup position (ignore x,y and z, just orientation really)
    textmsg("TargetPose in base:", FoundPose)

global FoundPose = pose_trans(pose_inv(CurBladeStack), FoundPose) #get current position in CurBladeStack Coordinate System
    textmsg("CurrentTCP in CurBladeStack:",FoundPose)
    global FoundPose = p[Xpos/1000.0,Ypos/1000.0,FoundPose[2],FoundPose[3],FoundPose[4],FoundPose[5]] # set x and y from Camera Coordinates.

```

---

<div class="post-metadata">

**Author:** ![mattd](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mattd](https://forum.universal-robots.com/u/mattd)\
**Post date:** [June 23, 2026, 8:40am UTC](https://forum.universal-robots.com/t/creating-a-parts-library/42929/3 "2026-06-23T08:40:09Z")

</div>

Just from my experience subPrograms seem useful, but actually cause many problems.

If there is a good way to achieve what you want without subprograms I would try for that.

If your library of targets was just an array/list of xyz coordinates to go to you could have a common robot program that just looped through the array for whichever part was selected. It would just make it a bit difficult to adjust points because you couldn’t manually move the robot to that program step (although really no different with variable waypoints).

---

<div class="post-metadata">

**Author:** ![brian.shutes](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@brian.shutes](https://forum.universal-robots.com/u/brian.shutes)\
**Post date:** [June 23, 2026, 9:59am UTC](https://forum.universal-robots.com/t/creating-a-parts-library/42929/4 "2026-06-23T09:59:39Z")

</div>

Thanks for the reply! It looks like I solve one challenge, only to move on to another. Never a dull moment with these things.

If I have unique variable names within each subprogram that I bring in, does that help alleviate any issues that I will run into?
