2. Conception Assistée par Ordinateur (CAO)#

In this module, we learned how to use different conception assisting tools such as Inkscape, OpenSCAD and FreeCAD. Common point between all three: they are free and opensource.

2.1 Inkscape#

Inkscape is a vector drawing software.

Key Command Description
S Selection
+ S Change from moving to rotating a selected object
arrows and + arrows Move Move object by 2px or 20px
[ and ] Rotate Rotate left and right
+ > and + \< Scale Scale up or down object

2.2 OpenSCAD#

OpenScad is a free and opensource 3D-modeling software.

You can build most 2D and 3D basic shapes with it.

cylinder(h=4, r=4);
cylinder(h=4, r1=3, r2=5, center=true);

The parameters needed vary with the shapes but different parameters can be given for a same shape family (see ex above). The “center” parameter will put your shape’s center at the origin if true.

You can also translate, rotate and scale your shapes. To do so, simply add above your shape’s line the transformation requested.

rotate([0, 0, 45])
translate([3, 4, 0])
    cube([6, 2, 4], center=true);

Note: Here, two transformations are applied. First the cube will translate starting from the center, and then rotate 45 degrees around the z axis along a circle of radius 5.

Some commands operate on two or more shapes.

  • hull() : Fills the gap between two shapes in the most natural way possible
  • difference() : Cuts out from the first shape given all the following shape
  • union(): Unites two distinct shapes in a single object. You can no longer operate on the shapes individually.
  • intersection(): Keeps only the intersection of the objects given.

example:

difference(){ 
  sphere(r=5, center=true);

  translate([0, 0, 2])
    union(){
      cylinder(h=2, r=4);

      translate([-4, 0, 0])
          cylinder(h=2, r=4);
    };
  }

For more OpendSCAD tools, here is a cheatsheet.

My Flexlink

As a first exercice, we had to create flexlinks using parametric modules. I decided to try out the Airplane Beam.

License CC BY-NC-SA

Step 1: H_bar#

First I tried to creat a simple module capable of creating a flat cylindrical bar with holes in it.
I chose to use the follwing parameters to define my bar

  1. hole radius (r)
  2. number of holes (n)
  3. seperation between holes (d)
  4. thickness / height of bar (h)
  5. \(\alpha, \beta \in [0,1]\), two extra parameters for adjustements

The first three determine the bar’s length (L) and width (W):

\[ L = n 2r + (n + 1) d W = 2r + 2d \]

With hull, I created the main piece without hole.

module bar(){

//if n_holes = 0 nothing is done 
if (n_holes > 0)

//creates the bar without holes
hull() {
translate([(bar_length/2)-(bar_width/2),0,0])
cylinder(h=thickness, r=bar_width/2);

translate([-(bar_length/2)+(bar_width/2),0,0])
cylinder(h=thickness, r=bar_width/2);
}
}

I then used difference with a recursive function inside to place the holes. To do so I used two new variables:

  • distance between two hole centers
    \(2r + d\)
  • distance of the center of the furthest hole
    \({1\over2} (n-1)(2r+d)\)

The recursive function is as followed:

difference() {
bar();
for (dx=[-max_center:center_dist:max_center]) {
translate([dx, 0, 0])
    cylinder(h=3*thickness, r=hole_rad, center=true); 
  }
}

This code says that for every value of \(dx\) going from \(-max\_center\) to \(+max\_center\) with a jump of \(center\_dist\), make a hole in the bar at the position \([dx, 0, 0]\).

Download SCAD file

Step 2: T_bar#

Next let’s try to assemble three H_bars together in new file. To access my H_bar module on my new file, I simply add the following at it’s begining;

include <H_bar.scad> 

Note: Make sure both files are in the same direction. Or else add the path for the file to include

Main idea
First I create the middle bar and leave it centered at the origin. I then create the two exterior bars and rotate and translate them in order to have them at the two exterior holes of the middle bar with the angle requested. In this way, both exterior bars share individually a hole with the middle one. Check my code for more detail.

Difficulties
The main difficulty was correctly placing the exterior bars. I mainly used two new values to do so:

  • Distance from origin of the center of the edge holes
  • Distance between the center of two holes

I only calculate for all three bars (middle, exterior left & exterior right) the first value as the second should be common to the three.

Method :

  1. Create an exterior left/right bar with module H_bar
  2. Translate it along the x axis in order to have the center of an edge hole at the origin
  3. Rotate as to meet required angle
  4. Translate up to the center of the left/right edge hole of the middle bar

Problems
T-bar problem 2

The two main problems I had were

  1. Inhomogeneous continuity of the border where bars intersected.

  2. Bits of bars exceeding in the holes adjacent to the ones at intersection.

The first issue was negligeable but not the second. I therefor started adding a whole new bloc of code just to artificially erase the overlaying in the holes. It was long and tireing and most importantly USELESS.
This overlaying was due to the two “adjustement coefficients” I decided to use in order to reduce a little the width and length of bars if necessary. Initially, I used \(L'=L\alpha\) and \(W'=W\beta\). Only by doing so, it messed up the dimensions of my bar.

Thought : Applying \(\beta\) to W directly makes it possible to have W = 0 when the minimum width wanted should be above the diameter a of hole in order to still have a border.

\[ W'=W\beta \quad \rightarrow \quad W' = 2r + 2d\beta \]

This way, the bar’s width will be at minimum the diameter of a hole.
Same reasoning for the bar’s length.

\[ L'=L\alpha \quad \rightarrow \quad L' = n2r + (n - 1) d + 2d\alpha \]

With these new definitions of \(L\) and \(W\), the second problem was solved.

With more tests I ended up realising the first issue would now only appear when using different coefficients :

\(\alpha = \beta \quad\) solved the first problem once the second one was dealt with.

Download SCAD file

Step 3: Satelite beams#

In a new file, I include the file containing my T_bar module. I create new parameters to adjust the length and width of the two “beams” I want to add to the main body of my Airplane beam.

  • beam1 length & width
  • beam2 length & width

To create the tips of the beams, I decided to use my T_bar module with n_1 = n_2 = 0 in order to directly orient them perpendicularly using the angle_3 parameter.

T_bar(2, 1, 0, -90, 0, thickness, hole_rad, hole_sep); 

I then uses my four new parameters to correctly position the beams and their tips.

rotate([0, 0, -90])
translate([hole_rad+0.5*hole_sep, -beam1_width/2, 0])
cube([beam1_length, beam1_width, thickness]);

translate([0,-(2*hole_rad+hole_sep+beam1_length),0])
T_bar(2, 1, 0, -90, 0, thickness, hole_rad, hole_sep); 

Note : In order to avoid problems when uniting all the pieces together, adjust the translations so that the seperate pieces overlay a little.

Final result#

Using the dimensions of a lego brick, here is my final result for the airplane beam.

Openscad screen of AB

Download SCAD file

2.3 FreeCad#

FreeCad is another free and opensource 3D modeling software. It may be a little harder to grasp then OpenScad but gives much more tools to work with your 3D model. It seems to me more adapted for complexe models with many different parts.

This is what it looks like for me when I open FreeCAD. I’m not sure it’s perfectly normal as I had some difficulties for the installation.

FreeCAD start screen

To start a project, simply select new file. In the tasks bar, click on create body then create sketch and choose a plane (XY is preferable). From here you can start building and constraining a 2D shape.