Makrodefinicja: Rotate ViewAxonometric

From FreeCAD Documentation
This page is a translated version of the page Macro Rotate ViewAxonometric and the translation is 7% complete.
Other languages:

Macro Rotate ViewAxonometric

Description
This macro rotates the current view in ViewAxonometric.

Macro version: 01.00
Last modified: 2010-11-17
FreeCAD version: All
Download: ToolBar Icon
Author: Yorik
Author
Yorik
Download
ToolBar Icon
Links
Macro Version
01.00
Date last modified
2010-11-17
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro_Rotate_View

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)

Usage

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
  • mode 2 : ToolBar Icon (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")