Basic Attachment Tutorial



This tutorial should serve as an introduction to Part:Attachment, it is not comprehensive, but hopefully will help users experiment. Written for V0.19, but should be valid for any version 0.17 and later.

Pre-requisites

Before attempting this tutorial users should :-
 * 1) Use version 0.17 or greater.
 * 2) Be comfortable navigating the FC 3D view.
 * 3) Be able to make and constrain a sketch.
 * 4) Have a basic understanding of the Part Design workbench.
 * 5) Have a basic understanding of Expressions.

Preliminaries

Before we start let us examine at how we should go about building this model.

From whichever angle we look at it, we see a square or rectangle with a corner trimmed off.



There is however an obvious axis from which all features are common



We could make a sketch on any of the major planes. We could include a trimmed corner in our base sketch, but let's forego that and include an extra sketch and pocket, for learning purposes. We will start with a block and pocket the excess away.

Switch to Part Design workbench, open a new document, create a body and a new sketch on the XY plane.

Sketch a rectangle, centre it on the origin, constrain with a length(Horizontal) of 70mm and name it "length", further constrain it with a width(vertical) of 40mm, and name it "width".

Select the sketch press F2, and rename to 'BaseSketch'.



If we leave the sketch where it is, things would be too easy. We'd have planes and axes in all the correct places, No, let's change the sketches position by altering it's attachment offset.

In the combo view, look in the Data tab, find attachment Offset and expand it, by clicking the plus sign next to it.

Do the same for the Position sub heading. Change the X offset to 80mm, and the Y offset to 90mm.



The Sketch can now be padded, let's assume that the height should be the same as the width, in the length box, press '=' or select the function button type "sketch.constraints.width", it should resolve to 40mm and tick symmetric to plane.



Let's make the next sketch, it's not really important which one we choose, but the easiest one is the 20x20 isosceles triangle that pockets through the length of the block.

Make a new sketch, choose which ever plane you like (we're going to change it's attachment anyway.)

Draw the triangle, make two sides equal and constrain the length the same way as you did the Pad Length only this time make the formula "sketch.constraints.width/2".

There should be two degrees of freedom remaining, they are the position with regards to the origin. Fix one of the corners to the origin so that the sketch looks thus:-



Close the sketch. Rename the sketch, call it 'IsoscelesSketch'. The origin of the sketch is the point that will be attached in the future, so choosing how the sketch is constrained to the origin is important. We can adjust the position of the sketch using offsets, but it is better to choose wisely in the first place.

Now we are going to attach the sketch to our model.

Select Pad and make it invisible, and make BaseSketch visible. We need to see the BaseSketch, and we want to hide the pad so that we avoid making incorrect selections.

The 3D view should look something like this:-



I chose the XY plane for my isosceles sketch, yours maybe different.

Now we need to select IsoscelesSketch and go to the properties pane in the Combo view. Click in the value box next to the Map Mode property, a button will appear with an elipsis.



Click on that and a task pane will open with the Attachment Dialogue.



Here we can see the attachment that we chose when the sketch was created (in the select Plane dialogue.)

The reference1 button is in selecting mode, so in the 3D view select one of the long sides of the Base Sketch.

The IsoscelesSketch will attach itself to the line you selected, and the attachment mode window will change to reflect the available modes.





You can see that the IsoscelesSketch has been attached to the selected line at the point we constrained to the origin earlier on.

This concept of the origin being the attachment point is important, it makes the attachment modes very flexible, and can be a powerful tool in your modeling.

It can be used with the addition of offsets to precisely position sketches without relying on generated geometry and all the problems that may arise from using them.

FreeCad tries to predict the attachment mode for you, and filters the modes available for the given selection.

In this case, the options are "Deactivated," "Normal To Edge" and "Inertia 2-3". Normal To Edge is in bold and is deemed the preferred selection.

The notification area at the top of the dialogue, shows a message in green stating the mode in use.

Grayed out options show that more selections are required in order to activate them.

At this point you could make another selection, and see the difference in modes. Don't forget to change back to "Normal To Edge" mode before continuing with the tutorial.

The IsoscelesSketch is now correctly positioned so confirm and exit the dialogue.

You can now pocket the sketch.



Create the next sketch, the dimensions should be expressions and it should be constrained to the origin at the vertex adjacent the hypotenuse and its shortest side.

Rename the sketch RightAngleTriangleSketch.



Once again we need to hide the solid, in this case Pocket, and make sure both sketches are visible for selection (leave isoscelesSketch invisible it will just get in the way!).

Select RightAngleTriangleSketch and open it's attachment mode dialogue.

Select one of the rectangles short sides as the first reference.



The 3D view should be similar to the picture above. It is not important which end of the line the triangle is attached to (it depends on how the rectangle was drawn!)

If you chose the wrong line, change it now. If the triangle is pointing the wrong way you can correct it by checking the "Flip Sides" checkbox at the bottom of the dialogue (or later on after closing the dialogue it can be changed in the properties data tab by setting "Map Reversed" to "True").

The RightAngleTriangleSketch is now in a position that will give us the correct Geometry after a pocket operation, however we can get a little inventive here, and position the sketch so that it makes it easier for us to attach further geometry later on. We are going to shift our sketch to the middle of the line so that it provides us with a vertex at the top of the corner chamfer.

In the attachment dialogue, we are going to change the attachment mode from "Normal To Edge" to "Inertia 2-3". This will change the position to the centre of the line, it's beyond the scope of this tutorial to describe all the attachment modes, their descriptions can be found HERE. Suffice to say inertia 2-3 does the job here.





The RightAngleTriangleSketch is now correctly positioned so confirm and exit the dialogue.

You can now pocket the sketch. This time use Symmetric to plane.



In general it is better to position our sketches simply with attachment modes. But it is not always possible to position the sketches exactly where we need without modifying the attachment mode in some way.

FreeCAD provides a number of ways to do this.


 * 1) Attachment offset, allows positioning relative to the local coordinates of the attachment point. (where the origin of the positioned sketch is attached.)
 * 2) Map Path parameter (in the Property data tab with show all enabled) This allows for the positioning along a selected edge.
 * 3) Flip Sides/Map Reversed. Effectively mirrors the sketch.

For our final sketch, we will Attach it arbitrarily, and correct it's position using the modifiers listed above.

Create the final sketch, the dimensions should be expressions and it should be constrained to the origin at the vertex adjacent the hypotenuse and its shortest side.

Rename the sketch FinalSketch.



Note that FinalSketch has been constrained to the origin differently. Otherwise we could've used 'carbon copy', but hey the sketch is Three lines and five constraints, PFFFT.( I know, I know, I'm workin' you too hard!)