SetViewDirection Command

SetViewDirection( <Direction> )

Sets the direction of the 3D view orientation depending on the given object.

SetViewDirection(Vector((0, 0, 1)))

SetViewDirection((0, 0, 1))

SetViewDirection(x + y + z = 1)

SetViewDirection( )

Sets the direction of the 3D view orientation to the default position.

SetViewDirection()

SetViewDirection( <Direction>, <Boolean animated> )

Sets the direction of the 3D view orientation depending on the given object, with optional animation.

In order to obtain the rotation of the 3D view, depending on the values of a previously created slider α, use the command SetViewDirection(Vector((1; α; -30°)), false) in the OnUpdate scripting tab of slider α.

Notes:

  • The view direction can be set towards a line, segment, plane, etc.

  • If you do eg SetViewDirection(x + y + z = 1) twice then there are two possible outcomes and the second one will rotate the view 180°. To avoid ambiguity use eg SetViewDirection(Vector((0, 0, 1)))

  • See also Mode viewinfrontof.png View in front of tool.