Macro Rotate View/it: Difference between revisions
(Updating to match new version of source page) |
No edit summary |
||
(36 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
⚫ | |||
{{Macro/it |
|||
|Name=Macro Rotate View by 90° |
|||
|Icon=Macro Rotate View view 90 Degrees.png |
|||
|Translate=Ruota la vista di 90° |
|||
⚫ | |||
|Author=Yorik |
|||
|Version=01.00 |
|||
|Date=2010-11-17 |
|||
|FCVersion=Tutte |
|||
|Download=[https://wiki.freecad.org/images/a/a0/Macro_Rotate_View_view_90_Degrees.png ToolBar Icon] |
|||
|SeeAlso=[[Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric]], [[Macro_Rotate_View_Free|Macro Rotate View Free]] |
|||
⚫ | |||
<span id="Description"></span> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<span id="Limitations"></span> |
|||
⚫ | |||
==Limitazioni== |
|||
import math |
|||
from pivy import coin |
|||
cam = Gui.ActiveDocument.ActiveView.getCameraNode() |
|||
rot = coin.SbRotation() |
|||
⚫ | |||
nrot = cam.orientation.getValue() * rot |
|||
cam.orientation = nrot |
|||
⚫ | |||
== Desription== |
|||
This code for axonometric view with Y pointing upwards [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png]] |
|||
Funziona solo se si è in vista dall'alto |
|||
[[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop/it|XY (top)]] |
|||
⚫ | |||
{{Code|code= |
|||
Icona barra strumenti [[Image:Macro Rotate View view 90 Degrees.png]] |
|||
'''Macro_Rotate_View_90_Degrees.FCMacro''' |
|||
⚫ | |||
import math |
import math |
||
import pivy |
|||
from pivy import coin |
from pivy import coin |
||
Gui.activeDocument().activeView().viewAxonometric() |
|||
Gui.SendMsgToActiveView("ViewFit") |
|||
cam = Gui.ActiveDocument.ActiveView.getCameraNode() |
cam = Gui.ActiveDocument.ActiveView.getCameraNode() |
||
rot = coin.SbRotation() |
rot = coin.SbRotation() |
||
⚫ | |||
rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards |
|||
nrot = cam.orientation.getValue() * rot |
nrot = cam.orientation.getValue() * rot |
||
cam.orientation = nrot |
cam.orientation = nrot |
||
Gui.SendMsgToActiveView("ViewFit") |
|||
}} |
}} |
||
⚫ | |||
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 {{KEY|Enter}} > {{KEY|Enter}} |
|||
⚫ | |||
{{Code|code= |
|||
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 : |
|||
{{Code|code= |
|||
RotateView(0,1,0,45) |
|||
}} |
|||
Se non c'è nessun documento aperto restituisce un errore |
|||
{{clear}} |
{{clear}} |
||
⚫ |
Latest revision as of 08:45, 5 January 2024
Descrizione |
---|
Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto Versione macro: 01.00 Ultima modifica: 2010-11-17 Versione FreeCAD: Tutte Download: ToolBar Icon Autore: Yorik |
Autore |
Yorik |
Download |
ToolBar Icon |
Link |
Raccolta di macro Come installare le macro Personalizzare la toolbar |
Versione macro |
01.00 |
Data ultima modifica |
2010-11-17 |
Versioni di FreeCAD |
Tutte |
Scorciatoia |
Nessuna |
Vedere anche |
Macro Rotate ViewAxonometric, Macro Rotate View Free |
Descrizione
Questa macro ruota la vista corrente di 90° a sinistra.
Limitazioni
Funziona solo se si è in vista dall'alto XY (top)
Script
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