MoI discussion forum
MoI discussion forum

Full Version: move an object on the x,y plane but staying in the 3D view

Show messages: All  1-12  13-15

From: Michael Gibson
14 Dec 2025   [#13] In reply to [#11]
Hi hadri1, here are some scripts you can set on a shortcut key, copy/paste them in as the "Command" part of the shortcut.

They will get a point for the origin point to use for the cplane and automatically orient the cplane z axis direction to a world axis direction so you can skip the z axis dragging part:

Use this one for z axis (like the Top view):

code:
script:
function DoCPlaneDirZ()
{
	var pp = moi.ui.createPointPicker();

	while ( 1 )
	{
		if ( !pp.waitForEvent() )
			return false;
			
		if ( pp.event == 'finished' )
			break;
	}

	var frame = moi.vectorMath.createTopFrame();
	frame.origin = pp.pt;

	moi.view.setCPlane( frame, false /* Apply to all views */, false /*Orient ortho views*/ );
}

DoCPlaneDirZ();



This one for X axis (like the Right view):

code:
script:
function DoCPlaneDirX()
{
	var pp = moi.ui.createPointPicker();

	while ( 1 )
	{
		if ( !pp.waitForEvent() )
			return false;
			
		if ( pp.event == 'finished' )
			break;
	}

	var frame = moi.vectorMath.createRightFrame();
	frame.origin = pp.pt;

	moi.view.setCPlane( frame, false /* Apply to all views */, false /*Orient ortho views*/ );
}

DoCPlaneDirX();


This one for Y axis (like the Front view):

code:
script:
function DoCPlaneDirY()
{
	var pp = moi.ui.createPointPicker();

	while ( 1 )
	{
		if ( !pp.waitForEvent() )
			return false;
			
		if ( pp.event == 'finished' )
			break;
	}

	var frame = moi.vectorMath.createFrontFrame();
	frame.origin = pp.pt;

	moi.view.setCPlane( frame, false /* Apply to all views */, false /*Orient ortho views*/ );
}

DoCPlaneDirY();


- Michael
From: Michael Gibson
14 Dec 2025   [#14] In reply to [#12]
For resetting the cplane you can put this on a shortcut key:

script: moi.view.resetCPlane();

I was thinking of how it could be done automatically but it's pretty difficult, it would need to sort of hook itself in to another point pick which may not even be running yet.

- Michael
From: hadri1
14 Dec 2025   [#15]
It is perfect ! Thanks !

Show messages: All  1-12  13-15