Macro Rotate ViewAxonometric: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 12: Line 12:
|Download= [https://www.freecadweb.org/wiki/images/2/2e/Macro_Rotate_View_with_Y_pointing_upwards_.png ToolBar Icon]
|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 36: 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>


{{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>
* 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'''



Revision as of 11:04, 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")