Macro Rotate View Free: Difference between revisions
m (Text_console_python.png) |
(Use {{MacroCode}}) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 10: | Line 10: | ||
|Date=2010-11-17 |
|Date=2010-11-17 |
||
|FCVersion=All |
|FCVersion=All |
||
|SeeAlso=[[Macro Rotate View|Macro Rotate View]]<br />[[Macro_Rotate_ViewAxonometric|Macro_Rotate_ViewAxonometric]] |
|SeeAlso=[[Macro Rotate View|Macro Rotate View]] [[File:Macro Rotate View view 90 Degrees.png|24px]]<br />[[Macro_Rotate_ViewAxonometric|Macro_Rotate_ViewAxonometric]] [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|24px]] [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|24px]] |
||
}} |
}} |
||
Line 18: | Line 18: | ||
This def pasted 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 |
This def pasted 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 |
||
== |
==Usage== <!--T:4--> |
||
<!--T:5--> |
<!--T:5--> |
||
Line 28: | Line 28: | ||
'''Macro_Rotate_View_Free.FCMacro''' |
'''Macro_Rotate_View_Free.FCMacro''' |
||
{{ |
{{MacroCode|code= |
||
#Paste in the Python console and tip ex: |
#Paste in the Python console and tip ex: |
||
#RotateView(0,1,0,45) |
#RotateView(0,1,0,45) |
||
Line 52: | Line 52: | ||
</translate> |
</translate> |
||
{{ |
{{MacroCode|code= |
||
RotateView(0,1,0,45) |
RotateView(0,1,0,45) |
||
}} |
}} |
Latest revision as of 22:40, 7 May 2020
Description |
---|
This def pasted 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 Macro version: 01.00 Last modified: 2010-11-17 FreeCAD version: All Author: Yorik |
Author |
Yorik |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
01.00 |
Date last modified |
2010-11-17 |
FreeCAD Version(s) |
All |
Default shortcut |
None |
See also |
Macro Rotate View Macro_Rotate_ViewAxonometric |
Description
This def pasted 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
Usage
Paste the code in the Python console FreeCAD and type Enter → Enter (for validate) and tip ex: RotateView(0,1,0,45)
Script
Macro_Rotate_View_Free.FCMacro
#Paste in the Python console and tip ex: #RotateView(0,1,0,45) 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 not open document an error is returned