Macro Align Object to View/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "<center> <gallery widths="300" heights="200" perrow="2"> Image:Macro Align Object to View 01.png|Votre objet dans sa position originale XY. Image:Macro Align Object to View 02...")
(Created page with "<center> <gallery widths="300" heights="200" perrow="2"> Image:Macro Align Object to View 03.png|Sélectionnez l'objet et lancez la macro (l'objet fait face à l'écran). Imag...")
Line 44: Line 44:
<center>
<center>
<gallery widths="300" heights="200" perrow="2">
<gallery widths="300" heights="200" perrow="2">
Image:Macro Align Object to View 03.png|Select the object and run the macro (the object face the screen).
Image:Macro Align Object to View 03.png|Sélectionnez l'objet et lancez la macro (l'objet fait face à l'écran).
Image:Macro Align Object to View 04.png|Your object return in the XY display and in its new coordinates position (Placement,Angle)
Image:Macro Align Object to View 04.png|Votre objet prends les positions XY et position (Placement, Angle)
</gallery>
</gallery>
</center>
</center>

Revision as of 18:55, 5 September 2016

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

Description
Cette macro aligne l'objet sélectonné sur la vue 3D.

Auteur: Mario52
Auteur
Mario52
Téléchargement
None
Liens
Version Macro
1.0
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
None

Description

Cette macro aligne l'objet sélectionné sur la vue 3D.

Comment l'utiliser

  • Dirigez votre vue, sélectionnez votre objet et lancez la macro
  • Votre objet est dirigé sur la position de la caméra

Script

Macro Align Object to View.FCMacro

# This macro place your object selected to the position ActiveView (camera)
# extact
# 16/01/2015

__title__="FCCamera"
__author__ = "Mario52"

import pivy
from pivy import coin

sel = FreeCADGui.Selection.getSelection()
Nameelement = sel[0].Name
App.Console.PrintMessage(str(Nameelement)+"\n")

pl = FreeCAD.Placement()
pl.Rotation = FreeCADGui.ActiveDocument.ActiveView.getCameraOrientation()
pl.Base = FreeCAD.Vector(0.0,0.0,0.0)

App.ActiveDocument.getObject(Nameelement).Placement=pl

Exemple

Credits

Tanks Simplified code to rentlau_64

Other languages: