Scripted Parts: Ball Bearing - Part 1/de

Introduction
This tutorial is meant as a beginner's introduction to creating parts with python scripts within FreeCAD.

This tutorial will cover how to build a ball bearing with a CSG-workflow.

The code will produce a new FreeCAD document with 12 shapes (Inner Ring, Outer Ring and 10 balls/spheres).

It will look like this:



Workflow
The workflow is more or less identical how you would create the part in part workbench.

Just some small differences.


 * Create a new empty document and make it the active document
 * Insert Cylinder
 * Insert Cylinder
 * Do boolean cut to get basic shape of inner ring
 * Select all edges and apply a fillet
 * Insert torus
 * Move torus into position and do a boolean cut to create the groove for the balls
 * Repeat all steps for getting the shape for the outer ring
 * Insert first ball
 * Insert other balls using math to calculate the position of the balls
 * Set view to axometric
 * Zoom to fit all

Filleting edges
In part workbench using the GUI, you would select chamfers in the 3D view or in the menu for fillets and then apply the fillets.

Here we select all edges of a shape and apply fillets.

Therefore we need to select the edges BEFORE creating the groove.

Links
Scripted objects: The wiki page explaing the basics of scripting

Topological data scripting: A tutorial for covering basics of scripting

Scripted Parts: Ball Bearing - Part 2: Doing it with sketches

Bearing Script 1: Base for this tutorial, thanks to JMG ...