Macro Rotate ViewAxonometric

From FreeCAD Documentation
Jump to: navigation, search
Other languages:
English • ‎français • ‎italiano

Macro Rotate View with Y pointing upwards .png Macro Rotate ViewAxonometric

Description
This macro rotates the current view in ViewAxonometric.

Macro version : 01.00
Date last modification : 2010-11-17
FreeCAD version : All
Download : Macro_Rotate_View_with_Y_pointing_upwards_
Macro_Rotate_View_with_Z_pointing_upwards_
Author
Yorik
Download
Macro_Rotate_View_with_Y_pointing_upwards_
Macro_Rotate_View_with_Z_pointing_upwards_
Links
Macro Version
01.00
Date last modification
2010-11-17
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro_Rotate_View Macro Rotate View view 90 Degrees.png


Description

This macro rotates the current view in ViewAxonometric (as is: Y).

You have two options:

  • mode 1 : axonometric view with Y pointing upwards axonometric view with Y pointing upwards mode 1
  • mode 2 : axonometric view with Z pointing upwards axonometric view with Z pointing upwards mode 2 (uncomment for use)

Use

For use the two macros, copy the first macro and name it "Macro_Rotate_ViewAxonometric_Y" (mode 1) without change the code and use this icon axonometric view with Y pointing upwards

Copy the second macro and name it "Macro_Rotate_ViewAxonometric_Z" (mode 2) and:

comment the line

11 #rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards (mode 1)

and uncomment the line

12 rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) # Z pointing upwards (mode 2 uncomment for use) and use this icon axonometric view with Z pointing upwards

Script

  • mode 1 : ToolBar Icon Macro Rotate View with Y pointing upwards .png
  • mode 2 : ToolBar Icon Macro Rotate View with Z pointing upwards .png (uncomment for use)

Macro_Rotate_ViewAxonometric.FCMacro

import math
import pivy
from pivy import coin

Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")

cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot = coin.SbRotation()

rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards (mode 1)
#rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) # Z pointing upwards (mode 2 uncomment for use)
nrot = cam.orientation.getValue() * rot
cam.orientation = nrot
Gui.SendMsgToActiveView("ViewFit")