Macro Rotate View/cs: Difference between revisions

From FreeCAD Documentation
(Created page with "==Beschreibung== Dieser Code für: # axonometrische Ansicht mit Y nach oben axonometric view with Y pointing upwards Mo...")
(Updating to match new version of source page)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
{{Macro/cs
{{Macro/cs
|Name=Rotate View by 90°
|Name=Rotate View by 90°
|Icon=Macro Rotate View view 90 Degrees.png
|Translate=Rotate View by 90°
|Translate=Rotate View by 90°
|Description=Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora
|Description=Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora
Line 7: Line 9:
|Version=01.00
|Version=01.00
|Date=2010-11-17
|Date=2010-11-17
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/images/a/a0/Macro_Rotate_View_view_90_Degrees.png Macro_Rotate_View_view_90_Degrees]
|SeeAlso=[[Macro_Rotate_ViewAxonometric/cs|Macro_Rotate_ViewAxonometric]] [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|24px]] [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|24px]]<br />[[Macro Rotate View Free/cs|Macro Rotate View Free]]
}}
}}
</div>


==Description==
==Description==

<div class="mw-translate-fuzzy">
Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora
Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora
[[File:Macro_Rotate_View_view_90_Degrees.png|rotation 90 degrees]]
[[File:Macro_Rotate_View_view_90_Degrees.png|rotation 90 degrees]]
</div>


==Limitations==


Only works if you are in Top view: [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]]
{{Code|code=

==Script==

ToolBar Icon [[Image:Macro Rotate View view 90 Degrees.png]]

'''Macro_Rotate_View_90_Degrees.FCMacro'''

{{MacroCode|code=
import math
import math
from pivy import coin
from pivy import coin
Line 23: Line 41:
cam.orientation = nrot
cam.orientation = nrot
}}
}}
==Beschreibung==
Dieser Code für:
# axonometrische Ansicht mit Y nach oben [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]] Modus 1
# axonometrische Ansicht mit Z nach oben [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]] Modus 2
Für FreeCAD Version 0.16


{{Code|code=
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")
}}

==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 {{KEY|Enter}} → {{KEY|Enter}}

==Script==
{{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)
}}
If there is no open document an error is returned
{{clear}}
{{clear}}

Latest revision as of 21:48, 4 August 2023

Rotate View by 90°

Popis
Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora

Version macro : 01.00
Date last modification : 2010-11-17
FreeCAD version : All
Download : Macro_Rotate_View_view_90_Degrees
Autor: Yorik
Autor
Yorik
Download
Macro_Rotate_View_view_90_Degrees
Odkazy
Verze
01.00
Datum poslední úpravy
2010-11-17
Verze FreeCAD
All
Výchozí zástupce
None
Viz též
Macro_Rotate_ViewAxonometric
Macro Rotate View Free

Description

Toto makro otočí objekt o 90° doleva. Funguje jen pokud jste v pohledu shora rotation 90 degrees

Limitations

Only works if you are in Top view: Std_ViewTop XY (top)

Script

ToolBar Icon

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