Difference between revisions of "Std Placement"

From FreeCAD Documentation
Jump to navigation Jump to search
(Marked this version for translation)
(Marked this version for translation)
 
(26 intermediate revisions by 5 users not shown)
Line 4: Line 4:
 
<!--T:9-->
 
<!--T:9-->
 
{{Docnav
 
{{Docnav
|[[Std_Delete|Std Delete]]
+
|[[Std_SendToPythonConsole|Std SendToPythonConsole]]
 
|[[Std_Alignment|Std Alignment]]
 
|[[Std_Alignment|Std Alignment]]
 
|[[Std_Edit_Menu|Std Edit Menu]]
 
|[[Std_Edit_Menu|Std Edit Menu]]
|IconL=Std_Delete.svg
+
|IconL=Std_SendToPythonConsole.svg
 +
|IconR=
 
|IconC=Freecad.svg
 
|IconC=Freecad.svg
|IconR=
 
 
}}
 
}}
  
Line 15: Line 15:
 
{{GuiCommand
 
{{GuiCommand
 
|Name=Std Placement
 
|Name=Std Placement
|MenuLocation=[[Std Edit Menu|Edit]] → Placement...
+
|MenuLocation=Edit → Placement...
 
|Workbenches=All
 
|Workbenches=All
|Shortcut=
+
|SeeAlso=[[Std_Alignment|Std Alignment]], [[Tasks_Placement|Tasks Placement]], [[Placement|Placement]]
|SeeAlso=[[Tasks Placement|Tasks Placement]], [[Placement|Placement]]
 
 
}}
 
}}
  
Line 24: Line 23:
  
 
<!--T:4-->
 
<!--T:4-->
'''Placement''' is how FreeCAD specifies the location and attitude (orientation) of an object in space. Placement can be specified in multiple forms and manipulated via [[Python_scripting_tutorial#Vectors_and_Placements|scripting]], the Properties panel or the {{MenuCommand|Edit → Placement...}} dialog.
+
The '''Std Placement''' command displays the Placement [[Task_panel|task panel]] for a selected object.
 +
 
 +
</translate>
 +
[[Image:Std_Placement_taskpanel.png]]
 +
<translate>
 +
<!--T:13-->
 +
{{Caption|The Placement task panel}}
 +
 
 +
==Usage== <!--T:5-->
 +
 
 +
<!--T:14-->
 +
# Select a single object that has a {{PropertyData|Placement}} property in the [[Property_editor|property editor]].
 +
# Select the {{MenuCommand|Edit → Placement...}} option from the menu.
 +
# Change one or more of the translation and rotation parameters.
 +
# Do one of the following:
 +
#* Press the {{Button|OK}} button to apply the changes and close the task panel.
 +
#* Press the {{Button|Apply}} button to apply the changes, but keep the task panel open for further changes.
 +
# Press {{KEY|Esc}} or the {{Button|Cancel}} button to abort the operation. This will undo any changes that have not been applied.
 +
 
 +
<!--T:21-->
 +
The dialog can also be launched by clicking on the ellipsis button {{Button|...}} that appears in the [[Property_editor|property editor]] when you click on the {{PropertyData|Placement}} property.
 +
 
 +
==Notes== <!--T:17-->
 +
 
 +
<!--T:18-->
 +
* For more information about the placement parameters see the [[Tasks_Placement|Tasks Placement]] and [[Placement|Placement]] pages, and the [[Aeroplane|Aeroplane]] tutorial.
 +
 
 +
==Scripting== <!--T:11-->
  
==Use== <!--T:5-->
+
<!--T:19-->
* Short description
+
{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].
** Select an object in the tree view.
 
** In the '''Edit''' menu, select {{KEY|Placements...}}
 
** Change the parameters for the translation or rotation, according to the desired action.
 
** Click {{KEY|OK}} or {{KEY|Apply}}
 
* For a full description see [[Tasks Placement|Tasks Placement]] and [[Placement|Placement]]
 
  
==Links and Example== <!--T:6-->  
+
<!--T:20-->
 +
See the [[Python_scripting_tutorial#Vectors_and_placements|Python scripting tutorial]].
  
<!--T:7-->
+
<!--T:22-->
A practical example of using this command is in the tutorial [[Aeroplane| Aeroplane]].
+
A placement is internally defined by a matrix; in many cases it is simpler to represent it by means of two components, a {{incode|Base}} point (vector), and a {{incode|Rotation}} value. The {{incode|Rotation}} itself has different representations; it can be entirely defined by the value of a "[https://en.wikipedia.org/wiki/Quaternion quaternion]" {{incode|(xi + yj + zk + w)}}, but it can also be described by a rotation {{incode|Axis}} (unit vector) and a rotation {{incode|Angle}} (radians).
 +
 
 +
</translate>
 +
{{Code|code=
 +
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)
 +
}}
 +
<translate>
 +
 
 +
<!--T:23-->
 +
Move the base point of the object, then rotate the object 45 degrees around the X axis.
 +
</translate>
 +
{{Code|code=
 +
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))
 +
}}
 +
<translate>
  
 
<!--T:10-->
 
<!--T:10-->
 
{{Docnav
 
{{Docnav
|[[Std_Delete|Std Delete]]
+
|[[Std_SendToPythonConsole|Std SendToPythonConsole]]
 
|[[Std_Alignment|Std Alignment]]
 
|[[Std_Alignment|Std Alignment]]
 
|[[Std_Edit_Menu|Std Edit Menu]]
 
|[[Std_Edit_Menu|Std Edit Menu]]
|IconL=Std_Delete.svg
+
|IconL=Std_SendToPythonConsole.svg
 +
|IconR=
 
|IconC=Freecad.svg
 
|IconC=Freecad.svg
|IconR=
 
 
}}
 
}}
  
<!--T:8-->
 
{{Std Base}}
 
{{Userdocnavi}}
 
 
</translate>
 
</translate>
 +
{{Std Base navi{{#translation:}}}}
 +
{{Userdocnavi{{#translation:}}}}
 
{{clear}}
 
{{clear}}

Latest revision as of 17:48, 15 September 2020

Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎română • ‎русский

Std Placement.svg Std Placement

Menu location
Edit → Placement...
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
Std Alignment, Tasks Placement, Placement


Description

The Std Placement command displays the Placement task panel for a selected object.

Std Placement taskpanel.png

The Placement task panel


Usage

  1. Select a single object that has a DataPlacement property in the property editor.
  2. Select the Edit → Placement... option from the menu.
  3. Change one or more of the translation and rotation parameters.
  4. Do one of the following:
    • Press the OK button to apply the changes and close the task panel.
    • Press the Apply button to apply the changes, but keep the task panel open for further changes.
  5. Press Esc or the Cancel button to abort the operation. This will undo any changes that have not been applied.

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

Notes

Scripting

See also: FreeCAD Scripting Basics.

See the Python scripting tutorial.

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))