Macro Align Face Object to View: Difference between revisions

From FreeCAD Documentation
m (DATE ISO 8601 YYYY-MM-DD)
(Use {{MacroCode}})
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{Macro
{{Macro|Icon=Text-x-python|Name=Macro Align Face Object to View|Description=This macro directs the face of the object on the side of the ActiveView.|Author=Mario52|Version=0.1|Date=2015-01-16}}
|Name=Macro Align Face Object to View
|Icon=Macro_Align_Face_Object_to_View.png
|Description=This macro directs the face of the object on the side of the ActiveView.
|Author=Mario52
|Version=0.1
|Date=2015-01-16
|Download=[https://www.freecadweb.org/wiki/images/d/d5/Macro_Align_Face_Object_to_View.png ToolBar Icon]
|FCVersion=All
|SeeAlso=[[File:FCCamera 00.png|32px|FCCamera]] [[Macro_FCCamera|Macro_FCCamera]]
}}


==Description== <!--T:2-->
==Description== <!--T:2-->
Line 7: Line 18:
In the case of the face of a borehole (or internal or cylinder) face drilling facing the screen
In the case of the face of a borehole (or internal or cylinder) face drilling facing the screen


==How to use== <!--T:3-->
==Usage== <!--T:3-->
* Select your object and run the macro
* Select your object and run the macro
* Your object will be of the camera
* Your object will be of the camera
Line 13: Line 24:
==Script== <!--T:4-->
==Script== <!--T:4-->
</translate>
</translate>
ToolBar Icon [[Image:Macro_Align_Face_Object_to_View.png]]

'''Macro_Align_Face_Object_to_View.FCMacro'''
'''Macro_Align_Face_Object_to_View.FCMacro'''


{{Code|code=
{{MacroCode|code=
# This macro directs the face of the object on the side of the ActiveView (camera)
# This macro directs the face of the object on the side of the ActiveView (camera)
# extact
# extact FCCamera
# 16/01/2015
# 16/01/2015


__title__="FCCamera"
__title__="Macro_Align_Face_Object_to_View"
__author__ = "Mario52"
__author__ = "Mario52"


Line 41: Line 54:


{{clear}}
{{clear}}
<languages/>

Revision as of 22:56, 7 May 2020

Other languages:

Macro Align Face Object to View

Description
This macro directs the face of the object on the side of the ActiveView.

Macro version: 0.1
Last modified: 2015-01-16
FreeCAD version: All
Download: ToolBar Icon
Author: Mario52
Author
Mario52
Download
ToolBar Icon
Links
Macro Version
0.1
Date last modified
2015-01-16
FreeCAD Version(s)
All
Default shortcut
None
See also
FCCamera Macro_FCCamera

Description

This macro directs the face of the object on the side of the ActiveView (camera). In the case of the face of a borehole (or internal or cylinder) face drilling facing the screen

Usage

  • Select your object and run the macro
  • Your object will be of the camera

Script

ToolBar Icon

Macro_Align_Face_Object_to_View.FCMacro

# This macro directs the face of the object on the side of the ActiveView (camera)
# extact FCCamera
# 16/01/2015

__title__="Macro_Align_Face_Object_to_View"
__author__ = "Mario52"

import pivy
from pivy import coin

try:
    v=Gui.Selection.getSelectionEx()[0].SubObjects[0].Surface.Axis    # to Axis
#    v = Gui.Selection.getSelectionEx()[0].SubObjects[0].normalAt(0,0) # normalAt
    r=App.Rotation(App.Vector(0,0,1),v)
    Gui.ActiveDocument.ActiveView.setCameraOrientation(r.Q)
except Exception:
    App.Console.PrintError("Select a face and run the macro"+"\n")

Links

Original macro by wmayer Looking for some helpful GUI-commands