Macro Rotate View: Difference between revisions

From FreeCAD Documentation
(Test MacroCode template)
(Test syntaxhighlighting tags)
Line 30: Line 30:
'''Macro_Rotate_View_90_Degrees.FCMacro'''
'''Macro_Rotate_View_90_Degrees.FCMacro'''


<syntaxhighlight lang="python">
{{MacroCode|code=
import math
import math
from pivy import coin
from pivy import coin
Line 38: Line 38:
nrot = cam.orientation.getValue() * rot
nrot = cam.orientation.getValue() * rot
cam.orientation = nrot
cam.orientation = nrot
</syntaxhighlight>
}}





Revision as of 22:25, 7 May 2020

Rotate View by 90°

Description
This macro rotates the current view by 90° to the left. Only works if you are in Top view.

Macro version: 01.00
Last modified: 2010-11-17
FreeCAD version: All
Download: Macro_Rotate_View_view_90_Degrees
Author: Yorik
Author
Yorik
Download
Macro_Rotate_View_view_90_Degrees
Links
Macro Version
01.00
Date last modified
2010-11-17
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro_Rotate_ViewAxonometric
Macro Rotate View Free

Description

This macro rotates the current view by 90° to the left.

Limitations

Only works if you are in Top view: Std_ViewTop XY (top)

Script

ToolBar Icon

Macro_Rotate_View_90_Degrees.FCMacro

import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot = coin.SbRotation()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
nrot = cam.orientation.getValue() * rot
cam.orientation = nrot