Placement/cs: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 22: Line 22:
'''Úhel = r''' je skalární hodnota udávající velikost pootočení objektu kolem osy. Zadává se ve stupních, ale interně je zaznamenán v radiánech.
'''Úhel = r''' je skalární hodnota udávající velikost pootočení objektu kolem osy. Zadává se ve stupních, ale interně je zaznamenán v radiánech.


'''Osa = (ax,ay,az)''' je vektor popisující osu otáčení (Přečtěte si poznámku o ose otáčení). Příklady:
'''Axis = (ax,ay,az)''' is a vector describing an axis of rotation (See Note about axis of rotation). Examples are:
(1,0,0) ==> kolem osy '''X'''
(1,0,0) ==> about '''X''' axis
(0,1,0) ==> kolem osy '''Y'''
(0,1,0) ==> about '''Y''' axis
(0,0,1) ==> kolem osy '''Z'''
(0,0,1) ==> about '''Z''' axis
(0.71,0.71,0) ==> kolem přímky '''y=x'''
(0.71,0.71,0) ==> about the line '''y=x'''
'''Position = (x,y,z)''' is a Vector describing the point from which the object's geometry will be calculated (in effect, a "local origin" for the object). Note that in scripts, Placement.Base is used to denote the Position component of a placement. The Property Editor calls this value "Position" and the Placement dialog calls it "Translation".
'''Pozice = (x,y,z)''' je vektor popisující souřadnice referenčního bodu objektu. Všimněte si, že ve skriptu Placement.Base je použit pro vyznačení komponenty pozice umístění.
Editor vlastností zobrazuje tuto hodnotu jako "Pozice".
===Pozice a Yaw, Pitch a Roll===
===Position and Yaw, Pitch and Roll===
'''Umístění = [Pozice, Yaw-Pitch-Roll]'''
'''Placement = [Position, Yaw-Pitch-Roll]'''


Druhý tvar zadání '''Umístění''' ustaví místo objektu v prostoru pomocí Pozice (stejně jako předchozí tvar),ale popíše jeho orientaci použitím úhlů Yaw, Pitch a Roll ([http://en.wikipedia.org/wiki/Yaw,_pitch,_and_roll Yaw, Pitch, Roll]). Tyto úhly jsou někdy také nazývány jako Eulerovy úhly nebo Tait-Bryanovy úhly ([http://en.wikipedia.org/wiki/Euler_angles Eulerovy úhly]). Yaw, Pitch a Roll jsou běžně užívány v letecké terminologii pro orientaci (nebo polohu) tělesa.
Druhý tvar zadání '''Umístění''' ustaví místo objektu v prostoru pomocí Pozice (stejně jako předchozí tvar),ale popíše jeho orientaci použitím úhlů Yaw, Pitch a Roll ([http://en.wikipedia.org/wiki/Yaw,_pitch,_and_roll Yaw, Pitch, Roll]). Tyto úhly jsou někdy také nazývány jako Eulerovy úhly nebo Tait-Bryanovy úhly ([http://en.wikipedia.org/wiki/Euler_angles Eulerovy úhly]). Yaw, Pitch a Roll jsou běžně užívány v letecké terminologii pro orientaci (nebo polohu) tělesa.


'''Position = (x,y,z)''' is a Vector describing the point from which the object's geometry will be calculated (in effect, a "local origin" for the object).
'''Pozice = (x,y,z)''' je vektor popisující souřadnice referenčního bodu objektu.


'''Yaw-Pitch-Roll = (y,p,r)''' is a tuple that specifies the attitude of the object. Values for y,p,r specify degrees of rotation about each of the z,y,x axis (see note).
'''Yaw-Pitch-Roll = (y,p,r)''' is a tuple that specifies the attitude of the object. Values for y,p,r specify degrees of rotation about each of the z,y,x axis (see note).
{{clear}}
{{clear}}
<syntaxhighlight>
>>> App.getDocument("Sans_nom").Cylinder.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(10,20,30), App.Vector(0,0,0))
</syntaxhighlight>

App.Rotation(10,20,30) = Euler Angle

'''Yaw''' = 10 degrees ('''Z''')

'''Pitch''' = 20 degrees ('''Y''')

'''Roll''' = 30 degrees ('''X''')



[[Image:Tache_Placement_Lacet_fr_Mini.gif|left]]'''Yaw''' is the rotation about the '''Z axis''', that is to say a rotation from left to right. <br />(The yaw angle is the '''Psi ψ''').
[[Image:Tache_Placement_Lacet_fr_Mini.gif|left]]'''Yaw''' is the rotation about the '''Z axis''', that is to say a rotation from left to right. <br />(The yaw angle is the '''Psi ψ''').
Line 61: Line 72:
(r21,r22,r23,t2),
(r21,r22,r23,t2),
(r31,r32,r33,t3),
(r31,r32,r33,t3),
(0,0,0,1)) , kde rij specifikuje rotaci a ti specifikuje transformaci.
(0,0,0,1)) , with rij specifying rotation and ti specifying translation.
{{clear}}
{{clear}}
==The Placement Dialog==
==Dialogové okno umístění==
The Placement Dialog is invoked from the '''Edit''' menu. It is used to precisely rotate/translate objects. It is also used when we need to create a sketch on a "non standard" plane or change a sketch's orientation to a new plane.
Dialogové okno umístění se spouští z menu '''Úpravy'''. Je využíváno pro přesné pootočení a posunutí objektů. Je využíváno také když je potřeba vytvořit náčrt v "nestandardní" rovině nebo změnit orientaci náčrtu v nové rovině.
The '''Translation''' section adjusts the object's location in space.
Sekce '''Posunutí''' určuje místo objektu v prostoru.
The '''Center''' section adjusts the rotational axis to one that does not pass through the object's reference point.
Sekce '''Střed''' určuje umístění rotační osy bodem, který neprochází referenčním bodem objektu.
The '''Rotation''' section adjusts the rotational angle(s) and the method of specifying those angles.
Sekce '''Otočení''' určuje úhel(úhly) otočení a metodu, která specifikuje tyto úhly.
Zakliknutí políčka '''Použijte nárůstové změny na umístění objektu''' je užitečné když posuny/rotace jsou prováděny relativně k aktuální pozici/poloze objektu než k původní pozici/poloze. Zakliknutí tohoto políčka resetuje vstupní pole okna na hodnotu nula, ale nezmění orientaci ani místo objektu. Následná zadání mění orientaci/místo, ale ta jsou aplikována vzhledem k aktuální pozici.
The '''Apply incremental changes to object placement''' tick box is useful when translations/rotations are to be made relative the object's current position/attitude, rather than to the original position/attitude. Ticking this box resets the dialog's input fields to zero, but does not change the object's orientation or location. Subsequent entries do change the orientation/location, but are applied from the object's current position.
==Příklady==
Otočení kolem jedné osy:
==Examples==
Rotations about a single axis:


[[Image:RotationAboutZBefore.png|600px|left|Před otočením]] Před otočením (pohled shora) {{clear}}
[[Image:RotationAboutZBefore.png|600px|left|Před otočením]] Před otočením (pohled shora) {{clear}}
Line 98: Line 110:
[[Image:2Placements800.png|frame|left|2 tvary se stejným umístěním]]{{clear}}
[[Image:2Placements800.png|frame|left|2 tvary se stejným umístěním]]{{clear}}


Both cubes have the same value for Placement, but are in different locations! This is
Obě kostky mají stejné umístění, ale různé místo! Je to kvůli tomu, že oba tvary mají odlišné vrcholy. Pro tvary výše pro ilustraci:
because the 2 shapes are defined by different vertices (curves in more complex shapes). For the 2 shapes in the above illustration:


>>> ev = App.ActiveDocument.Extrude.Shape.Vertexes
>>> ev = App.ActiveDocument.Extrude.Shape.Vertexes
Line 124: Line 137:
>>>
>>>
The Vertices (or Vectors) that define the shape use the Placement.Base attribute as
Vrcholy (nebo Vektory), které definují objekt využívají atributy Placement.Base jako jejich počátek. Proto, když chcete posunout objekt o 10 jednotek podél osy '''X''', můžete přidat 10 do souřadnic '''X''' všech vrcholů nebo můžete nastavit pozici umístění Placement.Position
their origin. So if you want to move a shape 10 units along the '''X''' axis, you could
na (10,0,0).
add 10 to the '''X''' coordinates of all the Vertices or you could set Placement.Base
to (10,0,0).
==Using "Center" to Control Axis of Rotation==
==Použití "Středu" pro nastavení řídící osy otáčení==
By default, the axis of rotation isn't really the x/y/z axis. It is a line parallel to the selected axis, but passing through the reference point (Placement.Base) of the object to be rotated. This can be changed by using the Center fields in the Placement dialog or, in scripts, by using the Center parameter of the FreeCAD.Placement constructor.

Standardně osa otáčení není ve skutečnosti osa X/Y/Z. Je to paralelní přímka k vybrané ose, která ale prochází referenčním bodem (Placement.Base) objektu, který se bude otáčet. Může to být změněno použitím pole Střed v dialogovém okně Umístění nebo ve skriptu použitím parametru Center (Střed) konstruktoru FreeCAD.Placement.


Například, představme si, že máme kostku (dále) pozicovanou na (20,20,10).
Například, představme si, že máme kostku (dále) pozicovanou na (20,20,10).
Line 157: Line 171:
}}
}}


==Poznámky==
==Notes==
* Osy a úhly mohou být také vyjádřeny jako [http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation čtveřice].
* Axis and Angle can also be expressed as a [http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation quaternion].
* The reference point of an object varies depending on the object. Some examples for common objects:
* Referenční bod objektu (FreeCAD.Placement.Base) se mění v závislosti na objektu. Některé příklady pro běžné objekty:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!Object!!Reference Point
!Objekt!!Referenční bod
|- align="left"
|- align="left"
|Part.Box ||levý (minx), přední (miny), spodní (minz) vrchol
|Part.Box ||left (minx), front (miny), bottom (minz) vertex
|- align="left"
|- align="left"
|Part.Sphere||střed koule (tj střed ohraničující kostky)
|Part.Sphere||center of the sphere (ie centre of bounding box)
|- align="left"
|- align="left"
|Part.Cylinder||střed spodní plochy
|Part.Cylinder||center of the bottom face
|- align="left"
|- align="left"
|Part.Cone||střed spodní plochy (nebo vrchol když spodní poloměr je 0)
|Part.Cone||center of bottom face (or apex if bottom radius is 0)
|- align="left"
|- align="left"
|Part.Torus||střed torusu
|Part.Torus||center of the torus
|- align="left"
|- align="left"
|Features derived from Sketches||the Feature inherits the Position of the underlying Sketch. Sketches always start with Position = (0,0,0).
|Vlastnosti odvozené z Náčrtu||objekt dědí pozici z podkladového náčrtu. Náčrt vždy začíná na pozici = (0,0,0).
|}
|}
{{clear}}
{{clear}}
==Problémy==
==Issues==
* As of version 0.13, update of Placement properties in the Data tab has been disabled for objects created with PartDesign, except for the initial sketch from which the solid will be created. Therefore the Placement of a solid created in PartDesign from a sketch can only be altered by adjusting Placement parameters of the initial construction sketch (the first sketch) from which the solid was created.
* Od verze 0.13, byla aktualizace vlastností Umístění v záložce Data zablokována pro objekty vytvořené v Návrhu dílu, kromě původního náčrtu, ze kterého bylo těleso vytvořeno. Proto Umístění tělesa vytvořeného v Návrhu dílu může být změněno pouze nastavením parametrů umístění původního konstrukčního náčrtu (první náčrt), ze kterého bylo těleso vytvořeno.
* Placement functionality will eventually be handled in the Assembly workbench.
* Funkcionalita Umístění může být dodatečně měněna v pracovní ploše Kompletace.
{{clear}}
{{clear}}
==Další==
==More==
*This tutorial: [[Aeroplane|Aeroplane]] covers the mechanics of changing an object's Placement extensively.
* Tento výukový program: [[Aeroplane/cs|Aeroplán]] široce pokrývá mechanismy změn umístění objektů.
* Popis dialogového okna Umístění krok za krokem naleznete zde [[Tasks_Placement/cs|Úkoly umístění]].
*A step-by-step explanation of the Placement Dialog can be found here [[Tasks_Placement|Tasks_Placement]].


[[Category:User Documentation/cs]]
[[Category:User Documentation/cs]]

Revision as of 18:50, 22 August 2015

Celkový pohled

Umístění je vlastnost FreeCADu, která specifikuje místo a orientaci objektu v prostoru. Umístění může být specifikováno ve více formulářích a může být měněno pomocí skriptů v poli vlastnosti nebo v dialogovém okně Umístění (menu Úpravy).

Přístup k atributům Umístění

K atributům objektu Umístění lze přistupovat a modifikovat je 3 způsoby:

Umístění v panelu vlastností
Skriptováním umístění jako y/p/r a Matrixu (matice) a jejího API.
Dialogové okno umístění

Tvary zadání umístění

Úhel, Osa a Pozice

Umístění = [Úhel, Osa, Pozice]

První tvar zadání Umístění ustaví místo objektu v prostoru na Pozici a popíše jeho orientaci jako pootočení kolem osy.

Úhel = r je skalární hodnota udávající velikost pootočení objektu kolem osy. Zadává se ve stupních, ale interně je zaznamenán v radiánech.

Axis = (ax,ay,az) is a vector describing an axis of rotation (See Note about axis of rotation). Examples are:

   (1,0,0)       ==> about X axis
   (0,1,0)       ==> about Y axis
   (0,0,1)       ==> about Z axis
   (0.71,0.71,0) ==> about the line y=x
                                        

Position = (x,y,z) is a Vector describing the point from which the object's geometry will be calculated (in effect, a "local origin" for the object). Note that in scripts, Placement.Base is used to denote the Position component of a placement. The Property Editor calls this value "Position" and the Placement dialog calls it "Translation".

Position and Yaw, Pitch and Roll

Placement = [Position, Yaw-Pitch-Roll]

Druhý tvar zadání Umístění ustaví místo objektu v prostoru pomocí Pozice (stejně jako předchozí tvar),ale popíše jeho orientaci použitím úhlů Yaw, Pitch a Roll (Yaw, Pitch, Roll). Tyto úhly jsou někdy také nazývány jako Eulerovy úhly nebo Tait-Bryanovy úhly (Eulerovy úhly). Yaw, Pitch a Roll jsou běžně užívány v letecké terminologii pro orientaci (nebo polohu) tělesa.

Position = (x,y,z) is a Vector describing the point from which the object's geometry will be calculated (in effect, a "local origin" for the object).

Yaw-Pitch-Roll = (y,p,r) is a tuple that specifies the attitude of the object. Values for y,p,r specify degrees of rotation about each of the z,y,x axis (see note).

>>> App.getDocument("Sans_nom").Cylinder.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(10,20,30), App.Vector(0,0,0))

App.Rotation(10,20,30) = Euler Angle

Yaw = 10 degrees (Z)

Pitch = 20 degrees (Y)

Roll = 30 degrees (X)


Yaw is the rotation about the Z axis, that is to say a rotation from left to right.
(The yaw angle is the Psi ψ).

Pitch is rotation about the Y axis, that is to say nose-up and nose-down.
(The Pitch angle is the Phi φ).

Roll is rotation about the X axis, that is to say wing up and down.
(The Roll angle is the Thêta θ).

Matrix (matice)

Umístění = Matrix

Třetí tvar zadání Umístění popisuje pozici a orientaci objektu pomocí 4x4 afinní transformační matice (Affine Transformation).

Matrix (matice) =

  ((r11,r12,r13,t1),
   (r21,r22,r23,t2),
   (r31,r32,r33,t3),
   (0,0,0,1)) , with rij specifying rotation and ti specifying translation. 

The Placement Dialog

The Placement Dialog is invoked from the Edit menu. It is used to precisely rotate/translate objects. It is also used when we need to create a sketch on a "non standard" plane or change a sketch's orientation to a new plane.

The Translation section adjusts the object's location in space. The Center section adjusts the rotational axis to one that does not pass through the object's reference point. The Rotation section adjusts the rotational angle(s) and the method of specifying those angles.

The Apply incremental changes to object placement tick box is useful when translations/rotations are to be made relative the object's current position/attitude, rather than to the original position/attitude. Ticking this box resets the dialog's input fields to zero, but does not change the object's orientation or location. Subsequent entries do change the orientation/location, but are applied from the object's current position.

Examples

Rotations about a single axis:

Před otočením
Před otočením

Před otočením (pohled shora)

Po otočení kolem osy Z
Po otočení kolem osy Z

Po otočení kolem osy Z (pohled shora)

Po otočení když y=x
Po otočení když y=x

Po otočení když y=x (pohled zprava)

Otočení s posunutím středového bodu:

Před otočením
Před otočením

Před otočením (pohled shora)

Po otočení kolem osy Z
Po otočení kolem osy Z

Po otočení kolem osy Z (pohled shora)

Otočení s použitím Eulerových úhlů:

Před otočením
Před otočením

Před otočením

Po otočení
Po otočení

Po otočení

Placement.Base vs Shape Definition

Umístění není jediný způsob pozicování objektů v prostoru. Všimněte si Pythonovské konzoly na tomto obrázku:

2 tvary se stejným umístěním

Both cubes have the same value for Placement, but are in different locations! This is because the 2 shapes are defined by different vertices (curves in more complex shapes). For the 2 shapes in the above illustration:

 >>> ev = App.ActiveDocument.Extrude.Shape.Vertexes
 >>> for v in ev: print v.X,",",v.Y,",",v.Z
 ... 
 30.0,30.0,0.0
 30.0,30.0,10.0
 40.0,30.0,0.0
 40.0,30.0,10.0
 40.0,40.0,0.0
 40.0,40.0,10.0
 30.0,40.0,0.0
 30.0,40.0,10.0
 >>> e1v = App.ActiveDocument.Extrude001.Shape.Vertexes
 >>> for v in e1v: print v.X,",",v.Y,",",v.Z
 ... 
 0.0,10.0,0.0
 0.0,10.0,10.0
 10.0,10.0,0.0
 10.0,10.0,10.0
 10.0,0.0,0.0
 10.0,0.0,10.0
 0.0,0.0,0.0
 0.0,0.0,10.0
 >>> 
 

The Vertices (or Vectors) that define the shape use the Placement.Base attribute as their origin. So if you want to move a shape 10 units along the X axis, you could add 10 to the X coordinates of all the Vertices or you could set Placement.Base to (10,0,0).

Using "Center" to Control Axis of Rotation

By default, the axis of rotation isn't really the x/y/z axis. It is a line parallel to the selected axis, but passing through the reference point (Placement.Base) of the object to be rotated. This can be changed by using the Center fields in the Placement dialog or, in scripts, by using the Center parameter of the FreeCAD.Placement constructor.

Například, představme si, že máme kostku (dále) pozicovanou na (20,20,10).

Před otočením

Chceme otočit kostku kolem její svislé středové přímky (tj. místní osy Z) s udržením stejné pozice. Můžeme toho snadno dosáhnout zadáním hodnoty Středu rovné souřadnicím středu kostky (25,25,15).

Po otočení

Ve skriptu by to vypadalo následovně:

import FreeCAD
obj = App.ActiveDocument.Box                       # our box
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1),45)   # 45° about Z
centre = FreeCAD.Vector(25,25,15)                  # central point of box 
pos = obj.Placement.Base                           # position point of box
newplace = FreeCAD.Placement(pos,rot,centre)       # make a new Placement object
obj.Placement = newplace                           # spin the box

Same script with the file example RotateCoG2.fcstd (discussion on the forum)

import FreeCAD
obj = App.ActiveDocument.Extrude                    # our box
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1),45)    # 45 about Z
centre = FreeCAD.Vector(25,25,0)                    # "centre" of rotation (where local Z cuts XY)
pos = obj.Placement.Base                            # original placement of obj
newplace = FreeCAD.Placement(pos,rot,centre)        # make a new Placement object
obj.Placement = newplace                            # spin the box

Notes

  • Axis and Angle can also be expressed as a quaternion.
  • The reference point of an object varies depending on the object. Some examples for common objects:
Object Reference Point
Part.Box left (minx), front (miny), bottom (minz) vertex
Part.Sphere center of the sphere (ie centre of bounding box)
Part.Cylinder center of the bottom face
Part.Cone center of bottom face (or apex if bottom radius is 0)
Part.Torus center of the torus
Features derived from Sketches the Feature inherits the Position of the underlying Sketch. Sketches always start with Position = (0,0,0).

Issues

  • As of version 0.13, update of Placement properties in the Data tab has been disabled for objects created with PartDesign, except for the initial sketch from which the solid will be created. Therefore the Placement of a solid created in PartDesign from a sketch can only be altered by adjusting Placement parameters of the initial construction sketch (the first sketch) from which the solid was created.
  • Placement functionality will eventually be handled in the Assembly workbench.

More

  • This tutorial: Aeroplane covers the mechanics of changing an object's Placement extensively.
  • A step-by-step explanation of the Placement Dialog can be found here Tasks_Placement.