Macro Align Object to View/fr: Difference between revisions
Renatorivo (talk | contribs) (Created page with "==Exemple==") |
(Updating to match new version of source page) |
||
Line 50: | Line 50: | ||
==Credits== |
==Credits== |
||
Tanks Simplified code to |
Tanks Simplified code to rentlau_64 |
||
{{clear}} |
{{clear}} |
Revision as of 11:39, 22 February 2016
File:Text-x-python Macro Align Object to View |
Description |
---|
This macro aligns the selected object to the current View. Auteur: Mario52 |
Auteur |
Mario52 |
Téléchargement |
None |
Liens |
Page des macros Comment installer une macro Comment créer une barre d'outils |
Version Macro |
1.0 |
Dernière modification |
None |
Version(s) FreeCAD |
None |
Raccourci clavier |
None |
Voir aussi |
None |
Description
This macro aligns and Position the selected object to the current View.
How to use
- Direct your view, select your object and run the macro
- Your object will be the placement of the camera coordinates
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
-
Your object in its original position XY.
-
Rotate the screen X? Y? Z? or use this macro Macro_Rotate_View for precise rotation.
-
Select the object and run the macro (the object face the screen).
-
Your object return in the XY display and in its new coordinates position (Placement,Angle)
Credits
Tanks Simplified code to rentlau_64