Move to certain coordinate one one or two axes, without changing the other coordinates

Hello,
Is there a way to move an object using world coordinates, but leaving some axis coordinates the same?
Example: Moving an object from (12.56, 5.22, 2.14) to (12.56, 5.22, 8).
I guess typing something similar to (-,-,8).

Being the first time that I have to write a question, I want to thank you guys for being such an awesome community, and spending so much of your time helping other people. You have saved me many times over the years.

Hello - you can use relative coordinates - for your target location use r0,0,8 or @0,0,8

-Pascal

Thank you Pascal,
but wouldn’t that move my object 8 units in the z direction? i want to move it to z=8 (r0,r0,w8).
perhaps a Setpt with rigid option?

Sorry, yes, I see what you mean- you can use .x, .y, .z for this

e.g

Move Pause Pause .z 0,0,8

meaning only the Z value of the point 0,0,8 will be used when you pick a point, x and y will come from the pick point (which can be your From point)

-Pascal

Thank you very much Pascal.
I found that .z 8 (instead of .z 0,0,8) works the same.
One last question please, is there a command like copy’s InPlace, so i can avoid the last step (having to click again the From point) and put it in a macro?
Thanks again,
John

-They say laziness leads to inventiveness, so I prefer to think of myself as an inventor :laughing:

Hi John - here is something you can try on a button to see if it does anything - bascially, when you’ve set your .z and get to the part where you want the From point just Ctrl-V to the command line.

! _-RunPythonScript (

import rhinoscriptsyntax as rs
import Rhino


import rhinoscriptsyntax as rs
import Rhino
def test():
    wxy = Rhino.Geometry.Plane.WorldXY
    
    ids = rs.GetObjects("Select objects to move", preselect=True)
    if not ids: return
    
    pt = rs.GetPoint("Point to move from")
    if not pt: return
    xForm = Rhino.Geometry.Transform.PlaneToPlane(wxy, rs.ViewCPlane())
    ptCPlane = rs.PointTransform(pt, xForm)
    
    rs.ClipboardText (ptCPlane.ToString())
    print "From point copied to the clipboard, paste when you need it."
    rs.SelectObjects(ids)
    rs.Command("Move " + ptCPlane.ToString() +" " )
    
test()

-Pascal

1 Like