Macro Rotate View/it: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
{{Macro/it|Icon=Text-x-python|Name=Rotate View by 90°|Name/it=Rotate View by 90°|Description=Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto|Author=Yorik}} |
{{Macro/it|Icon=Text-x-python|Name=Rotate View by 90°|Name/it=Rotate View by 90°|Description=Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto|Author=Yorik}} |
||
==Description== |
|||
Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto |
|||
This macro rotates the current view by 90° to the left. Only works if you are in Top view [[File:Macro_Rotate_View_view_90_Degrees.png| rotation 90 degrees ]] |
|||
Line 14: | Line 15: | ||
}} |
}} |
||
== Desription== |
== Desription== |
||
This code for axonometric view with Y pointing upwards [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png]] |
This code for axonometric view with Y pointing upwards [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]] |
||
Revision as of 19:38, 9 January 2016
File:Text-x-python Rotate View by 90° |
Descrizione |
---|
Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto Autore: Yorik |
Autore |
Yorik |
Download |
None |
Link |
Raccolta di macro Come installare le macro Personalizzare la toolbar |
Versione macro |
1.0 |
Data ultima modifica |
None |
Versioni di FreeCAD |
None |
Scorciatoia |
Nessuna |
Vedere anche |
Nessuno |
Description
This macro rotates the current view by 90° to the left. Only works if you are in Top view
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
Desription
This code for axonometric view with Y pointing upwards
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
nrot = cam.orientation.getValue() * rot
cam.orientation = nrot
Gui.SendMsgToActiveView("ViewFit")
Descrizione
Questo codice incollato nella console Python di FreeCAD (o in una macro) consente di ruotare la vista sui 3 assi dell'angolo (in gradi) utile per creare un piano nella posizione desiderata
Uso
Incollare il codice nella console Python di FreeCAD e premere Enter > Enter
Script
def RotateView(axisX=1.0,axisY=0.0,axisZ=0.0,angle=45.0):
import math
from pivy import coin
try:
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot = coin.SbRotation()
rot.setValue(coin.SbVec3f(axisX,axisY,axisZ),math.radians(angle))
nrot = cam.orientation.getValue() * rot
cam.orientation = nrot
print axisX," ",axisY," ",axisZ," ",angle
except Exception:
print "Not ActiveView "
tip in the console ex :
RotateView(0,1,0,45)
Se non c'è nessun documento aperto restituisce un errore