Move constraints X,Y,Z direction | R7

Helo community,

My goal is:

  • to bind a key (A,W,D) to a macro in order to constraint the movement of an object in X, Y and Z direction, WHILE I’m inside the move command. Is it even possible? I try to replicate this easy feature Sketchup has, as I’m trying to speed up my workflow in Rhino.

This topic already talk about this, but only for the vertical direction. Basically, binded to a key, its this command:

! _Move _Pause _Vertical=Yes

and its not executable inside de move command. Also How about the X and Y direction ?

Regards,
-CC

Did you ever try to use the TAB key? I couldn’t use rhino without it…

Anyway, your request is still interesting! … rhinoscript to the rescue! ** super hero theme song starts **

MoveWithZHelper

This script simply: 1 get geometries, 2 ask for a point, 3 create a vertical line where you picked the point, 4 starts the “Move” command bypassing input geometries and start point part.

So you can snap into the line and hit the TAB key to constraint your direction along with Z.
(Also you can do the same with X and Y with ortho, and even temporary enable ortho by holding shift…)

I’ve never actually learn how to save scripts into their proper file.extension :rofl:
So here is the code, copy-paste it into a new custom button…

-runscript (
sub MoveWithZHelper
' by Riccardo Majewski
Dim objs
objs = Rhino.SelectedObjects(true,true)
If Not IsArray(objs) Then
Rhino.UnselectAllObjects
objs = Rhino.GetObjects ("Select objects to move")
If IsNull(objs) Then Exit Sub
End If
Rhino.SelectObjects (objs)
pt = Rhino.GetPoint ("Point to move from")
d=10
lineX = Rhino.AddLine(array(pt(0)-d,pt(1),pt(2)), array(pt(0)+d,pt(1),pt(2)))
lineY = Rhino.AddLine(array(pt(0),pt(1)-d,pt(2)), array(pt(0),pt(1)+d,pt(2)))
lineZ = Rhino.AddLine(array(pt(0),pt(1),pt(2)-d), array(pt(0),pt(1),pt(2)+d))
Rhino.ObjectColor lineX, RGB(200,50,50)
Rhino.ObjectColor lineY, RGB(50,200,50)
Rhino.ObjectColor lineZ, RGB(50,50,200)
Rhino.Command (" _Move "&rhino.pt2str(pt, 6))
Rhino.DeleteObject (lineX)
Rhino.DeleteObject (lineY)
Rhino.DeleteObject (lineZ)
End sub
MoveWithZHelper
)

Updated:
2020-12-26 03_00_46-Window

1 Like

Hi Charles,

below are macros for constrained X,Y and Z direction, make sure that your object(s) are preselected:

! _Move _Pause _Pause _AlongLine r0,0,0 r1,0,0
! _Move _Pause _Pause _AlongLine r0,0,0 r0,1,0
! _Move _Pause _Pause _AlongLine r0,0,0 r0,0,1

After picking a (first) point to move from, you can either pick a second point to move to or enter a distance. It will then move with the distance entered in either X, Y or Z.

btw. TAB key works best Imho.
_
c.

2 Likes

@clement, almost there!! except now I have 4 different keys for moving an objects A,W,D, C(_move). its still better then moving with the gismo axes tho! (allow you to move objects easily and precisely by its verticies).

I’d really like to be able to only use my move binded key ( C), THEN enter a key for a constraint (like arrows key, or A,W,D).

P.S. I’m aware of the TAB key, which lock your direction, but depending of your angle of view, its not always easy to get the 3 axis…

@maje90 ^^, concerning your script, I’ve never used a script :O. And not sure to 100% understand the difference between your script and what @clement proposed as solution ?

We’re almost there! thanks

Regards,
-CC

That’s a sort of particular problem…
Edited the script so it create 3 lines with different color, as usual red=X green=Y blue=Z

clement’s solution you run a command with pre-constrained direction, if you are sure of what you do, that is simple and efficient.

My solution is just adding some snapping point ready to be used with TAB key during the move command, if you want you can use them, otherwise you can just ignore them.

Hi Charles,

you might setup the alias eg, for “X” using only this part of the macro:

_AlongLine r0,0,0 r1,0,0

Now start the _Move command (using your Alias “C”), pick the point to move from and enter X to invoke the macro set above.

_
c.

1 Like

Hi @clement, well I think we’re getting close enough and I can adapt to that new way of doing the thing ^^.

Although, in a mean time, if anyone come up with the exact solution I would be happy if you could share :slight_smile: ! This way, the constant switch from Sketchup to Rhino would be more practical !

Acceptable solution :

  1. Lock direction : by executing
    _AlongLine r0,0,0 r1,0,0 (Alias ‘‘W’’) Z direction
    _AlongLine r0,0,0 r0,1,0 (Alias ‘‘A’’) X direction
    _AlongLine r0,0,0 r0,0,1 (Alias ‘‘D’’) Y direction

  2. Execute _Move command (Using alias ‘‘C’’)

Perfect solution :

  • Invert steps order

Regards,
-CC