Tutorial KinematicSkeleton: Difference between revisions

From FreeCAD Documentation
(add SeeAlso)
 
(31 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<translate>
<translate>


<!--T:1-->
{{TutorialInfo
{{TutorialInfo
|Topic=Assembly3, a kinematic skeleton
|Topic=Assembly3, a kinematic skeleton
Line 8: Line 9:
|Time=40 minutes
|Time=40 minutes
|Author=[[User:FBXL5|FBXL5]]
|Author=[[User:FBXL5|FBXL5]]
|SeeAlso=[[Tutorial_KinematicAssembly|Tutorial KinematicAssembly]], [[Tutorial_KinematicController|Tutorial KinematicController]]
}}
}}


==Introduction==
==Introduction== <!--T:2-->


<!--T:3-->
This tutorial is about how to set up a simple 2D mechanism and attach 3D objects, mainly with the tools from the external [[Image:Assembly3_workbench_icon.svg|16px]] [[Assembly3_Workbench|Assembly3 Workbench]].
This tutorial is about how to set up a simple 2D mechanism and attach 3D objects, mainly with the tools from the external [[Image:Assembly3_workbench_icon.svg|16px]] [[Assembly3_Workbench|Assembly3 Workbench]].


<!--T:4-->
This tutorial does not use the skeleton sketch principle (see Assembly3 [https://github.com/realthunder/FreeCAD_assembly3/wiki/Create-Skeleton-Sketch Create-Skeleton-Sketch] on GitHub).
This tutorial does not use the skeleton sketch principle (see Assembly3 [https://github.com/realthunder/FreeCAD_assembly3/wiki/Create-Skeleton-Sketch Create-Skeleton-Sketch] on GitHub).


<!--T:5-->
Instead we will use [[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|PartDesign Bodies]] containing only one [[Image:Workbench_Sketcher.svg|16px]] [[Sketcher_Workbench|Sketch]] each, to build a 2D mechanism, a '''multi sketch skeleton'''.
Instead we will use [[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|PartDesign Bodies]] containing only one [[Image:Workbench_Sketcher.svg|16px]] [[Sketcher_Workbench|Sketch]] each, to build a 2D mechanism, a '''multi sketch skeleton'''.


<!--T:6-->
The dimensions, and the colours as well, are taken from the [http://solvespace.com/linkage.pl SolveSpace tutorial] which is referred to on the Assembly3 GitHub page (see above).
The dimensions, and the colours as well, are taken from the [http://solvespace.com/linkage.pl SolveSpace tutorial] which is referred to on the Assembly3 GitHub page (see above).


==Multi sketch skeleton==
==Multi sketch skeleton== <!--T:7-->


<!--T:8-->
This so-called multi sketch skeleton consists of several individual [[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|Bodies]] and an [[Image:Assembly_New_Assembly.svg‎‎|16px]] [[Assembly3_CreateAssembly|Assembly]] container. To be able to attach further objects each body is put into a separate Assembly container.
This so-called multi sketch skeleton consists of several individual [[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|Bodies]] and an [[Image:Assembly_New_Assembly.svg‎‎|16px]] [[Assembly3_CreateAssembly|Assembly]] container. To be able to attach further objects each body is put into a separate Assembly container.


===2D Body objects===
===2D Body objects=== <!--T:9-->


<!--T:10-->
The bodies or rather their contours that are used in this assembly:
The bodies, and their sketches, that are used in this assembly:
* A base plate (green)
* A base plate (green)
* A crank (blue)
* A crank (blue)
Line 32: Line 40:
* Four connecting rods (white, yellow, purple, and brown)
* Four connecting rods (white, yellow, purple, and brown)


<!--T:11-->
[[Image:Assembly3_SketchSkeleton-01.png|400px|link=]]
[[Image:Assembly3_SketchSkeleton-01.png|400px|link=]]
{{Caption|All eight sketches individually coloured and manually positioned by moving their parent bodies}}
{{Caption|All eight sketches individually coloured and manually positioned by moving their parent bodies}}


<!--T:12-->
The shape can deviate from that of the real part, but the position of the joint defining geometry must be accurate.
The shape can deviate from that of the real part, but the position of the joint defining geometry must be accurate.


===Assembly containers===
===Assembly containers=== <!--T:13-->


====Parent Assembly====
====Parent assembly==== <!--T:14-->


<!--T:15-->
To fix or control the positions of all bodies we need an [[Image:Assembly_New_Assembly.svg‎‎|16px]] Assembly object. It adds an assembly branch to the [[Tree_View|Tree View]].
* Press the {{Button|[[Image:Assembly_New_Assembly.svg‎‎|16px]] [[Assembly3_CreateAssembly|Create assembly]]}} button to create an assembly branch in the [[Tree_View|Tree View]].
To fix or control the positions of all bodies we need an [[Image:Assembly_New_Assembly.svg‎‎|16px]] Assembly object. It adds an assembly branch to the [[Tree_view|Tree view]].
* Press the {{Button|[[Image:Assembly_New_Assembly.svg‎‎|16px]] [[Assembly3_CreateAssembly|Create assembly]]}} button to create an assembly branch in the [[Tree_view|Tree view]].


====Sub-Assemblies====
====Sub-assemblies==== <!--T:16-->


<!--T:17-->
Repeat above action to create an Assembly object for each Body and drag the Body into its Parts container. Then fix the Body to its Assembly:
Repeat above action to create an Assembly object for each Body and drag the Body into its Parts container. Then fix the Body to its Assembly:
# Activate the Assembly object (double-click).
# Activate the Assembly object (double-click).
# Select a circle/arc belonging the Body object.
# Select a circle/arc belonging the Body object.
# Press the {{Button|[[Image:Assembly_ConstraintLock.svg‎‎|16px]] [[Assembly3_ConstraintLock|Create "Locked" contraint]]}} button to fix the Body in its sub-assembly.
# Press the {{Button|[[Image:Assembly_ConstraintLock.svg‎‎|16px]] [[Assembly3_ConstraintLock|Create "Locked" constraint]]}} button to fix the Body in its sub-assembly.


<!--T:18-->
The Crank-Assembly e.g. should look like this:
The Crank-Assembly, for example, should look like this:


<!--T:19-->
[[Image:Assembly3_SketchSkeleton-25.png|500px|link=]]
[[Image:Assembly3_SketchSkeleton-25.png|500px|link=]]
{{Caption|The Crank's sub-assembly branch in the Tree view and the Crank with its locked Element in the 3D view}}
{{Caption|The Crank's sub-assembly branch in the Tree view and the Crank with its locked Element in the 3D view}}


====Assembly tree====
====Assembly tree==== <!--T:20-->


<!--T:21-->
In the Tree view drag all sub-assembly branches into the Parts container of the parent Assembly object.
In the Tree view drag all sub-assembly branches into the Parts container of the parent Assembly object.


<!--T:22-->
[[Image:Assembly3_SketchSkeleton-26.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-26.png|300px|link=]]
{{Caption|Assembly branch in the Tree view}}
{{Caption|Assembly branch in the Tree view}}


<!--T:23-->
Now they are ready to get arranged.
Now they are ready to be arranged.


===Fixed base plate===
===Fixed base plate=== <!--T:24-->


<!--T:25-->
First we need a fixed part. To fix the Base completely we would usually select a face, but in this case a circle will do as well.
First we need a fixed part. To fix the Base completely we would usually select a face, but in this case a circle will do as well.
# Select a circle of the Base.
# Select a circle of the Base.
# Press the {{Button|[[Image:Assembly_ConstraintLock.svg‎‎|16px]] [[Assembly3_ConstraintLock|Create "Locked" contraint]]}} button to fix the Base.
# Press the {{Button|[[Image:Assembly_ConstraintLock.svg‎‎|16px]] [[Assembly3_ConstraintLock|Create "Locked" constraint]]}} button to fix the Base.


<!--T:26-->
[[Image:Assembly3_SketchSkeleton-02.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-03.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-02.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-03.png|300px|link=]]
{{Caption|Selected circle → Fixed Base with the created Element object and element coordinate system (ECS) displayed (green)}}
{{Caption|Selected circle → Fixed Base with the created Element object and element coordinate system (ECS) displayed (green)}}


===Joints===
===Joints=== <!--T:27-->


<!--T:28-->
For hinge-like joints we select one circle of each sketch and use the [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraint. It does not only set both Element's XY planes coplanar, but set their Z axes colinear, too.
For hinge-like joints we select one circle of each sketch and use the [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraint. It not only sets both Element's XY planes coplanar, but sets their Z axes colinear, too.
# Select a circle of each object to connect.
# Select a circle of each object to connect.
# Press the {{Button|[[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Create "Plane Coincidence" contraint]]}} button.
# Press the {{Button|[[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Create "Plane Coincidence" constraint]]}} button.


====Base - Crank joint====
====Base - Crank==== <!--T:29-->

<!--T:30-->
[[Image:Assembly3_SketchSkeleton-04.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-05.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-04.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-05.png|300px|link=]]
{{Caption|Circles on Base and Crank selected → Relocated Crank with the created Element objects and ECSs displayed (green)}}
{{Caption|Circles on Base and Crank selected → Relocated Crank with the created Element objects and ECSs displayed (green)}}


====Base - Upper Plate joint====
====Base - Upper Plate==== <!--T:31-->

<!--T:32-->
[[Image:Assembly3_SketchSkeleton-06.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-07.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-06.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-07.png|300px|link=]]
{{Caption|Circles on Base and Upper Plate selected → Relocated Upper Plate}}
{{Caption|Circles on Base and Upper Plate selected → Relocated Upper Plate}}


<!--T:33-->
Previously created joints are represented by their constraint representations (red).
Previously created joints can be identified by their constraint representations (red).


====Base - Upper Plate joint====
====Crank - Rod 1==== <!--T:34-->

<!--T:35-->
[[Image:Assembly3_SketchSkeleton-08.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-09.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-08.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-09.png|300px|link=]]
{{Caption|Circles on Crank and Rod 1 selected → Relocated Rod 1 and tilted Crank}}
{{Caption|Circles on Crank and Rod 1 selected → Relocated Rod 1 and tilted Crank}}


====Upper Plate - Rod 1 joint====
====Upper Plate - Rod 1==== <!--T:36-->

The last link in a kinematic chain connects two Elements with their Z directions already defined and a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint is all we need.
<!--T:37-->
The last link in this kinematic chain connects two Elements whose Z directions are already defined and a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint is all we need.
# Select a circle of each object to connect.
# Select a circle of each object to connect.
# Press the {{Button|[[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Create "PointOnLine" contraint]]}} button.
# Press the {{Button|[[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Create "PointOnLine" constraint]]}} button.


<!--T:38-->
[[Image:Assembly3_SketchSkeleton-10.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-11.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-10.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-11.png|300px|link=]]
{{Caption|Circles on Upper Plate and Rod 1 selected → Relocated Rod 1, and tilted Crank and Upper Plate}}
{{Caption|Circles on Upper Plate and Rod 1 selected → Relocated Rod 1, and tilted Crank and Upper Plate}}


<!--T:39-->
If there are 3 joints in line (those belonging to Crank and Rod 1), the solver might fail to rearrange the objects. In such case we need to help the solver and tilt one object (e.g. the Crank) manually using the [[Image:Assembly_AxialMove.svg|16px]] [[Assembly3_AxialMove|Axial move]] tool.
If the Z axes of three elements or joints are parallel and lie on the same virtual plane, the solver may fail to rearrange them in a following step because it is unable to decide in which direction the middle joint should be rotated. This can occur for the Rod 1 element, the Crank - Rod 1 joint, and the Base - Crank joint we have here. If this happens we need to help the solver and rotate one object (e.g. the Crank) manually using the [[Image:Assembly_AxialMove.svg|16px]] [[Assembly3_AxialMove|Axial move]] tool.


====Upper Plate - Rod 2 joint====
====Upper Plate - Rod 2==== <!--T:40-->

<!--T:41-->
Another kinematic (sub-)chain starts with [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraints.
Another kinematic (sub-)chain starts with [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraints.


<!--T:42-->
[[Image:Assembly3_SketchSkeleton-12.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-13.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-12.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-13.png|300px|link=]]
{{Caption|Circles on Upper Plate (or Base) and Rod 2 selected → Relocated Rod 2}}
{{Caption|Circles on Upper Plate (or Base) and Rod 2 selected → Relocated Rod 2}}


====Rod 2 - Lower Plate joint====
====Rod 2 - Lower Plate==== <!--T:43-->

<!--T:44-->
[[Image:Assembly3_SketchSkeleton-14.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-15.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-14.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-15.png|300px|link=]]
{{Caption|Circles on Rod 2 and Lower Plate selected → Relocated Lower Plate and tilted Rod 2}}
{{Caption|Circles on Rod 2 and Lower Plate selected → Relocated Lower Plate and tilted Rod 2}}


====Upper Plate - Rod 3 joint====
====Upper Plate - Rod 3==== <!--T:45-->

<!--T:46-->
[[Image:Assembly3_SketchSkeleton-16.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-17.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-16.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-17.png|300px|link=]]
{{Caption|Circles on Upper Plate and Rod 3 selected → Relocated Rod 3 and rearranged upper kinematic sub-chain}}
{{Caption|Circles on Upper Plate and Rod 3 selected → Relocated Rod 3 and rearranged upper kinematic sub-chain}}


====Lower Plate - Rod 3 joint====
====Lower Plate - Rod 3==== <!--T:47-->

<!--T:48-->
And this kinematic (sub-)chain ends with a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint, too.
And this kinematic (sub-)chain ends with a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint, too.


<!--T:49-->
[[Image:Assembly3_SketchSkeleton-18.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-19.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-18.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-19.png|300px|link=]]
{{Caption|Circles on Lower Plate and Rod 3 selected → Relocated Rod 3 and rearranged ukinematic sub-chains}}
{{Caption|Circles on Lower Plate and Rod 3 selected → Relocated Rod 3 and rearranged ukinematic sub-chains}}


<!--T:50-->

To connect both kinematic sub-chains we use Rod 4 with a [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraint on one end and a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint on the other.
To connect both kinematic sub-chains we use Rod 4 with a [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Plane Coincidence]] constraint on one end and a [[Image:Assembly_ConstraintPointOnLine.svg‎‎|16px]] [[Assembly3_ConstraintPointOnLine|Point on line]] constraint on the other.


====Crank - Rod 4 joint====
====Crank - Rod 4==== <!--T:51-->

<!--T:52-->
[[Image:Assembly3_SketchSkeleton-20.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-21.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-20.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-21.png|300px|link=]]
{{Caption|Circles on Crank and Rod 4 selected → Relocated Rod 4}}
{{Caption|Circles on Crank and Rod 4 selected → Relocated Rod 4}}


====Lower Plate - Rod 4 joint====
====Lower Plate - Rod 4==== <!--T:53-->

<!--T:54-->
[[Image:Assembly3_SketchSkeleton-22.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-23.png|300px|link=]]
[[Image:Assembly3_SketchSkeleton-22.png|300px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-23.png|300px|link=]]
{{Caption|Circles on Lower Plate and Rod 4 selected → Relocated Rod 4 and final layout of kinematic assembly}}
{{Caption|Circles on Lower Plate and Rod 4 selected → Relocated Rod 4 and final layout of kinematic assembly}}


===Actuator===
===Actuator=== <!--T:55-->


<!--T:56-->
Since Assembly3 doesn't provide any means to control kinematic assemblies, we need external assistance such as this [[Tutorial_KinematicController|kinematic controller]]. To use this controller we need to mark one constraint's label with the suffix {{Incode|"Driver"}} to make it a driving constraint. It may be separated by a {{Incode|"."}} or {{Incode|"-"}} for clarity, as the controller will only check if the label ends with {{Incode|"Driver"}}.
Since Assembly3 doesn't provide any means to control kinematic assemblies, we need external assistance such as this [[Tutorial_KinematicController|kinematic controller]]. To use this controller we need to mark one constraint's label with the suffix {{Incode|"Driver"}} to make it a driving constraint. It may be separated by a {{Incode|"."}} or {{Incode|"-"}} for clarity, as the controller will only check if the label ends with {{Incode|"Driver"}}.


<!--T:57-->
Thus the Base-Crank joint will be labeled {{Incode|Base-Crank.Driver}}.
We therefore change the label of the Base-Crank joint to {{Incode|Base-Crank.Driver}}.


===Finished skeleton===
===Finished skeleton=== <!--T:58-->


<!--T:59-->
The finished kinematic assembly with deactivated representation of Elements and Constraints should look like this:
The finished kinematic assembly with deactivated representation of Elements and Constraints should look like this:


<!--T:60-->
[[Image:Assembly3_SketchSkeleton-24.png|500px|link=]]
[[Image:Assembly3_SketchSkeleton-24.png|500px|link=]]
{{Caption|Finished assembly in the [[Tree_view|Tree view]] and the [[3D_view|3D view]]}}
{{Caption|Finished assembly in the [[Tree_view|Tree view]] and the [[3D_view|3D view]]}}


<!--T:61-->
[[Image:Assembly3_SketchSkeleton-27.gif|500px|link=]]
[[Image:Assembly3_SketchSkeleton-27.gif|500px|link=]]
{{Caption|GIF animation made from an image sequence from this [[Tutorial_KinematicController|kinematic controller]]}}
{{Caption|GIF animation made from an image sequence from this [[Tutorial_KinematicController|kinematic controller]]}}


==Attaching 3D geometry==
==Attaching 3D geometry== <!--T:62-->


<!--T:63-->
My expectations about attaching a new object to a base object belonging to a kinematic assembly were something like:
My expectations about attaching a new object to a base object belonging to a kinematic assembly were something like:
* Put the new object into the base objects Parts container.
* Put the new object into the base object's Parts container.
* Position the new object in relation to the base object.
* Position the new object in relation to the base object.
* Fix the relative offset and orientation using the Attachment constraint.
* Fix the relative offset and orientation using the Attachment constraint.
Line 160: Line 211:




<!--T:64-->
The [[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Assembly3 ConstraintAttachment]] tool, like any Assembly3 constraint tool, relies on the use of Element objects and their element coordinate systems (ECSs) for positioning tasks.
The [[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Assembly3 ConstraintAttachment]] tool, like any Assembly3 constraint tool, relies on the use of Element objects and their element coordinate systems (ECSs) for positioning tasks.


<!--T:65-->
And so attaching objects is just another way to say adding objects to a (sub-) assembly.
And so attaching objects is just another way of adding objects to a (sub-)assembly.




<!--T:66-->
Let's attach Rod 4-3D to Rod 4 for example:
Let's attach Rod 4-3D to Rod 4 for example:


<!--T:67-->
The objects have a different orientation and the 3D object should have an offset from the 2D object.
The objects have a different orientation and the 3D object should have an offset from the 2D object.


<!--T:68-->
# Put the new object into the base objects Parts container.
# Put the new object into the base object's Parts container.
# Select two corresponding circles or arcs.
# Select two corresponding circles or arcs.
# Press the {{Button|[[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Create "Attachment" contraint]]}}.
# Press the {{Button|[[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Create "Attachment" constraint]]}} button.


<!--T:69-->
:[[Image:Assembly3_SketchSkeleton-28.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-29.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-30.png|200px|link=]]
:[[Image:Assembly3_SketchSkeleton-28.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-29.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-30.png|200px|link=]]
{{Caption|Rod 4 (locked) and Rod 4-3D → Selected arcs → Relocated Rod 4-3D (both ECSs are in the same place with identical orientation)}}
{{Caption|Rod 4 (locked) and Rod 4-3D → Selected arcs → Relocated Rod 4-3D (both ECSs are in the same place with identical orientation)}}


<!--T:70-->
It is now plain to see that the [[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Assembly3 ConstraintAttachment]] tool ignores the offset and orientation between both objects.
It is now plain to see that the [[Image:Assembly_ConstraintAttachment.svg‎‎|16px]] [[Assembly3_ConstraintAttachment|Assembly3 ConstraintAttachment]] tool ignores the offset and orientation between both objects.


<!--T:71-->
However the position is already defined as we wanted and so we only need to adapt the angle manually and define the desired offset:
However the position is already defined as we wanted and so we only need to adapt the angle manually and define the desired offset:
* Set the {{PropertyData|Offset, Angle}} of the first Element in the Attachment container to match the orientation.
* Set the {{PropertyData|Offset, Angle}} of the first Element in the Attachment container to match the orientation.
* Set the {{PropertyData|Offset, Position, z}} of the same Element to apply an offset.
* Set the {{PropertyData|Offset, Position, z}} of the same Element to apply an offset.


<!--T:72-->
In case we set the properties of the second Element, the movement of angle and offset would go in the opposite direction.
In case we set the properties of the second Element, the movement of angle and offset would go in the opposite direction.
:[[Image:Assembly3_SketchSkeleton-30.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-31.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-32.png|200px|link=]]
:[[Image:Assembly3_SketchSkeleton-30.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-31.png|200px|link=]] [[Image:Button_right.svg|16px|link=]] [[Image:Assembly3_SketchSkeleton-32.png|200px|link=]]
{{Caption|As attached → Angle adapted → Offset defined}}
{{Caption|As attached → Angle adapted → Offset defined}}


<!--T:73-->
If there is a 3D object attached to each 2D object, it could look like this:
If there is a 3D object attached to each 2D object, it could look like this:


<!--T:74-->
[[Image:Assembly3_SketchSkeleton-33.gif|500px|link=]]
[[Image:Assembly3_SketchSkeleton-33.gif|500px|link=]]


==Notes==
==Notes== <!--T:75-->


<!--T:76-->
The section about attaching 3D geometry just scratches the surface of extending a sub-assembly and other constraints or combinations of constraints can be more suitable than the attachment constraint.
The section [[#Attaching_3D_geometry|Attaching 3D geometry]] just scratches the surface of extending a sub-assembly, and other constraints or combinations of constraints may be more suitable than the attachment constraint.


<!--T:77-->
It is important to move such a kinematic assembly with tiny steps or the solver will give up and fail. It is almost impossible to use [[Image:Assembly_Move.svg‎‎|16px]] [[Assembly3_MovePart|Move part]] or [[Image:Assembly_AxialMove.svg‎‎|16px]] [[Assembly3_AxialMove|Axial move]] for this task.
It is important to move such a kinematic assembly in tiny steps or the solver will give up and fail. It is almost impossible to use [[Image:Assembly_Move.svg‎‎|16px]] [[Assembly3_MovePart|Move part]] or [[Image:Assembly_AxialMove.svg‎‎|16px]] [[Assembly3_AxialMove|Axial move]] for this task.


<!--T:78-->
The [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Assembly3_ConstraintCoincidence]] constraint is used to drive the kinematic assembly, its property {{PropertyData|Angle}} (enabled by the property {{PropertyData|Lock Angle}}) accepts positive or negative floating point numbers greater than 360 and so could do several full turns.
The [[Image:Assembly_ConstraintCoincidence.svg‎‎|16px]] [[Assembly3_ConstraintCoincidence|Assembly3_ConstraintCoincidence]] constraint is used to drive the kinematic assembly, its property {{PropertyData|Angle}} (enabled by the property {{PropertyData|Lock Angle}}) accepts positive or negative floating point numbers greater than 360 and so could do several full turns.

Latest revision as of 08:07, 23 July 2022

Other languages:
Tutorial
Topic
Assembly3, a kinematic skeleton
Level
Basic knowledge of Assembly3 and Sketcher tools is helpful
Time to complete
40 minutes
Authors
FBXL5
FreeCAD version
0.20 and later
Example files
None
See also
Tutorial KinematicAssembly, Tutorial KinematicController

Introduction

This tutorial is about how to set up a simple 2D mechanism and attach 3D objects, mainly with the tools from the external Assembly3 Workbench.

This tutorial does not use the skeleton sketch principle (see Assembly3 Create-Skeleton-Sketch on GitHub).

Instead we will use PartDesign Bodies containing only one Sketch each, to build a 2D mechanism, a multi sketch skeleton.

The dimensions, and the colours as well, are taken from the SolveSpace tutorial which is referred to on the Assembly3 GitHub page (see above).

Multi sketch skeleton

This so-called multi sketch skeleton consists of several individual Bodies and an Assembly container. To be able to attach further objects each body is put into a separate Assembly container.

2D Body objects

The bodies, and their sketches, that are used in this assembly:

  • A base plate (green)
  • A crank (blue)
  • Two movable plates (red and grey)
  • Four connecting rods (white, yellow, purple, and brown)

All eight sketches individually coloured and manually positioned by moving their parent bodies

The shape can deviate from that of the real part, but the position of the joint defining geometry must be accurate.

Assembly containers

Parent assembly

To fix or control the positions of all bodies we need an Assembly object. It adds an assembly branch to the Tree view.

Sub-assemblies

Repeat above action to create an Assembly object for each Body and drag the Body into its Parts container. Then fix the Body to its Assembly:

  1. Activate the Assembly object (double-click).
  2. Select a circle/arc belonging the Body object.
  3. Press the Create "Locked" constraint button to fix the Body in its sub-assembly.

The Crank-Assembly, for example, should look like this:

The Crank's sub-assembly branch in the Tree view and the Crank with its locked Element in the 3D view

Assembly tree

In the Tree view drag all sub-assembly branches into the Parts container of the parent Assembly object.

Assembly branch in the Tree view

Now they are ready to be arranged.

Fixed base plate

First we need a fixed part. To fix the Base completely we would usually select a face, but in this case a circle will do as well.

  1. Select a circle of the Base.
  2. Press the Create "Locked" constraint button to fix the Base.

Selected circle → Fixed Base with the created Element object and element coordinate system (ECS) displayed (green)

Joints

For hinge-like joints we select one circle of each sketch and use the Plane Coincidence constraint. It not only sets both Element's XY planes coplanar, but sets their Z axes colinear, too.

  1. Select a circle of each object to connect.
  2. Press the Create "Plane Coincidence" constraint button.

Base - Crank

Circles on Base and Crank selected → Relocated Crank with the created Element objects and ECSs displayed (green)

Base - Upper Plate

Circles on Base and Upper Plate selected → Relocated Upper Plate

Previously created joints can be identified by their constraint representations (red).

Crank - Rod 1

Circles on Crank and Rod 1 selected → Relocated Rod 1 and tilted Crank

Upper Plate - Rod 1

The last link in this kinematic chain connects two Elements whose Z directions are already defined and a Point on line constraint is all we need.

  1. Select a circle of each object to connect.
  2. Press the Create "PointOnLine" constraint button.

Circles on Upper Plate and Rod 1 selected → Relocated Rod 1, and tilted Crank and Upper Plate

If the Z axes of three elements or joints are parallel and lie on the same virtual plane, the solver may fail to rearrange them in a following step because it is unable to decide in which direction the middle joint should be rotated. This can occur for the Rod 1 element, the Crank - Rod 1 joint, and the Base - Crank joint we have here. If this happens we need to help the solver and rotate one object (e.g. the Crank) manually using the Axial move tool.

Upper Plate - Rod 2

Another kinematic (sub-)chain starts with Plane Coincidence constraints.

Circles on Upper Plate (or Base) and Rod 2 selected → Relocated Rod 2

Rod 2 - Lower Plate

Circles on Rod 2 and Lower Plate selected → Relocated Lower Plate and tilted Rod 2

Upper Plate - Rod 3

Circles on Upper Plate and Rod 3 selected → Relocated Rod 3 and rearranged upper kinematic sub-chain

Lower Plate - Rod 3

And this kinematic (sub-)chain ends with a Point on line constraint, too.

Circles on Lower Plate and Rod 3 selected → Relocated Rod 3 and rearranged ukinematic sub-chains

To connect both kinematic sub-chains we use Rod 4 with a Plane Coincidence constraint on one end and a Point on line constraint on the other.

Crank - Rod 4

Circles on Crank and Rod 4 selected → Relocated Rod 4

Lower Plate - Rod 4

Circles on Lower Plate and Rod 4 selected → Relocated Rod 4 and final layout of kinematic assembly

Actuator

Since Assembly3 doesn't provide any means to control kinematic assemblies, we need external assistance such as this kinematic controller. To use this controller we need to mark one constraint's label with the suffix "Driver" to make it a driving constraint. It may be separated by a "." or "-" for clarity, as the controller will only check if the label ends with "Driver".

We therefore change the label of the Base-Crank joint to Base-Crank.Driver.

Finished skeleton

The finished kinematic assembly with deactivated representation of Elements and Constraints should look like this:

Finished assembly in the Tree view and the 3D view

GIF animation made from an image sequence from this kinematic controller

Attaching 3D geometry

My expectations about attaching a new object to a base object belonging to a kinematic assembly were something like:

  • Put the new object into the base object's Parts container.
  • Position the new object in relation to the base object.
  • Fix the relative offset and orientation using the Attachment constraint.

But that would have been too easy.


The Assembly3 ConstraintAttachment tool, like any Assembly3 constraint tool, relies on the use of Element objects and their element coordinate systems (ECSs) for positioning tasks.

And so attaching objects is just another way of adding objects to a (sub-)assembly.


Let's attach Rod 4-3D to Rod 4 for example:

The objects have a different orientation and the 3D object should have an offset from the 2D object.

  1. Put the new object into the base object's Parts container.
  2. Select two corresponding circles or arcs.
  3. Press the Create "Attachment" constraint button.

Rod 4 (locked) and Rod 4-3D → Selected arcs → Relocated Rod 4-3D (both ECSs are in the same place with identical orientation)

It is now plain to see that the Assembly3 ConstraintAttachment tool ignores the offset and orientation between both objects.

However the position is already defined as we wanted and so we only need to adapt the angle manually and define the desired offset:

  • Set the DataOffset, Angle of the first Element in the Attachment container to match the orientation.
  • Set the DataOffset, Position, z of the same Element to apply an offset.

In case we set the properties of the second Element, the movement of angle and offset would go in the opposite direction.

As attached → Angle adapted → Offset defined

If there is a 3D object attached to each 2D object, it could look like this:

Notes

The section Attaching 3D geometry just scratches the surface of extending a sub-assembly, and other constraints or combinations of constraints may be more suitable than the attachment constraint.

It is important to move such a kinematic assembly in tiny steps or the solver will give up and fail. It is almost impossible to use Move part or Axial move for this task.

The Assembly3_ConstraintCoincidence constraint is used to drive the kinematic assembly, its property DataAngle (enabled by the property DataLock Angle) accepts positive or negative floating point numbers greater than 360 and so could do several full turns.