Modifica: Posizionamento

From FreeCAD Documentation
Revision as of 15:58, 25 February 2021 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Posizionamento

Posizione nel menu
Modifica → Posizionamento...
Ambiente
Tutti
Avvio veloce
Nessuno
Introdotto nella versione
-
Vedere anche
Allinea, Azioni di posizionamento, Posizionamento

Descrizione

Il comando Posizionamento visualizza la scheda azioni per il posizionamento di un oggetto selezionato.

La scheda di Posizionamento

Utilizzo

  1. Selezionare un singolo oggetto. L'oggetto deve avere una proprietà DatiPlacement.
  2. Selezionare l'opzione Modifica → Posizionamento... dal menu.
  3. Modificare uno o più parametri di traslazione e rotazione.
  4. Effettuare una delle seguenti operazioni:
    • Premere il pulsante OK per applicare le modifiche e chiudere il pannello delle azioni.
    • Premere il pulsante Applica per applicare le modifiche, ma tenere aperto il pannello delle azioni per ulteriori modifiche.

The dialog can also be launched by clicking on the ellipsis button ... that appears in the property editor when you click on the DatiPlacement property.

Note

Script

Vedere anche: Script di base per FreeCAD

Vedere il tutorial di script Python.

A placement is internally defined by a matrix; in many cases it is simpler to represent it by means of two components, a Base point (vector), and a Rotation value. The Rotation itself has different representations; it can be entirely defined by the value of a "quaternion" (xi + yj + zk + w), but it can also be described by a rotation Axis (unit vector) and a rotation Angle (radians).

import FreeCAD as App

doc = App.newDocument()
obj = doc.addObject("Part::Cylinder", "Cylinder")

print(obj.Placement)
# Placement [Pos=(0,0,0), Yaw-Pitch-Roll=(0,0,0)]
print(obj.Placement.Base)
# Vector (0.0, 0.0, 0.0)
print(obj.Placement.Rotation)
# Rotation (0.0, 0.0, 0.0, 1.0)

print(obj.Placement.Rotation.Angle)
# 0.0
print(obj.Placement.Rotation.Axis)
# Vector (0.0, 0.0, 1.0)
print(obj.Placement.Rotation.Q)
# (0.0, 0.0, 0.0, 1.0)

Move the base point of the object, then rotate the object 45 degrees around the X axis.

import math

obj.Placement.Base = App.Vector(5, 3, 1)
obj.Placement.Rotation.Axis = App.Vector(1, 0, 0)
obj.Placement.Rotation.Angle = math.radians(45)

print(obj.Placement)
# Placement [Pos=(5,3,1), Yaw-Pitch-Roll=(0,0,45)]
print(obj.Placement.Rotation.Q)
# (0.3826834323650898, 0.0, 0.0, 0.9238795325112867)
print(obj.Placement.Matrix)
# Matrix ((1,0,0,5),(0,0.707107,-0.707107,3),(0,0.707107,0.707107,1),(0,0,0,1))