
Summary. This tutorial builds a fully parametric 3D CAD model of a deep groove ball bearing with ISCAD, the open-source, script-based CAD editor of InsightCAE. The model is written as text, in fewer than 30 lines of ISCAD code.
- Input: a single value, the bore diameter. Outer diameter and width are read from a table of the DIN 625 series 62 (bearings 6200 to 6210).
- Output: the ball bearing as solid geometry, its mass and centre of gravity, a STEP file for other CAD systems, and rendered images.
- Steps: 7, each a complete script you can run.
- Time: about 30 minutes.
- You learn: parameters, boolean operations, rule-based edge selection, fillets, circular patterns, table lookup, reusable parts and batch rendering.
What Is ISCAD?
ISCAD is the graphical editor for InsightCAD, the script-based ("CAD as code") modeling language of the open-source engineering workbench InsightCAE. It is licensed under the GPL.
A model is a text file (.iscad) with named parameters, features and operations. The geometry is created by the OpenCASCADE kernel as exact boundary representation (B-rep) solids, so it can be exported to STEP, IGES, BREP and STL.
Because a model is a script, it is:
- parametric by design
- easy to keep under version control
- easy to drive from simulation and optimization workflows, e.g. with OpenFOAM or Code_Aster
ISCAD runs with a GUI (editor plus 3D view) or without one in batch mode.
What You Will Learn
| ISCAD concept | Syntax | Used in | |
|---|---|---|---|
| Parameters and derived values | d ?= 25; / Dpw = 0.5*(d+D); | Step 1 | |
| Components vs. construction features | outer_ring: ... vs. groove = ... | Steps 1–2 | |
| Solid primitives | Ring, Torus, Sphere, Box | Steps 1–5 | |
| Boolean operations | a - b, `a \ | b,a & b` | Step 2 |
| Rule-based edge selection and fillets | Fillet(f?edges('isCircle'), r) | Step 3 | |
| Circular patterns | CircularPattern(ball, O, 2*M_PI/Z*EZ, Z) | Steps 4–5 | |
| Table lookup from CSV | TableLookup(bearings62, d, d, D) | Final model | |
| Material density and description | -> density, @description | Final model | |
| Reusing a model as a part | loadmodel(ballBearing, d=30) | Steps 6–7 | |
| Mass properties and STEP export | SolidProperties, saveAs("x.step") | Step 6 | |
| Images from the command line | iscad --batch model.iscad -s image.png | Rendering |
Requirements and Files
- InsightCAE with ISCAD installed (Linux package, Windows installer or built from source; see the installation guide).
- The files of this tutorial in
stories/01_ballBearing. Every step is a complete script, so you can open any of them directly:
cd stories/01_ballBearing
iscad 01_rings.iscad
Start ISCAD in this directory: steps 6 and 7 load ballBearing.iscad and the table bearings62.csv from the current directory. Alternatively, add the directory to the environment variable ISCAD_MODEL_PATH.
All lengths are in millimetres. All images were created by ISCAD in batch mode (see How the images were rendered).
Bearing Design Rules Used in the Model
The model derives all dimensions from the three main dimensions of DIN 625: bore diameter d, outer diameter D and width B. The proportions are simplified textbook values. They give a realistic bearing, but they are not manufacturer data.
| Quantity | Symbol | Rule | Value for 6205 |
|---|---|---|---|
| Pitch diameter of the ball set | Dpw | (d + D) / 2 | 38.5 mm |
| Ball diameter | Dw | 0.3 · (D - d) | 8.1 mm |
| Number of balls | Z | ⌊π · Dpw / (1.4 · Dw)⌋ | 10 |
| Raceway groove radius | ri | 0.52 · Dw | 4.2 mm |
| Inner ring shoulder diameter | d2 | Dpw − 0.6 · Dw | 33.6 mm |
| Outer ring shoulder diameter | D2 | Dpw + 0.6 · Dw | 43.4 mm |
| Edge fillet radius | r | 0.06 · B | 0.9 mm |
Step 1: Define Parameters and Create the Bearing Rings
Script: 01_rings.iscad
d ?= 25; # bore diameter
D ?= 52; # outer diameter
B ?= 15; # width
Dpw = 0.5*(d+D); # pitch diameter of the ball set
Dw = 0.3*(D-d); # ball diameter
d2 = Dpw - 0.6*Dw; # outer diameter of the inner ring
D2 = Dpw + 0.6*Dw; # bore diameter of the outer ring
outer_ring: Ring(O, B*EZ, D, D2);
inner_ring: Ring(O, B*EZ, d2, d);
An ISCAD model is a sequence of symbol definitions. The type of each symbol (scalar, vector, feature, ...) follows from its expression; there are no declarations.
?=defines a parameter: a default value, which can be overridden when the model is loaded into another one (step 7).=defines a fixed value. All further dimensions are derived from the three main dimensions, so the model stays consistent when a parameter changes.:defines a component: a feature which is part of the final product. Intermediate features, defined with=, are construction steps only.
Ring(p0, p1, Da, Di) creates a hollow cylinder from point p0 to p1. O is the origin and EX, EY, EZ are the unit vectors, so B*EZ is the point at height B on the z-axis.

In the editor: press Ctrl+Return to rebuild the model.
- The "Variables" list shows the values of all scalars and vectors, such as the computed
Dpw.- The "Model Steps" list shows all features. Its check boxes switch their display on and off.
- Ctrl+I opens the inspection of all model symbols.
Step 2: Cut the Raceway Grooves with a Boolean Subtraction
Script: 02_raceways.iscad
The balls run in grooves, the raceways. We cut them with a torus whose tube radius is slightly larger than the ball radius:
ri = 0.52*Dw; # groove radius, slightly larger than the ball
pc = 0.5*B*EZ; # centre of the ball set (a vector)
outer_blank = Ring(O, B*EZ, D, D2);
inner_blank = Ring(O, B*EZ, d2, d);
groove = Torus(pc, Dpw*EZ, 2*ri);
outer_ring: outer_blank - groove;
inner_ring: inner_blank - groove;
Torus(p0, axisTimesD, d) takes the centre, the axis direction multiplied by the torus diameter, and the tube diameter. Like pc, vectors are ordinary symbols.
Here the cutting tool and the inner ring blank are shown together:

Boolean operations are written as operators: - subtracts, | unites and & intersects. One tool cuts both rings:
![]() | ![]() |
The blanks and the torus are intermediate features (=). They stay accessible in the model tree, but they are not part of the product.
Step 3: Round the Ring Edges with Rule-Based Edge Selection and Fillets
Script: 03_fillets.iscad
Real bearing rings have rounded edges. To round them, we first need to say which edges:
r ?= 0.06*B; # edge fillet radius
outer_edges = outer_blank?edges('isCircle');
inner_edges = inner_blank?edges('isCircle');
outer_ring: Fillet(outer_edges, r) - groove;
inner_ring: Fillet(inner_edges, r) - groove;
feature?edges('<rule>') selects edges by a rule. Here we want all circular edges of the blank: the four edges at the end faces. The rule language knows many queries, for example:
isLinelen > 5minimal(CoG.z)isPartOfFace(...)
Rules can be combined with &&, || and !. Because the selection is a rule and not a list of picked edges, it still works when the dimensions change. This avoids the "topological naming problem" of click-based CAD, where references to picked edges break after a change.
The fillets are applied to the blanks, before the groove is cut, so the groove edges stay sharp.

Step 4: Arrange the Balls with a Circular Pattern
Script: 04_balls.iscad
Z = floor(M_PI*Dpw/(1.4*Dw)); # number of balls
ball = Sphere(pc + 0.5*Dpw*EX, Dw);
balls: CircularPattern(ball, O, 2*M_PI/Z*EZ, Z);
One ball is placed on the pitch circle. CircularPattern(base, p0, deltaphi, n) copies it n times around the axis through p0. The direction of deltaphi is the axis and its length is the angular step.
Even the number of balls is computed: as many as fit on the pitch circle, with a gap of 40 % of the ball diameter between neighbours.
![]() | ![]() |
Step 5: Model the Bearing Cage
Script: 05_cage.iscad
The cage keeps the balls evenly spaced. In our simple version, it is a thin ring on the pitch circle with spherical pockets:
cage_blank = Ring(pc - 0.3*Dw*EZ, pc + 0.3*Dw*EZ, Dpw + 0.35*Dw, Dpw - 0.35*Dw);
pockets = CircularPattern(Sphere(pc + 0.5*Dpw*EX, 1.05*Dw), balls);
cage: cage_blank - pockets;
CircularPattern(feature, other_pattern) reuses the axis, step and count of an existing pattern. If the number of balls changes, the pockets follow automatically.
![]() | ![]() |
Finished Model: Table Lookup of DIN 625 Dimensions, Material and Description
Script: ballBearing.iscad
The final model collects all steps and adds three things.
1. Dimensions from a table. The DIN 625 main dimensions are stored in bearings62.csv:
d;D;B
...
25;52;15
30;62;16
...
Only the bore diameter remains a free value. Outer diameter and width are looked up, and they can still be overridden, because they are parameters too:
d ?= 25;
D ?= TableLookup(bearings62, d, d, D); # table, key column, key value, result column
B ?= TableLookup(bearings62, d, d, B);
2. Materials. Densities are needed for mass and centre of gravity computations:
outer_ring -> density = 7.85e-6; # steel, kg/mm^3
inner_ring -> density = 7.85e-6;
ball -> density = 7.85e-6; # set on the pattern base: the copies inherit it
cage -> density = 8.5e-6; # brass
3. A description, used e.g. in bills of materials. It contains the actual dimensions:
@description 'Deep groove ball bearing %gx%gx%g' % d % D % B;

Step 6: Reuse the Bearing as a Part, Compute Its Mass and Export to STEP
Script: 06_section.iscad
A model file is also a reusable part. loadmodel builds it with new parameter values:
bearing = loadmodel(ballBearing, d=30); # bearing 6206: D=62, B=16 from the table
quarter = Box(O, 100*EX, -100*EY, 100*EZ, center z);
outer_ring: bearing.outer_ring - quarter;
inner_ring: bearing.inner_ring - quarter;
balls: bearing.balls - quarter;
cage: bearing.cage - quarter;
The components of the loaded model are accessed with . and its scalars with $. Here every component is cut open by a box, which removes one quarter:
![]() | ![]() |
The script continues with postprocessing actions: a measurement, the mass properties and a STEP export for other CAD programs.
Distance(width, O, bearing$B*EZ);
SolidProperties(bearing_props) << bearing;
saveAs("bearing_6206.step") << bearing;
SolidProperties reports a mass of 0.20 kg for the 6206. That is the catalogue weight of the real bearing.
Step 7: Generate a Whole Bearing Series from One Model
Script: 07_series.iscad
With the table in place, a bearing series takes one line per size:
b6200: loadmodel(ballBearing, d=10);
b6202: loadmodel(ballBearing, d=15) << 40*EX;
b6204: loadmodel(ballBearing, d=20) << 90*EX;
b6206: loadmodel(ballBearing, d=30) << 155*EX;
b6208: loadmodel(ballBearing, d=40) << 235*EX;
<< moves a feature by a vector.

How the Images Were Rendered
All images were created without the GUI, by ISCAD in batch mode. The option -s / --screenshot writes an image after the model is built:
iscad --batch ballBearing.iscad -s images/ballBearing.png
iscad --batch 04_balls.iscad -s top.png,view=top
iscad --batch 05_cage.iscad -s cage.png --screenshot-features cage
iscad --batch 06_section.iscad -s section.png,dir=0:1:0,up=0:0:1 --screenshot-size 1200x900
- Image format: follows from the file extension (png, jpg, bmp, tif).
- Views: a preset (
view=iso|front|back|top|bottom|left|right), or a free view directiondir, up directionup, image centrefocusand image half-heightscale. - Features shown: by default the components;
--screenshot-featuresselects others for all images of the run.
render_images.sh recreates all images of this article. This is useful for documentation that has to stay up to date with the model, and for visual checks in automated tests.
Frequently Asked Questions
What is script-based CAD?
In script-based CAD ("CAD as code"), the geometry is described by a text script instead of mouse interactions. Parameters, operations and their order are explicit and readable. Changing a value and rebuilding updates the whole model, and the script can be versioned with Git like source code. ISCAD, OpenSCAD and CadQuery are examples of this approach. Like CadQuery, and unlike the mesh-based OpenSCAD, ISCAD uses the OpenCASCADE kernel: its models are exact B-rep solids, which can be exported as STEP.
How do I make a CAD model parametric in ISCAD?
Define the main dimensions with ?= (overridable parameters) and derive all other dimensions from them with =. Select edges and faces by rules (e.g. ?edges('isCircle')) instead of by picking. Then the model rebuilds correctly for any parameter value, and other models can set the parameters through loadmodel(model, name=value).
Can ISCAD export STEP files?
Yes. saveAs("file.step") << feature; writes STEP. The same command writes IGES (.igs), BREP (.brep) and STL (.stl), depending on the file extension.
Can ISCAD compute mass and centre of gravity?
Yes. Assign a density with feature -> density = value; and add SolidProperties(name) << feature;. It reports mass, surface area, centre of gravity, inertia tensor and bounding box.
Can ISCAD run without a graphical user interface?
Yes. iscad --batch model.iscad builds the model and runs its postprocessing actions (exports, reports). With --screenshot it also renders images, for example in continuous integration or documentation builds.
Is ISCAD free?
Yes. ISCAD is part of InsightCAE, which is open-source software under the GNU General Public License (GPL). It runs on Linux and Windows.
Are the bearing dimensions in this tutorial exact?
The main dimensions d, D and B are the DIN 625 values of series 62. The internal dimensions (ball size, ball count, groove radius, cage) follow simplified proportions. They are suitable for visualization, assemblies and simulation set-ups, but not for bearing design calculations. Use manufacturer data for those.
What does the colon mean in an ISCAD script?
name: expression; defines a component: a feature that belongs to the final product. It is shown by default, included in mass properties and in bills of materials, and exported when the model is used as a part. name = expression; defines an intermediate construction feature.
Next Steps and Exercises
- Load
ballBearingwithd=50ord=12. - Override a looked-up value:
loadmodel(ballBearing, d=25, B=20). - Change the ball count rule. What happens to the cage?
- Add a seal: a thin
Ringbetween the rings, on both sides of the ball set. - Replace the cage by one with straight pockets (use
Cylinderinstead ofSphere). - Read the InsightCAD language guide and the ISCAD command reference in the InsightCAE documentation.
silentdynamics







