Prod.: Engine, ver.: 6, ID: 60001353, HowTo : Ability to turn of the "circle" and change the way view rotation is done in View3D "VROT"

HowTo : Ability to turn of the "circle" and change the way view rotation is done in View3D "VROT"

Article60001353
TypeHowTo
ProductEngine
Version6
Date Added3/16/2011
Submitted byAdam White
Keywords

Subject

Ability to turn of the "circle" and change the way view rotation is done in View3D "VROT"

Summary

Ability to turn of the "circle" and change the way view rotation is done in View3D "VROT"

Solution

It can be done by overriden the vdKeyDown event of VectorDrawBaseControl

example:

(Suppose that we have a form with a vdFramedControl added in the form control collection)

In the following example

1.when the user press the left or right arrow key by holding the Alt key, the view is rotated arrond the Y axis of active View .

2.when the user press the up or down arrow key by holding the Alt key, the view is rotated arrond the X axis of active View .

3.when the user press the left or right arrow key by holding the Control key, the view is rotated arrond the Z axis of active View .

private void Form1_Load(object sender, EventArgs e)

{

vdFramedControl.BaseControl.vdKeyDown += new VectorDraw.Professional.Control.KeyDownEventHandler(BaseControl_vdKeyDown);

}

void BaseControl_vdKeyDown(KeyEventArgs e, ref bool cancel)
        {
            BaseAction action = doc.ActiveLayOut.OverAllActiveAction;
            if(action == null) return;
            Matrix curmat = new Matrix( action.Render.CurrentMatrix);
            bool done = false;
            if (e.Alt && e.KeyCode == Keys.Left)
            {
                curmat.RotateYMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d);
                done = true;
               
            }
            else if (e.Alt && e.KeyCode == Keys.Right)
            {
                curmat.RotateYMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d);
                done = true;
               
            }
            else if (e.Alt && e.KeyCode == Keys.Up)
            {
                curmat.RotateXMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d);
                done = true;
               
            }
            else if (e.Alt && e.KeyCode == Keys.Down)
            {
                curmat.RotateXMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d);
                done = true;
               
            }
            else if (e.Control && e.KeyCode == Keys.Left)
            {
                curmat.RotateZMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d);
                done = true;
               
            }
            else if (e.Control && e.KeyCode == Keys.Right)
            {
                curmat.RotateZMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d);
                done = true;
               
            }
            if (!done) return;
            action.Render.CurrentMatrix = curmat;
            doc.Redraw(true);
            cancel = true;
        }