SetXTo for RhinoMAC?

I am using the Peter’s Tools commands on Rhino for Windows, especially the SetXTo0 / SetXTo, SetYTo0 / SetYTo and SetZTo0 / SetZTo commands to quickly move selected points or geometry to 0 or to an arbitrary location in either X, Y or Z coordinates. Unfortunately this scripts seems to not work in RhinoMAC.

It is possible that a programmer to write some alternative scripts to do the same functions in RhinoMAC?

Yes, that shouldn’t be too hard to script…

But two things here -

First, Peter’s description talks about flattening objects which is not the same as moving them. Flattening is really covered by SetPt so all you really need are a set of macros…

If it is indeed moving , this could also be accomplished with Align in the correct view, but perhaps in that case scripts might be faster. So which is it, moving or flattening?

Yes, indeed, I am using this to flatten portions of geometries. I am just selecting the area of the geometry that I need, press the SetZTo0 button and done. My desired geometry it is flattened on the ground! Very quick and useful.

I just tried now the SetPt command and seems to do the same thing, just a little more clicks.

I have the following aliases I use for setting an axis to a value:

sX: ! _-SetPt _Pause _XSet=_Yes _YSet=_No _ZSet=_No _Alignment=_World _Copy=_No

sY: ! _-SetPt _Pause _XSet=_No _YSet=_Yes _ZSet=_No _Alignment=_World _Copy=_No

sZ: ! _-SetPt _Pause _XSet=_No _YSet=_No _ZSet=_Yes _Alignment=_World _Copy=_No

Then just click the point you want to set it to. Or, if instead of clicking a point, you type a number and enter, it will set (flatten) the objects to that value in the desired axis. I mostly use this for points/control points and planar curves. The macros are set up to use world axis directions, so the action is constant, no matter what view is active.


You can use ProjectToCPlane for this from the Top viewport as well.

Thank you. I will create some buttons using this macros for quick access.

Not working how expected actually. This will reference always from the ZERO point coordinate! so if I run the SetZ macro and type 100, my geometry will end up being moved to 100mm above the zero level and not to 100mm up from the actual location. I tried changing the World to CPlane but not working. It is possible to modify this script to actually move the geometry from the actual position instead of the Zero coordinate point?

No, that’s not what SetPt is for. You need to use Move or the Gumball to move a relative distance.

Ok, and how to do that using a script? Let’s say invoke the move in X script and type 100 to move my geometry in X direction 100mm. If I do type Move, it is asking the point to move from and after that the point to move to. Needs to be a quicker way to do this as explained previously.

Will be great to have a script for each movement direction to be invoked and after that to just type the desired units to move. Much faster.

Well, there are a few ways to do this. One way is to make a macro that is the equivalent of “Move Relative” - just this: ! _Move _Pause 0

With an object preselected, you run the macro, type the distance and pull the object in the axis direction you want (Ortho on) and click to set.

The Gumball is even easier, just click the arrow in the axis direction desired, type a number and enter.

Otherwise a very simple script for moving in X might be:

import rhinoscriptsyntax as rs

def MoveObjectsDirX():
    objs=rs.GetObjects("Select objects to move",preselect=True)
    if not objs: return
    dist=rs.GetReal("Distance to move in X?")
    if dist is None: return

This could be modified/adapted for the other axes by changing the direction vector and the definition name.