# Shift On and Shift Off

I have an application where I have a layer of waypoints in the same plane. Is there a way to take a chunk of waypoints in my code, and temporarily add the same cartesian value in the base frame to each pose?

Below is an example snippet of my polyscope code:

MoveL
waypoint1
waypoint2
waypoint3
waypoint4

One way I can do what I want (very long if you have a bunch of points that all need to change the same amount) is by doing:

x = waypoint1
x[2] = .2
movel(x)

But… the above method is super long and tedious if I have many way points on many different planes to do… I also need a bunch of unnecessary variable names and lines of code.

I wish there was a way to do:

If plane 1,
Shift following points in z direction +.2 with respect to the base frame
waypoint1
waypoint2
waypoint3
waypoint4
Turn off shift points

In the above method, my points would retain their original value after the shift in points is switched off.

Any help would be tremendously appreciated!!!

Another way I thought of doing this was storing the shift in a variable and then writing moveL commands in script… but I don’t know if syntax exists for this method…

x = .2
movel(waypoint1, waypoint1[2] = x)

So like move to waypoint1, but modify waypoint1 z value to temporarily be equal to x.

How about shifting the planes? You should likely have a fair amount less planes than waypoints.
Assign the plane to a variable and add a variable offset to the required coordinate(s). Then you can change the variable offset to shift all planes at once?

You can take a look here: Move with Offset - #22 by m.hammerton
There’s another thread very similar to yours, as far as I can tell.

Thanks! From the link you sent, I found a single line of code that does what I want:

movel(pose_trans(waypoint1,p[0,0,offset,0,0,0]))

HOWEVER, it does still require me to write a line of code for EACH waypoint that I want to offset…

It seems like creating a plane would be way more efficient. How can I set a plane to a variable and then offset it? I didn’t see code for this at all.

Also, is there a way to group waypoints in an offset using path_offset_enable/set/disable? I ran into controller errors when I tried to write code for this…

Might not have been the best explanation from me. You should be able to choose a plane in an Assignment-command. Then you can do something like:
YourPlane := p[YourPlane[0],YourPlane[1],YourPlane[2],YourPlane[3],YourPlane[4],YourPlane[5]]

This allows you to alter each coordinate to your liking. For example:
YourPlane := p[YourPlane[0],(YourPlane[1]+Y_Offset),YourPlane[2],YourPlane[3],YourPlane[4],YourPlane[5]]

Y_Offset being a variable or a value, of course.

I don’t know about the path_Offset function, I’m afraid.

efn! THANK YOU! I was able to do exactly as you said. I made two planes, one that was my reference plane (stays the same) and then an ‘adjusted plane’. My ‘adjusted plane’ was always equal to the reference plane in an assignment, but with an added z-shift depending on what I wanted to do in my code.

THANKS! This saved me a bunch of time, but ultimately made my code way simpler than I thought it would become.

That’s good to hear. Good idea with the reference plane and adjustable plane, too!