Macro Rotate View/cs: Difference between revisions

From FreeCAD Documentation
(Created page with "Pokud není otevřený dokument, vrátí se chyba")
(Updating to match new version of source page)
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°
Line 8: Line 9:
|Date=2010-11-17
|Date=2010-11-17
}}
}}
</div>


<div class="mw-translate-fuzzy">
==Description==
==Description==
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>


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]]

==Script==
'''Macro_Rotate_View_90_Degrees.FCMacro'''


{{Code|code=
{{Code|code=
Line 23: Line 31:
cam.orientation = nrot
cam.orientation = nrot
}}
}}
==Popis==
Tento kód pro:
# axonometrický pohled s Y nahoru [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]] Režim 1
# axonometrický pohled se Z vzhůru [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]] Režim 2
Pro verzi FreeCAD verze 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")
}}

==Popis==
Tato def pasta v konzole Pythonu FreeCAD (nebo makro) umožňuje otočit pohled ve třech osách a úhel (ve stupních) je zajímavý pro vytvoření plánu na požadovanou pozici.

==Použijte==
Vložte kód do konzoly Python FreeCAD a zadejte {{KEY|Enter}} → {{KEY|Enter}}

==Skript==
{{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 "
}}
napsat do konzoly ex:
{{Code|code=
RotateView(0,1,0,45)
}}
Pokud není otevřený dokument, vrátí se chyba
{{clear}}
{{clear}}

Revision as of 10:32, 7 June 2019

Generická ikona makra. Vytvořte svou vlastní ikonu se stejným názvem makra 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
Autor: Yorik
Autor
Yorik
Download
None
Odkazy
Verze
01.00
Datum poslední úpravy
2010-11-17
Verze FreeCAD
None
Výchozí zástupce
None
Viz též
None

Description

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

This macro rotates the current view by 90° to the left. Only works if you are in Top view rotation 90 degrees

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