Macro Align Face Object to View

From FreeCAD Documentation
Revision as of 08:58, 6 September 2016 by Mario52 (talk | contribs) (Created page with "==Description== Cette macro dirige la face de l'objet face à la vue active (caméra). Dans le cas d'une face d'un forage le forage fait face à l'écran.")

File:Text-x-python Macro Align Face Object to View

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

Version macro : 0.1 (16/01/2015)
Auteur: Mario52
Auteur
Mario52
Téléchargement
None
Liens
Version Macro
0.1 (16/01/2015)
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
None

Description

Cette macro dirige la face de l'objet face à la vue active (caméra). Dans le cas d'une face d'un forage le forage fait face à l'écran.

How to use

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

Script

Macro_Align_Face_Object_to_View.FCMacro

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

__title__="FCCamera"
__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

Other languages: