Macro Align Object to View/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
mNo edit summary
Line 1: Line 1:
{{Macro/fr|Icon=Text-x-python|Name=Macro Align Object to View|Name/fr=Macro Align Object to View|Description=This macro aligns the selected object to the current View.|See= tyt |Author=Mario52}}
{{Macro/fr|Icon=Text-x-python|Name=Macro Align Object to View|Name/fr=Macro Align Object to View|Description=Cette macro aligne l'objet sélectonné sur la vue 3D.|See= tyt |Author=Mario52}}


==Description==
==Description==

Revision as of 18:46, 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

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

Credits

Tanks Simplified code to rentlau_64

Other languages: