Macro Rotate ViewAxonometric: Difference between revisions

From FreeCAD Documentation
m (Change section name to 'Usage')
(Marked this version for translation)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:1-->
<!--T:1-->
{{Macro
{{Macro
Line 9: Line 10:
|Version=01.00
|Version=01.00
|FCVersion=All
|FCVersion=All
|Download= [https://www.freecadweb.org/wiki/images/2/2e/Macro_Rotate_View_with_Y_pointing_upwards_.png Macro_Rotate_View_with_Y_pointing_upwards_]<br />[https://www.freecadweb.org/wiki/images/a/a2/Macro_Rotate_View_with_Z_pointing_upwards_.png Macro_Rotate_View_with_Z_pointing_upwards_]
|Download= [https://www.freecadweb.org/wiki/images/2/2e/Macro_Rotate_View_with_Y_pointing_upwards_.png ToolBar Icon]
|Date=2010-11-17
|Date=2010-11-17
|SeeAlso=[[Macro_Rotate_View|Macro_Rotate_View]] [[File:Macro_Rotate_View_view_90_Degrees.png|24px]]
|SeeAlso=[[Macro_Rotate_View|Macro_Rotate_View]]
}}
}}


Line 35: Line 36:


<!--T:9-->
<!--T:9-->
comment the line
comment the line

</translate>
</translate>

{{ColoredText|'''11''' {{Emphasis|#rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards (mode 1)}} }}
{{ColoredText|'''11''' {{Emphasis|#rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards (mode 1)}} }}

<translate>
<translate>

<!--T:10-->
<!--T:10-->
and uncomment the line
and uncomment the line
</translate>


<!--T:12-->
{{ColoredText|'''12''' {{Emphasis|rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) # Z pointing upwards (mode 2 uncomment for use)}} }}and use this icon [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]]
{{ColoredText|'''12''' {{Emphasis|rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) # Z pointing upwards (mode 2 uncomment for use)}} }} and use this icon [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]]


<translate>
==Script== <!--T:11-->
==Script== <!--T:11-->

</translate>
<!--T:13-->
* mode 1 : ToolBar Icon [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png]]
* mode 1 : ToolBar Icon [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png]]
* mode 2 : ToolBar Icon [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png]] (uncomment for use)
* mode 2 : ToolBar Icon [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png]] (uncomment for use)


</translate>
'''Macro_Rotate_ViewAxonometric.FCMacro'''
'''Macro_Rotate_ViewAxonometric.FCMacro'''


{{Code|code=
{{MacroCode|code=
import math
import math
import pivy
import pivy

Latest revision as of 11:08, 30 December 2023

Other languages:

Macro Rotate ViewAxonometric

Description
This macro rotates the current view in ViewAxonometric.

Macro version: 01.00
Last modified: 2010-11-17
FreeCAD version: All
Download: ToolBar Icon
Author: Yorik
Author
Yorik
Download
ToolBar Icon
Links
Macro Version
01.00
Date last modified
2010-11-17
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro_Rotate_View

Description

This macro rotates the current view in ViewAxonometric (as is: Y).

You have two options:

  • mode 1 : axonometric view with Y pointing upwards axonometric view with Y pointing upwards mode 1
  • mode 2 : axonometric view with Z pointing upwards axonometric view with Z pointing upwards mode 2 (uncomment for use)

Usage

For use the two macros, copy the first macro and name it "Macro_Rotate_ViewAxonometric_Y" (mode 1) without change the code and use this icon axonometric view with Y pointing upwards

Copy the second macro and name it "Macro_Rotate_ViewAxonometric_Z" (mode 2) and:

comment the line

11 #rot.setValue(coin.SbVec3f(1,0,0),-math.pi/2) # Y pointing upwards (mode 1)

and uncomment the line

12 rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) # Z pointing upwards (mode 2 uncomment for use) and use this icon axonometric view with Z pointing upwards

Script

  • mode 1 : ToolBar Icon
  • mode 2 : ToolBar Icon (uncomment for use)

Macro_Rotate_ViewAxonometric.FCMacro

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")