Macro Rotate View/it: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 16: | Line 16: | ||
{{clear}} |
{{clear}} |
||
==Description== |
==Description== |
||
⚫ | |||
⚫ | |||
interesting to create a plan to a desired position |
|||
==Use== |
==Use== |
||
⚫ | |||
⚫ | |||
==Script== |
==Script== |
||
{{Code|code= |
{{Code|code= |
||
Line 38: | Line 36: | ||
print "Not ActiveView " |
print "Not ActiveView " |
||
}} |
}} |
||
tip in the console ex : |
tip in the console ex : |
||
{{Code|code= |
{{Code|code= |
||
RotateView(0,1,0,45) |
RotateView(0,1,0,45) |
||
}} |
}} |
||
⚫ | |||
⚫ | |||
{{clear}} |
{{clear}} |
||
<languages/> |
<languages/> |
Revision as of 16:26, 21 January 2015
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 |
Questa macro ruota la vista corrente di 90° a sinistra. Funziona solo se si è in vista dall'alto
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
Description
This def paste in the Python console FreeCAD (or your macro) allows you to rotate the view in 3-axis and the angle (in degrees) give interesting to create a plan to a desired position
Use
Paste the code in the Python console FreeCAD and type 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)
If there is no open document an error is returned