MoI discussion forum
MoI discussion forum

Full Version: Rotate objects 90º relative to view

Show messages: All  1-4  5-16

From: Marc (TELLIER)
10 Jan   [#5] In reply to [#4]
Hi Michael,

World x,y,z axis in 3d view.

Marc
From: Marc (TELLIER)
10 Jan   [#6] In reply to [#4]
Hi Michael,

Thinking about it, 3D view-based rotation as you described could also be interesting to quickly adjust object rotation.

But this would be for a different usage than for making plan details.
Adjusting profiles along a sweep object of organic shapes could be a usage example.

Maybe this manner could work without the rotation angle 90º constraint or have a modifier to snap to.
The command could trigger rotate, center, and mouse "up or down" or "left and right" could approximate the rotation angle.

Thanks,

Marc
From: Michael Gibson
10 Jan   [#7] In reply to [#5]
Hi Marc, ok try the attached script.

Instructions for installing a plug-in script command here.

Set one of these for the command on each arrow key shortcut, note there should be a space after "Rotate90RelativeToView" :

Rotate90RelativeToView Left
Rotate90RelativeToView Right
Rotate90RelativeToView Up
Rotate90RelativeToView Down

- Michael

EDIT: applied bug fix from Mik

Attachments:
Rotate90RelativeToView.js


From: Marc (TELLIER)
10 Jan   [#8] In reply to [#7]
Hi Michael,

Works like a charm, you are a magician !

Thanks for taking the time to look at this.

Here's a project I'm working on, a Morris chair design with assorted table and leg rests in cherry wood .
The command will help in the laying out of individual parts.

Marc




Image Attachments:
Screenshot 2026-01-10 at 6.02.14 PM.png 


From: Matadem
10 Jan   [#9]
The spacebar script to switch view is fast also...especially on a laptop.
cannot live without it.
From: Marc (TELLIER)
11 Jan   [#10] In reply to [#9]
Indeed !

Is it the script that toggles the active viewport to fullscreen, and goes back to split view if pressed again ?

Marc
From: Matadem
11 Jan   [#11]
Yes..thats the one. ctrl+spacebar will flip left to right, front to back etc.
From: Marc (TELLIER)
12 Jan   [#12]
Hi Matadem,

I didn't know about flipping the view 180º, quite interesting.

Thanks !

Marc
From: Matadem
12 Jan   [#13] In reply to [#12]
Ctrl+space script:moi.ui.mainWindow.viewpanel.reverseView( moi.ui.getActiveViewport().name );

This is the way I have it setup.
From: Marc (TELLIER)
12 Jan   [#14] In reply to [#13]
Thanks !

Marc
From: Mik (MIKULAS)
15 Jan   [#15] In reply to [#7]
Hello Michael,

I've noticed that if I set arrow key Up with command Rotate90RelativeToView Up, so the model turn Down and vice versa, if I set arrow key Down with command Rotate90RelativeToView Down, so the model turn Up,

therefore I changed the order of code from:

case 'left': view_dir = frame.yaxis; view_dir.scale( -1.0 ); break;
case 'right': view_dir = frame.yaxis; break;
case 'up': view_dir = frame.xaxis; break;
case 'down': view_dir = frame.xaxis; view_dir.scale( -1.0 ); break;

to

case 'left': view_dir = frame.yaxis; view_dir.scale( -1.0 ); break;
case 'right': view_dir = frame.yaxis; break;
case 'up': view_dir = frame.xaxis; view_dir.scale( -1.0 ); break;
case 'down': view_dir = frame.xaxis; break;

now the model rotation correspond to arrow key dirrection.

Is that right?

Thanks

Mik
From: Michael Gibson
15 Jan   [#16] In reply to [#15]
Hi Mik, yes you're correct, thanks for the bug fix. I have updated the script above.

- Michael

Show messages: All  1-4  5-16