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.

Objectives

The purpose of this tutorial is to show how a model can be constructed by positioning sketches relative to other geometry using some of the various attachment modes available.

Although it is possible to use solid geometry (Vertices,Edges and Faces) for reference geometry, in the interest of what is considered good practice, this tutorial will refrain from doing so.

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!)

Once again we need to hide the solid, in this case Pocket001, and make sure both sketches are visible for selection (BaseSketch and FinalSketch).

Select FinalSketch and open the attachment 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!)

Now we need to Flip(mirror) it, translate it through 90&deg; and shift it up to the corner.

At the bottom of the attachment dialogue is a check box labeled 'Flip Sides', check this box.

The FinalSketch mirrors it's self.

Now we will translate through 90&deg;. From the illustration FinalSketch above we can see the axis of revolution should be the X axis. In the Wiki this termed Roll. Remember this is relative to the local Coordinate System. Enter 90&deg; in the "around X-axis" box of the attachment offset section of the dialogue.





We could use Z-direction offset to shift FinalSketch to the corner, but I would like to demonstrate another feature.

So let's confirm and close the dialogue for now.

Select FinalSketch and look in the combo view, properties pane in the attachment section, just below the Map Mode property is the Map Path Parameter.



The default setting is 0.0 if we change it to 1 the sketch will map to the other end of the line, and 0.5 gives us half way. Enter 0.5 in the value column.

The combination of 'Normal To Edge' and Map Path Parameter is very useful for positioning sketches for Lofts or Sweeps.



You can now pocket the sketch. Don't forget to use Symmetric to plane.



So far we have seen how to position sketches with attachment modes and offsets, but we could've used Standard planes because the relative positioning was quite simple.

Now we are faced with a more challenging problem, how do we cut away this lump that's left?



We can sees that there is a plane that passes through the corners of the red triangle, it would be simple if we could just slice it away there.

Well because we were careful with our positioning earlier on, we can!

First make the solid invisible, in fact make everything except RightAngleTriangleSketch and FinalSketch invisible.

Now select the three points that form the plane, Don't forget to hold the CTRL KEY (CMD on a Mac) while making the selection.



Create a datum plane, the attachment Dialogue will open showing the three points you selected as references 1-3 and a mode of 'Plane By 3 Points'.



Confirm and close the Dialogue. We could now use the Datum Plane to create a Sketch, but there is no need we can use the plane directly to pocket the excess material away. Make sure the datum Plane is selected, and click on pocket, in the pocket Dialogue select through all and reversed. Close the Dialogue and we are all done.