Macro Rotate ViewAxonometric: Difference between revisions

From FreeCAD Documentation
(create page)
 
(Marked this version for translation)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:1-->
{{Macro
{{Macro
|Name=Rotate View by 90°
|Name=Macro Rotate ViewAxonometric
|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png
|Description=This macro rotates the current view in ViewAxonometric.
|Description=This macro rotates the current view in ViewAxonometric.
|Author=Yorik
|Author=Yorik
|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]]
|SeeAlso=[[Macro_Rotate_View|Macro_Rotate_View]]
}}
}}


==Description==
==Description== <!--T:2-->


<!--T:3-->
This macro rotates the current view in ViewAxonometric.
This macro rotates the current view in ViewAxonometric (as is: Y).


<!--T:4-->
You have two options:
You have two options:


<!--T:5-->
* mode 1 : axonometric view with Y pointing upwards [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]] mode 1
* mode 1 : axonometric view with Y pointing upwards [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]] mode 1
* mode 2 : axonometric view with Z pointing upwards [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]] mode 2 (uncomment for use)
* mode 2 : axonometric view with Z pointing upwards [[File:Macro_Rotate_View_with_Z_pointing_upwards_.png|axonometric view with Z pointing upwards]] mode 2 (uncomment for use)


==Usage== <!--T:6-->
==Use==


<!--T:7-->
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 [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]]
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 [[File:Macro_Rotate_View_with_Y_pointing_upwards_.png|axonometric view with Y pointing upwards]]


<!--T:8-->
Copy the second macro and name it "'''Macro_Rotate_ViewAxonometric_Z'''" (mode 2) and:
Copy the second macro and name it "'''Macro_Rotate_ViewAxonometric_Z'''" (mode 2) and:


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


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


<!--T:13-->
* 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)

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