Macro Rotate ViewAxonometric

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Macro Rotate ViewAxonometric and the translation is 100% complete.
Other languages:
English • ‎français • ‎italiano

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

Description
Cette macro pivote la vue dans la position axonométrique (2 posibilités, Y et Z).

Macro version: 01.00
Last modified: 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 modified
2010-11-17
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro Rotate View Macro Rotate View view 90 Degrees.png


Description

Cette macro pivote la vue dans la position axonométrique (tel quel: Y).

Vous avez deux options:

  • mode 1 : axonometric vue Y axonometric view with Y pointing upwards mode 1
  • mode 2 : axonometric vue Z axonometric view with Z pointing upwards mode 2 (dé-commenter pour utiliser)

Utilisation

Pour utiliser les deux macros, copiez la première macro et nommez-la "Macro_Rotate_ViewAxonometric_Y" (mode 1) sans changer le code et utilisez cette icône axonometric view with Y pointing upwards.

Copiez la seconde macro et namez la "Macro_Rotate_ViewAxonometric_Z" (mode 2) and:

commentez la ligne

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

et décommettez la ligne

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")