II. Computer Aided Design (CAD)#

This week we started to use softwares to create and design 3D-models. We have been presented with two different softwares : OpenSCAD which works by writing a bunch of specific commands (but still uses a GUI to show you the resulting design) and FreeCAD, where you can operate on preexisting shapes available in the menus. I myself chose to work with OpenSCAD because its handling seemed easier for beginners.

Assignment#

After learning what is a FlexLinks kit or a compliant mechanism (here are some examples), we were asked to develop one of our own.

  • It had to have a flexible part (by definition).
  • As we would have to 3D-print it the next week, it also should be designed using parameters so that it can easily and quickly be adapted. Indeed, the size and shape of the piece you actually get after the impression depends on your print-material properties.
  • Making your code parametric also helped to complete our kit with a part of another student as, for the pieces to fit together (eg : for a pin to fit inside a notch) the gap between the dimensions of the two pieces has to be tested, and we did not know beforehand if it would fit, float, or not fit in at all.
  • Our piece should also use part of one of our predecessors’ code, to teach us how to reference someone else’s work, depending on their license.
  • In the same mindset, we had to add a Creative Commons license to our own model, in adequation with the license of the person we reused part of a code (if applicable).

As funny and weird as it can sound, I found that the most difficult part of this module was to actually get a nice idea of a FlexLink to realise. After thinking quite some time about it, we (Alishba Naqi and myself) came to this idea : try and design a mouse-like (the animal) object, having a flexible tail, and constituted of two parts, assembled a bit like Legos. Those two parts are the main body, and the tail. We decided Alishba would realise the body while I would work on the tail.

OpenSCAD#

OpenSCAD works with code, you can find here the “cheat sheet” containing all of its function and links to their description.
By using the module name ( parameters ) { actions } objects you can easily define and call a part. The different pieces of parts I designed will be presented as modules. To display and render them, it is needed to call them from the main script with appropriated parameters. (The whole code calling and displaying the different modules will be shown at the end.)

1. The clasp#

We first wondered how we would connect the two parts together until we found in the class archives documentation a part design made by Morgan Tonglet, which we decided to use. You can find her part here.

I reused her “part module” and made only minor modifications such as the module name, as well as the height and position of the cylinder used to make the holes in the part. Indeed, when removing an object sharing the same surface as another, the calculated preview displays a weird-looking surface. To avoid this I simply increased the height of the cylinder used to create the holes (compared to the height of the part) and lowered the cylinder by half this increase, to remove the display issue on both upper and lower surfaces.

Here are the resulting code and design :

// Author : Louis JONAS (original work by Morgan Tonglet, accessible at : https://fablab-ulb.gitlab.io/enseignements/2022-2023/fabzero-experiments/students/morgan.tonglet/fabzero-modules/module02/#basic-part).
// Date : October 2023
// License : Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0 at : https://creativecommons.org/licenses/by-sa/4.0/)

module clasp(n_holes,h,r_in,r_ext,gap){
  translate([0,r_ext,0])
  difference(){
    //drawing the external part
    hull(){
        cylinder(h,r=r_ext);
        translate([0,(n_holes-1)*(2*r_ext+gap),0])
        cylinder(h,r=r_ext);
    }
    //removing material for holes
    union(){
      for(i=[0:n_holes-1]){
        translate([0,i*(2*r_ext+gap),-1])
        cylinder(h+2,r=r_in);
      }
    }
  }
}


2. The tail-like stem#

My first design was very simple, I just wrote the code to display a kind of long and thin rectangular parallelepiped.

cube([width, length, thickness]);

I then however wanted to try something a bit more sophisticated, and shaped a sinusoidal-like tail :

// Author : Louis JONAS
// Date : October 2023
// License : Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0 at : https://creativecommons.org/licenses/by-sa/4.0/)

adj=1; //added length to make sure the different parts do have an intersection
module stem(wanted_len, wid, thick, gap, r_mass){
    // creates a sinusoidal-shaped stem by overlapping thin cylinders next to each others and translating them according to the sin function
    $fn=10;
    rotate([0,90,0])
    for(i=[0:thick/4:wanted_len+r_mass]){
        translate([3*sin(i*(360/(wanted_len+r_mass))),i,0])
        cylinder(h=wid,d=thick);
    }

    // creates a small cylinder at the end of the stem that will be used as a link
    translate([0,wanted_len+r_mass+0.5,0])
    rotate([0,90,0])
    cylinder(h=wid,d=gap-0.2,$fn=50);
}

This module takes five parameters :

  • wanted_len : the wanted length of the stem, in a straight line (does not take into account the length of the curve)
  • wid : the width of the stem (reflected by the height of the cylinder in the code)
  • thick : the thickness of the stem (reflected by the diameter of the cylinders in the code)
  • gap and r_mass : those will be needed later on when assembling the whole part, to place this specific part at the correct position relative to the others and to ensure that the size of the piece takes into account the overlap between the parts. The second part of the module creates a small cylinder at the end of the stem that will be used as a link between the clasp part and the stem part.

However, so many cylinders take quite a long time to be rendered.

3. The whole tail#

I finally added a last module “mass” to add a small mass at the end of the tail and called all of the modules. The tail module is positioned so that it will always be centered on the clasp part, no matter the number of holes (though not placed on a hole itself if the number of holes is odd), this is reflected by the trs_tail_y parameter.

// Author : Louis JONAS
// (original work for the "module clasp" by Morgan Tonglet, accessible at : https://fablab-ulb.gitlab.io/enseignements/2022-2023/fabzero-experiments/students/morgan.tonglet/fabzero-modules/module02/#basic-part)
// Date : October 2023
// License : Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0 at : https://creativecommons.org/licenses/by-sa/4.0/)

$fn = 100;
pin_height = 6;
width = 5;
rad_in = 2.35;
rad_ext = 3.1;
rad_mass = 1;
num_holes = 2;
hole_gap = 1.60; //gap wanted between the holes
gap_calcul = hole_gap-2*(rad_ext-rad_in); //length to add to get the wanted gap
thickness = 0.3;
length = 15;
trs_tail_y = (floor(num_holes/2)*2*rad_ext)+((floor(num_holes/2)-0.5)*(hole_gap-2*(rad_ext-rad_in)));
adj = 1; //added length to make sure the different parts do have an intersection

module clasp(n_holes,h,r_in,r_ext,gap){
  //creates the lego-like clasp
  translate([0,r_ext,0])
  difference(){
    //drawing the external part
    hull(){
        cylinder(h,r=r_ext);
        translate([0,(n_holes-1)*(2*r_ext+gap),0])
        cylinder(h,r=r_ext);
    }
    //removing material for holes
    union(){
      for(i=[0:n_holes-1]){
        translate([0,i*(2*r_ext+gap),-1])
        cylinder(h+2,r=r_in);
      }
    }
  }
}

module stem(wanted_len, wid, thick, gap, r_mass){
    // creates a sinusoidal-shaped stem by overlapping thin cylinders next to each others and translating them according to the sin function
    $fn=10;
    rotate([0,90,0])
    for(i=[0:thick/4:wanted_len+r_mass]){
        translate([3*sin(i*(360/(wanted_len+r_mass))),i,0])
        cylinder(h=wid,d=thick);
    }
    // creates a small cylinder at the end of the stem that will be used as a link
    translate([0,wanted_len+r_mass+0.5,0])
    rotate([0,90,0])
    cylinder(h=wid,d=gap-0.2,$fn=50);
}

module mass(haut,rad){
    //creates a sort of mass (cylinder-shaped) at the end of the tail
    rotate([0,90,0])
    cylinder(h=haut,r=rad);
}

// main script
union(){
    union(){
        clasp(num_holes,pin_height,rad_in,rad_ext,gap_calcul);
    }
    translate([-width/2,trs_tail_y,length+rad_mass+pin_height])
    rotate([-90,0,0])
    union(){
        stem(length,width,thickness,hole_gap,rad_mass);
        mass(width,rad_mass);
    }
}

The .scad file containing this code can be found here.

4. The whole kit#

The tail is thus designed to be assembled to the main body by the clasp part. One of the extremities of the main body carries two pins, supposed to fit inside the holes of the clasp part. As I said before, this part was designed by Alishba Naqi and you can find her work here.

Here you can see the design combining the body and the tail :

The licenses#

Creative Commons licenses or CC licenses allows anyone to legally grant the grand public access to their work, under copyright law. The owner can then choose what they allow the public to do with their work. Be mindful about the fact that once emitted, a license cannot be revoked. Another important point, is that in order to apply a license on a material, you need to have the ownership of this one.

The different options are listed here :

License name Description
CC BY Allows people to do whatever1 they want with the original work, as long as they give attribution to the creator.
CC BY-SA Allows people to do whatever1 they want with the original work, as long as they give attribution to the creator and share their adaptations of the work under the same license as the creator.
CC BY-NC Allows people to do whatever1 they want with the original work, as long as they give attribution to the creator and it is not for commercial purposes.
CC BY-ND Allow people to copy and distribute the original work (but not to modify it in any way), as long as they give attribution to the creator.
CC BY-NC-SA It is a combination of both CC BY-NC and CC BY-SA.
CC BY-NC-ND It is a combination of both CC BY-NC and CC BY-ND.
CC0 This “license” enables the creator to give up their copyright, people can then do whatever they want with the work without any conditions.

You can find more about those licenses on this site.

To apply a license to your work, you just need to communicate about the license you chose for that work. That communication must be present with the work, so that people are aware of it, and should include a link to the chosen license.

As I reused part of Morgan Tonglet’s work and she used a CC BY-SA, I had to use that same license on my work, as well as cite her.


  1. By “whatever” I meant : distribute, remix, adapt and build upon.