Macro Align Object to View/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "==Exemple==")
(Updating to match new version of source page)
Line 50: Line 50:


==Credits==
==Credits==
Tanks Simplified code to [[rentlau_64]]
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
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: