Macro Align Face Object to View/it: Difference between revisions

From FreeCAD Documentation
(Created page with "Macro Align Face Object to View")
 
(Updating to match new version of source page)
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
{{Macro|Icon=Text-x-python|Name=Macro Align Face Object to View|Description=This macro directs the face of the object on the side of the ActiveView.|Author=Mario52}}

{{Macro/it
|Name=Macro Align Face Object to View
|Icon=Macro_Align_Face_Object_to_View.png
|Translate=Allinea la faccia dell'oggetto alla vista
|Description=Questa macro dirige la faccia dell'oggetto verso la vista attiva.
|Author=Mario52
|Version=0.1
|Date=2015-01-16
|Download=[https://www.freecadweb.org/wiki/images/d/d5/Macro_Align_Face_Object_to_View.png ToolBar Icon]
|FCVersion=Tutte
|SeeAlso=[[File:FCCamera 00.png|32px|FCCamera]] [[Macro_FCCamera/it|Macro_FCCamera]]}}


==Description==
==Description==
This macro directs the face of the object on the side of the ActiveView (camera).
In the case of the face of a borehole (or internal or cylinder) face drilling facing the screen


<div class="mw-translate-fuzzy">
==How to use==
==Descrizione==
* Select your object and run the macro
Questa macro orienta la faccia dell'oggetto verso la ActiveView (telecamera).
* Your object will be of the camera
Nel caso della faccia di un foro (o di una faccia interna o di un cilindro) orienta la faccia della foratura verso lo schermo.
</div>

==Usage==

<div class="mw-translate-fuzzy">
==Utilizzo==
* Selezionare l'oggetto ed eseguire la macro
* L'oggetto viene orientato verso la telecamera
</div>


==Script==
==Script==

ToolBar Icon
[[Image:Macro_Align_Face_Object_to_View.png]]

'''Macro_Align_Face_Object_to_View.FCMacro'''
'''Macro_Align_Face_Object_to_View.FCMacro'''


{{Code|code=
{{MacroCode|code=
# This macro directs the face of the object on the side of the ActiveView (camera)
# This macro directs the face of the object on the side of the ActiveView (camera)
# extact
# extact FCCamera
# 16/01/2015
# 16/01/2015


__title__="FCCamera"
__title__="Macro_Align_Face_Object_to_View"
__author__ = "Mario52"
__author__ = "Mario52"


Line 24: Line 48:


try:
try:
v=Gui.Selection.getSelectionEx()[0].SubObjects[0].Surface.Axis
v=Gui.Selection.getSelectionEx()[0].SubObjects[0].Surface.Axis # to Axis
dir = Gui.Selection.getSelectionEx()[0].SubObjects[0].normalAt(0,0)
# v = Gui.Selection.getSelectionEx()[0].SubObjects[0].normalAt(0,0) # normalAt
r=App.Rotation(App.Vector(0,0,1),v)
r=App.Rotation(App.Vector(0,0,1),v)
Gui.ActiveDocument.ActiveView.setCameraOrientation(r.Q)
Gui.ActiveDocument.ActiveView.setCameraOrientation(r.Q)
Line 33: Line 57:
}}
}}


==Links==


Original macro by wmayer [http://forum.freecadweb.org/viewtopic.php?f=3&t=7029&p=56735&hilit=Shape.Face4#p56735 Looking for some helpful GUI-commands]


{{clear}}
{{clear}}
<languages/>

Revision as of 10:08, 21 December 2021

Other languages:

Allinea la faccia dell'oggetto alla vista

Descrizione
Questa macro dirige la faccia dell'oggetto verso la vista attiva.

Versione macro: 0.1
Ultima modifica: 2015-01-16
Versione FreeCAD: Tutte
Download: ToolBar Icon
Autore: Mario52
Autore
Mario52
Download
ToolBar Icon
Link
Versione macro
0.1
Data ultima modifica
2015-01-16
Versioni di FreeCAD
Tutte
Scorciatoia
Nessuna
Vedere anche
FCCamera Macro_FCCamera

Description

Descrizione

Questa macro orienta la faccia dell'oggetto verso la ActiveView (telecamera). Nel caso della faccia di un foro (o di una faccia interna o di un cilindro) orienta la faccia della foratura verso lo schermo.

Usage

Utilizzo

  • Selezionare l'oggetto ed eseguire la macro
  • L'oggetto viene orientato verso la telecamera

Script

ToolBar Icon

Macro_Align_Face_Object_to_View.FCMacro

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

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