Sandbox:PartDesign Bearingholder Tutorial I

The purpose of this tutorial is to introduce you to two different work flows for creating a cast part with drafts and fillets. Depending on what other CAD programs you have been using, one or the other might be familiar to you. As a working example we will be modeling a simple bearing holder.

This is the first part of the tutorial. It will use what might be called the single body work flow, using the (simpler) top part of the holder as an example.

Bearing Holder Tutorial - Finished bearing holder (top)

Prerequisites

 * Having completed the following tutorials:
 * Creating a simple part with PartDesign
 * Basic Part Design Tutorial 017
 * A minimum proficiency with the Sketcher Workbench.

Design data
The holder should be able to hold a 90mm diameter bearing with a width of up to 33mm (e.g. DIN 630 type 2308). The bearing requires a shoulder height of at least 4.5mm in the holder (and on the shaft). The top part of the holder will be bolted to the bottom with two 12mm bolts. There should be a groove on both sides of the bearing able to hold a standard shaft sealing ring DIN 3760: 38x55x7 or 40x55x7 on one side, 50x68x8 on the other side.

The holder will be a sand cast with a minimum wall thickness of 5mm, a draft angle of 2 degrees, and a minimum fillet radius of 3mm.

Starting the model
Create a new document, then switch to the PartDesign Workbench. Alternatively, from the StartPage you can click on "Part Design" under "Start a new project"; this will automatically create a new document and switch to the PartDesign workbench.

Next, click on Create body in the Tasks panel or on the icon in the toolbar.

Note: the body is a new object introduced in FreeCAD 0.17. It is a container that holds all the sketches, datum (reference) geometry and features for a single contiguous part. It is an object exclusive to PartDesign.

Setting up the skeleton geometry
The idea of skeleton geometry is to capture the basic design dimensions in a single datum (reference) feature (e.g. a plane or an axis). When a design dimension needs to be changed, all that needs to be done is to change the skeleton feature. If the model is well built, then all its features will recompute to reflect the design change. This reduces the danger that in a complex model, where the basic design dimensions are used in multiple places, you forget to change it somewhere.

The alternative to skeleton geometry is to have a table of the basic design dimensions that assign a symbolic name to each dimension, and then use the symbolic name wherever the dimensions is required to build the model. In such a case, the Spreadsheet Workbench could be used along with Expressions.

For the case of the bearing holder, the two most important design dimensions are the distance between the bolts (which limits the size of the bearing that can be used) and the height of the bolt heads. The dimensions chosen are
 * Distance between bolts: Radius of bearing (45) + wall thickness (5) plus radius of hole for bolt (7) = 57mm, so the vertical plane will be 57mm offset from the YZ-plane.
 * Height of bolt heads: This was chosen as an offset of 28mm from the XY-plane
 * Two further datum planes can be created to reflect the amount of material that must be cut away from the sides of the bearing holder. They are offset +22 and -22 from the XZ-plane.

Bearing holder with the two most important skeleton planes.

It is advisable to give clear names to the skeleton geometry. Most of the time, you will want to turn off visibility for datum planes because they clutter up the screen, and if the planes have self-explanatory names you can just pick them by name in the Model tree instead of from the 3D view.


 * 1) In the Model tree, click on the arrow in front of Body to reveal its content; select Origin and make it visible by pressing the spacebar. You can also click on the arrow besides it in the Model tree to reveal its content (X/Y/Z_Axis and XY/XZ/YZ_Plane).
 * 2) Let's start with the first datum plane to define the bolt distance. Click on [[Image:PartDesign_Plane.png|24px]] Create a new datum plane. In the Tasks panel, the Plane parameters is shown with the first button labeled "Selecting...", which indicates it is waiting for a selection. In the 3D view or in the Model tree, select the YZ_Plane. In the Plane parameters, the first button is now labeled "Plane", and the selected plane is shown in the input field besides it. Just above in green is shown Attached with mode Plane face.
 * 3) Next we set the 57mm offset. This is done in the Extra placement section of the Plane parameters. The X/Y/Z directions are not referenced to the global coordinate system, but to the coordinate system of the YZ_Plane. Therefore, the offset value should be entered in the Z field. Click OK.
 * 4) In the Model tree, a new "DatumPlane" object is created underneath the Body. Rename it Plane_BoltAxis.
 * 5) Next create a new datum plane attached to XY_Plane with a Z offset of 28mm. Rename it Plane_BoltHead.
 * 6) Create a third datum plane attached to XZ_Plane with a Z offset of 22mm. Rename it Plane_FrontSide.
 * 7) Finally create a fourth datum plane attached to XZ_Plane with a Z offset of -22mm. Rename it Plane_BackSide.

The Body's standard planes and all datum planes.

Creating the main shape
Now it's time to start creating some real geometry. But first, hide all the datum planes but Plane_BoltAxis, we will want to use it as external geometry in our first sketch. Then we will pad this sketch.

Sketch for the first pad


 * 1) Create a Sketcher NewSketch.png new sketch and attach it to the XZ_Plane with attachment mode Plane face.
 * 2) Use the Sketcher External.png Sketcher external geometry tool to copy the Plane_BoltAxis datum plane that is shown as a yellow vertical line to the right of the sketch. A vertical magenta line will be created. You can switch to the Model tab and hide Plane_BoltAxis.
 * 3) Add geometry as shown on the image above, for example using the Sketcher CreatePolyline.png Polyline tool along with the key to toggle between line and arc modes. There are just four dimensions:
 * 4) *The inner radius (22.5mm);
 * 5) *The machining allowance (3mm) at the base as an offset to the horizontal sketch axis;
 * 6) *The distance from the datum plane representing the bolt axis (7mm);
 * 7) *The 2 degree angle constraint for the short vertical lines. This means that if you later move the datum plane, the pad will automatically adjust its outer radius. Remember that before you can use the datum plane for dimensioning, you need to introduce it as external geometry to the sketcher. You are probably wondering why there is a small straight segment at the bottom of each arc. This segment ensures that there will be a draft angle of 2 degrees on the arcs. This might look like a lot of work for a very small benefit, but many CAD programs (and maybe FreeCAD one day) have tools that highlight a solid model in different colours and immediately show you all faces where the draft angle is not correct. You don't want that to happen to your model, especially after putting on a lot of fillets!
 * 8) When you have done the sketch, close it, and with the sketch still selected, create a PartDesign Pad.png PartDesign Pad feature symmetric to plane with a length of 62mm (34mm for the bearing, 2x 9mm for the sealing rings, 2x 5mm for the wall thickness).

Cutting the sides
Next we want to cut away some material where the sealing rings are, because their outer diameter is much less than the bearing's. In Setting up the skeleton geometry, we created datum planes to define the depth at which to cut away the material. We will therefore attach our next sketches to these datum plane. This way, if you ever want to modify the holder to be able to hold wider bearings, all you have to do is to change the attachment offset of these datum planes, and the cut-out depth will follow along.

The only two important dimensions in the sketch are 3mm of machining allowance at the bottom, and a inner diameter of 78mm: 68mm for the outer diameter of the sealing ring + 2x 5mm wall thickness. Since the sealing ring on the other side will only have a diameter of 55mm, the cut-out can be 65mm here. The sketch geometry will be as shown in the picture below.



''Sketch of the cut-away attached to the front side datum plane. Draw style was set to Wireframe.''


 * 1) Select the Plane_FrontSide datum plane then create a Sketcher NewSketch.png new sketch and keep the proposed Plane face attachment mode. Press  to proceed to the sketch editing mode. Note: because the sketch is on a plane located inside the previous Pad feature, part of the sketch plane is obstructed by the solid. To be able to see the whole sketch plane, we have a few options:
 * 2) * Hide the Pad feature in the Model tree by selecting it and hitting
 * 3) * Switch the 3D view Draw style from DrawStyleAsIs.png As is to DrawStyleWireFrame.png Wireframe from the View → Draw style menu or from the view toolbar (click on the down arrow to the right of the active Draw style icon to expand icons of the other available draw styles)
 * 4) * Change the Transparency property of the Body to 50 or more
 * 5) * v0.18 and above Click on the Sketcher ViewSection.png View section button in the Sketcher toolbar to create a view section that temporarily hides any matter in front of the sketch plane.
 * 6) Create the geometry as per the above image. One efficient method to produce this profile is to
 * 7) Create a Sketcher CreateRectangle.png Rectangle
 * 8) Use the Sketcher CreatePolyline.png Polyline tool to trace the inner profile, starting with one of the two short lines, then toggling the  key thrice to draw the tangent arc, and finish with a line. You can either start and end the lines on the bottom edge of the rectangle, so a Constraint PointOnObject.png point-on-object constraint is automatically added, or you can start and end the lines below the rectangle. But do take care to slant the lines so that Constraint Vertical vertical constraints are not added, because we need them to have a 2-degree angle with the vertical sketch axis.
 * 9) Use the Sketcher Trimming.png Trimming tool to trim the bottom rectangle in between the two short lines, and to trim the short lines to the two sides of the now broken bottom edge of the rectangle if needed.
 * 10) Complete the constraining of the sketch and close it.
 * 11) With the sketch still selected, press the PartDesign Pocket.png Pocket button. By default, the Pocket feature will remove matter by "digging" into the sketch plane; but this is not the direction we want, since this would remove matter inside the Body. So in the Pocket parameters, we'll tick the Reverse checkbox, and choose Through all then we'll press.
 * 12) Next we need to make the cut on the rear side. This sketch will have slightly different dimensions that the sketch we just made. Rather than create a new one from scratch, select Sketch001 then duplicate it by going to the Edit → Duplicate selected object. A dialog will open, asking "The selected objects have a dependency to unselected objects. Do you want to duplicate them, too?" Press.
 * 13) We now have a copy of the sketch right under Pocket, but we need to attach it to the rear side datum plane. With the new Sketch selected, go to the Data tab, and click on the Map Mode property field. This will reveal an ellipsis  button to the right. Press it to open the Attachment dialog.
 * 14) In the first field of the Attachment dialog, the current selection is DatumPlane002. This is the internal ID of the 3rd datum plane we created in Setting up the skeleton geometry, in other words the one we renamed Plane_FrontSide. To the left, the first button is labelled  which means a new selection will be accepted. In the 3D view, select Plane_BackSide and press.
 * 15) Let's edit this sketch and change the value of the radius constraint from 39 mm to 32.5 mm. Close the sketch.
 * 16) With the sketch still selected, press the PartDesign Pocket.png Pocket button. This time, the pocketing direction is exactly the one we want, since our copied sketch kept the same orientation as the original; being on the other side of the XZ_Plane, we only need to set the type to Through all.

Cutting the interior
To reduce the amount of machining required, we also want to cut away some material inside the holder. We'll create three separate pocket features for that. Duplicating the sketch of the first pad is convenient. It doesn't even have to be remapped. Again, the only important dimensions are the machining allowance (3mm) and the outer diameters: 84 mm for the place where the bearing will be (90mm - 2x 3 mm machining allowance), 49 mm for the smaller sealing ring (55mm - 2x 3 mm) and 62 mm for the larger sealing ring. In the sketches, these values need to be divided in half since we have to use radius constraints - there is no diameter constraint available in the Sketcher.

Sketch003 for the main cut-away in the middle of the pad.


 * 1) Create a single duplicate copy of the first Sketch. It will automatically be named Sketch003.
 * 2) Edit Sketch003 and delete the inner arc and the short lines connected to it, along with one of the bottom horizontal lines. Delete the magenta external geometry line to the right as it will not be needed here.
 * 3) Connect the bottom line that is left to the opposite end to close the profile.
 * 4) Add constraints as shown in the image above, with a radius constraint value of 42 mm. Close the sketch.
 * 5) Create two duplicate copies of Sketch003, and edit them; in Sketch004, change the radius constraint value to 31 mm; in Sketch005, change the radius constraint value to 24.5 mm.
 * 6) Create a PartDesign Pocket.png Pocket feature for the bearing cut-out from Sketch003 with a distance of 28 mm (34 mm - 2x machining allowance) symmetric to plane;
 * 7) Create a PartDesign Pocket.png Pocket feature for the front sealing ring cut-out from Sketch004 with a one-sided distance of 23 mm (34 mm / 2 for half the bearing width + 9 mm for the sealing rings - 3 mm machining allowance), with Reversed checkbox ticked;
 * 8) Create a PartDesign Pocket.png Pocket feature for the rear sealing ring cut-out from Sketch005 with a one-sided distance of 23 mm, default direction.

The part should now look like the picture below. Note how the different cut-aways combine to create an almost uniform wall thickness, which will make the casting easier and less liable to have pores.

Main geometry of the holder top.

Adding the bolt supports
Now all that remains is to create some material for the bolts to go through. You might be tempted to sketch these as a circle and then pad them, but this will head you for trouble when you try to apply the draft angle onto them later (I assume that is a weakness of Open Cascade). So to circumvent the problems, it is better to create a sketch with the draft angle included and then create a Revolution feature from it.

Here again the skeleton planes will be useful for use as external geometry. We will need the bolt axis plane and the bolt head plane. Although we could add a construction line in the sketch to use as axis for the Revolution feature, let's try another method and create a datum line to be used as revolution axis.


 * 1) Make Plane_BoltAxis and Plane_BoltHead visible.
 * 2) Press the PartDesign Line.png Create a new datum line button.
 * 3) Select Plane_BoltAxis and choose Object's Y as attachment mode. Press.
 * 4) Create a new Sketcher NewSketch.png sketch attached to the XZ_Plane.
 * 5) Create Sketcher External.png external geometry from the Plane_BoltHead datum plane and from either Plane_BoltAxis or DatumLine.
 * 6) Add and constrain geometry as shown in the image below. This can be done quickly by creating a Sketcher CreateRectangle.png Rectangle, then deleting the Constraint Vertical.png vertical constraint on the vertical line to the right. HolderTop1-8.png  Sketch of the revolution profile with draft angle.
 * 7) Create a PartDesign Revolution.png Revolution feature from the sketch to 360 degrees, with DatumLine as Axis.
 * 8) Select Revolution and add a PartDesign Mirrored.png Mirrored feature with Base YZ plane.

This is all the solid geometry we need to model. The rest is draft and fillets.

Finished geometry of the holder top (without draft and fillets).

Applying draft to the side faces
The next step is to apply drafts on all faces which don't already have one, which means the front and rear, outer and inner faces. Its important to consider the location of the neutral plane, that is, the plane which the face is "rotated" around. If we choose as neutral plane the bottom of the holder, then we will have a problem with the wall thickness in the top part of the holder. Therefore, we create a datum plane at an offset of 40mm from the XZ plane as a compromise between the top of the holder becoming to thin and the bottom becoming too wide.


 * 1) Create a [[Image:PartDesign_Plane.png|24px]] datum plane attached to the XY_Plane with Plane face mode and an attachment offset in Z of 40 mm. Rename it NeutralPlane. HolderTop1-10.png  The neutral plane for creating drafts.
 * 2) Select the front and rear outer faces as shown in the image below and create a PartDesign Draft.png Draft feature. You can also select only one face, then add the other faces once in the Draft parameters. You need to click on the  button for each added face. Next set a draft angle of 2 degrees then press the  button and select NeutralPlane. You can leave the pull direction empty, in this case it will be normal to the neutral plane. HolderTop1-11.png Applying a draft angle to the front and rear faces of the holder.
 * 3) Select the front and rear inner faces and create a second PartDesign Draft.png Draft feature. In addition to the same parameters as the first Draft, check the Reverse pull direction checkbox.

If you have a large part, it is advisable to draft only one face at a time. This means that if you change the geometry and a draft fails, only this one feature will fail, whereas if you put all faces in one draft feature, then the whole feature might fail because of one face failing. For a small part like the bearing holder, it's sufficient to create two draft features.

Filleting the holder
We can now fillet the part. The picture shows the first set of fillets. Start with the small circular fillets and make them 4mm radius. Even though 3mm would be enough as per specification of the part, a radius of 4mm means that after machining 1mm of the fillet is left, reducing the sharp edge produced by the machining. The large fillets are 6mm radius to help spread the force from the bolts into the rest of the part. It would be nice to make this radius even larger, but unfortunately OpenCascade can't handle overlapping fillets yet.

As with drafts, in a complex part you should fillet only one edge at a time to avoid unnecessary failures if the base geometry changes.

The rest of the fillets are simply 3mm radius. Looking at the picture on the right, the two highlighted fillets could actually be filleted with 5mm to achieve a more uniform wall thickness for the casting. After machining, the minimum wall thickness of 5mm would still be maintained. But again the fact that OpenCascade can't handle overlapping fillets prevents us from doing this for the inner of the two highlighted fillets.

Filleting the inside of the part presents us with a difficulty that cannot be solved with the current tools in the PartDesign workbench. The highlighted edge cannot be filleted at all, again because the rounds would overlap. This could be worked around by creating a sweep instead of a fillet, except that sweeps are not implemented in PartDesign yet. For the time being, we are forced to leave the edge as it is.

The picture on the right shows the finished part in the state it will be before machining (except for the one edge that is impossible to fillet). You will notice that one edge that runs around the whole part has been left unfilleted on purpose. This is the edge where the bottom and the top of the mould meet. Here, no fillet is possible (and none is required anyway).

Machining
Now we can cut away the material that will be machined off the raw cast part. This is very easy with the skeleton geometry defined. The idea is to create all machining features (Pockets and Grooves) using datum features only. This means they will be totally independent of the solid geometry of the bearing holder, which gives us some big advantages:
 * No matter how you change the solid geometry, the features for the machining can never fail.
 * You can create the machining geometry before finalizing the solid, which gives you useful visual feedback.
 * If you move the skeleton datum planes, then both the solid geometry and the machining will adapt automatically.
 * If you make a mistake in your solid geometry, the machining will still be in the correct position, and very likely the mistake will become glaringly obvious (e.g. a wall thickness becoming 2mm instead of 5mm). Whereas if you reference the machining to the solid geometry, it will adapt to the error in the solid and e.g. maintain the 5mm wall thickness, just in the same wrong location as the solid is.

Before starting on the machining geometry, I like to place a datum point in the tree and name it something like "Machining_starts_here". This is useful if you want to switch between the raw and the machined state of the part because you can see at a glance where to move the insert point to get the raw state.

To machine the bottom of the holder, just sketch a large rectangle on the XZ plane and pocket it. For the top, sketch a circle on the datum plane defining the bolt head location, and then mirror the pocket on the YZ plane. In the same way, create a pocket for the hole which the bolt will go through and mirror it. To machine the inside of the holder, create a sketch on the YZ plane and groove it.

Once you have done the machining, you can have a nice visual effect by colouring all the machined faces so that you can see at one glance which parts are raw casting and which are machined after casting.

Final notes
We have modelled the bearing holder top with the dimensions it will have after casting. To create the casting mould, you need to apply shrinkage to your part because after casting, when the hot metal cools down, it will shrink by a few percent (depending on the material). Usually it is best to leave the application of shrinkage to the foundry making the part because they have the required special knowledge. They should also tell you if your part has problematic areas, e.g. very thick walls suddenly joining to very thin sections without a properly tapered section between them.

Part Two
PartDesign Bearingholder Tutorial II