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

 From:  Michael Gibson
11862.13 In reply to 11862.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