Placement API: Difference between revisions

From FreeCAD Documentation
(translate)
(Marked this version for translation)
Line 1: Line 1:
<translate>
<translate>
<!--T:1-->
In FreeCAD, Placement defines an object's position and rotation. The Placement concept is explained in detail here: [[Placement|Placement]].
In FreeCAD, Placement defines an object's position and rotation. The Placement concept is explained in detail here: [[Placement|Placement]].


<!--T:2-->
Example of setting a document object's Placement:
Example of setting a document object's Placement:
</translate>
</translate>
Line 11: Line 13:
<translate>
<translate>


<!--T:3-->
{{APIClass|Placement| ) or (Placement) or (Matrix) or (Base, Rotation) or (Base,Rotation,Center) or (Base,Axis,Angle|Constructs a placement, empty or with the given arguments, or as a copy of the given placement.}}
{{APIClass|Placement| ) or (Placement) or (Matrix) or (Base, Rotation) or (Base,Rotation,Center) or (Base,Axis,Angle|Constructs a placement, empty or with the given arguments, or as a copy of the given placement.}}
{{APIProperty|Base|a vector representing the Placement's position.}}
{{APIProperty|Base|a vector representing the Placement's position.}}
Line 20: Line 23:
{{APIFunction|toMatrix| | |a matrix representing the Placement's transformation.}}
{{APIFunction|toMatrix| | |a matrix representing the Placement's transformation.}}


<!--T:4-->
[[Category:API]]
[[Category:API]]



Revision as of 22:51, 15 November 2014

In FreeCAD, Placement defines an object's position and rotation. The Placement concept is explained in detail here: Placement.

Example of setting a document object's Placement:

myObj = FreeCAD.ActiveDocument.ActiveObject
pl = FreeCAD.Placement()
pl.move(FreeCAD.Vector(2,0,0))
myObj.Placement = pl


Placement( ) or (Placement) or (Matrix) or (Base, Rotation) or (Base,Rotation,Center) or (Base,Axis,Angle)

Description: Constructs a placement, empty or with the given arguments, or as a copy of the given placement.

Base

Returns: a vector representing the Placement's position.

Rotation

Returns: a quaternion representing the Placement's rotation.

inverse( )

Description: computes the inverse placement

Returns: a placement.

move(Vector)

Description: moves the Placement along the given vector

Returns: nothing

multVec(Vector)

Description: applies the Placement to the given vector

Returns: the resulting vector.

multiply(Placement)

Description: multiplies this placement with another one

Returns: the resulting placement.

toMatrix( )

Description:

Returns: a matrix representing the Placement's transformation.