Std Placement: Difference between revisions
(Replaced the task panel image.) |
(Marked this version for translation) |
||
(16 intermediate revisions by 6 users not shown) | |||
Line 4: | Line 4: | ||
<!--T:9--> |
<!--T:9--> |
||
{{Docnav |
{{Docnav |
||
|[[Std_SendToPythonConsole| |
|[[Std_SendToPythonConsole|SendToPythonConsole]] |
||
|[[Std_TransformManip|TransformManip]] |
|||
|[[Std_Alignment|Std Alignment]] |
|||
|[[Std_Edit_Menu|Std Edit Menu]] |
|[[Std_Edit_Menu|Std Edit Menu]] |
||
|IconL=Std_SendToPythonConsole.svg |
|IconL=Std_SendToPythonConsole.svg |
||
|IconR= |
|IconR=Std_TransformManip.svg |
||
|IconC=Freecad.svg |
|IconC=Freecad.svg |
||
}} |
}} |
||
Line 17: | Line 17: | ||
|MenuLocation=Edit → Placement... |
|MenuLocation=Edit → Placement... |
||
|Workbenches=All |
|Workbenches=All |
||
|SeeAlso=[[Std_Alignment|Std Alignment |
|SeeAlso=[[Std_Alignment|Std Alignment]], [[Placement|Placement]] |
||
}} |
}} |
||
Line 34: | Line 34: | ||
<!--T:14--> |
<!--T:14--> |
||
# Select a single object |
# 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. |
# Select the {{MenuCommand|Edit → Placement...}} option from the menu. |
||
# Change one or more of the translation and rotation parameters. |
# Change one or more of the translation and rotation parameters. |
||
Line 40: | Line 40: | ||
#* Press the {{Button|OK}} button to apply the changes and close the task panel. |
#* 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 the {{Button|Apply}} button to apply the changes, but keep the task panel open for further changes. |
||
⚫ | |||
<!--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--> |
==Notes== <!--T:17--> |
||
<!--T:18--> |
<!--T:18--> |
||
⚫ | |||
* The Placement task panel is also displayed when you select an object, click in the {{PropertyData|Placement}} field in the [[Property_editor|Property editor]] or the [[Combo_view|Combo view]], and then press the {{Button|...}} button that appears. |
|||
* The rotation angle can be set in degrees in the GUI but is stored in radians internally so that angles usually have to be converted when used in scripts. |
|||
⚫ | |||
==Scripting== <!--T:11--> |
==Scripting== <!--T:11--> |
||
Line 58: | Line 57: | ||
<!--T:20--> |
<!--T:20--> |
||
See the [[Python_scripting_tutorial# |
See the [[Python_scripting_tutorial#Vectors_and_placements|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 {{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. |
|||
<!--T:24--> |
|||
The math module supplies a method {{incode|radians()}} to easily convert degrees to radians and has to be imported at first. |
|||
</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_SendToPythonConsole| |
|[[Std_SendToPythonConsole|SendToPythonConsole]] |
||
|[[Std_TransformManip|TransformManip]] |
|||
|[[Std_Alignment|Std Alignment]] |
|||
|[[Std_Edit_Menu|Std Edit Menu]] |
|[[Std_Edit_Menu|Std Edit Menu]] |
||
|IconL=Std_SendToPythonConsole.svg |
|IconL=Std_SendToPythonConsole.svg |
||
|IconR= |
|IconR=Std_TransformManip.svg |
||
|IconC=Freecad.svg |
|IconC=Freecad.svg |
||
}} |
}} |
||
Line 73: | Line 122: | ||
{{Std Base navi{{#translation:}}}} |
{{Std Base navi{{#translation:}}}} |
||
{{Userdocnavi{{#translation:}}}} |
{{Userdocnavi{{#translation:}}}} |
||
{{clear}} |
Latest revision as of 10:01, 20 September 2023
Std Placement |
Menu location |
---|
Edit → Placement... |
Workbenches |
All |
Default shortcut |
None |
Introduced in version |
- |
See also |
Std Alignment, Placement |
Description
The Std Placement command displays the Placement task panel for a selected object.
The Placement task panel
Usage
- Select a single object that has a DataPlacement property in the property editor.
- Select the Edit → Placement... option from the menu.
- Change one or more of the translation and rotation parameters.
- 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.
- 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
- For more information about the placement parameters see the Placement page, and the Aeroplane tutorial.
- The rotation angle can be set in degrees in the GUI but is stored in radians internally so that angles usually have to be converted when used in scripts.
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.
The math module supplies a method radians()
to easily convert degrees to radians and has to be imported at first.
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))
- File: New, Open, Close, Close All, Save, Save As, Save a Copy, Save All, Revert, Import, Export,Merge project, Project information, Print, Print preview, Export PDF, Recent files, Exit
- Edit: Undo, Redo, Cut, Copy, Paste, Duplicate selection, Refresh, Box selection, Box element selection, Select All, Delete, Send to Python Console, Placement, Transform, Alignment, Toggle Edit mode, Edit mode, Preferences
- View:
- Miscellaneous: Create new view, Orthographic view, Perspective view, Fullscreen, Bounding box, Toggle axis cross, Clipping plane, Texture mapping, Toggle navigation/Edit mode, Appearance, Random color, Workbench, Status bar
- Standard views: Fit all, Fit selection, Isometric, Dimetric, Trimetric, Home, Front, Top, Right, Rear, Bottom, Left, Rotate Left, Rotate Right
- Freeze display: Save views, Load views, Freeze view, Clear views
- Draw style: As is, Points, Wireframe, Hidden line, No shading, Shaded, Flat lines
- Stereo: Stereo red/cyan, Stereo quad buffer, Stereo Interleaved Rows, Stereo Interleaved Columns, Stereo Off, Issue camera position
- Zoom: Zoom In, Zoom Out, Box zoom
- Document window: Docked, Undocked, Fullscreen
- Visibility: Toggle visibility, Show selection, Hide selection, Select visible objects, Toggle all objects, Show all objects, Hide all objects, Toggle selectability, Toggle measurement, Clear measurement
- Toolbars: File, Edit, Clipboard, Workbench, Macro, View, Structure, Help
- Panels: Tree view, Property view, Selection view, Tasks, Python console, DAG view, Model, Report view
- Link navigation: Go to linked object, Go to the deepest linked object, Select all links
- Tree view actions: Sync view, Sync selection, Sync placement, Pre-selection, Record selection, Single document, Multi document, Collapse/Expand, Initiate dragging, Go to selection, Selection Back, Selection Forward
- Tools: Edit parameters, Save image, Load image, Scene inspector, Dependency graph, Project utility, Measure distance, Add text document, View turntable, Units calculator, Customize, Addon manager
- Macro: Macro recording, Macros, Recent macros, Execute macro, Attach to remote debugger, Debug macro, Stop debugging, Step over, Step into, Toggle breakpoint
- Help: Help, FreeCAD Website, Donate, Users documentation, Python scripting documentation, Automatic Python modules documentation, FreeCAD Forum, FreeCAD FAQ, Report a bug, About FreeCAD, What's This
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub