Skip to content

02 : Computer Aided Design#

1. Summary#

Hero Shot#
Learning Outcomes#

What did I learn this week ?

  • Subject 1 :
    • 1
    • 2
  • Subject 2 :
    • 1
    • 2
  • Subject 3
    • 1
    • 2
Lecture Content#

This second class is about design and more specifically Computer Aided Design ("CAD").

Sophia Brueckner is a former software engineer that converted into an artist. She reads a lot of science fiction novels and makes object inspired by science fiction technologies.

Kenny Cheung is an architect working on spatial infrastructure (how to build large infrastructure with other gravity conditions)

Each one of them gave us a part of the CAD course and their slides are available here.

Sophia's main advice : Each one of the CAD tool has its strengths and weaknesses. Choose your CAD tool depending on your project as you would choose an artistic medium. You might use multiple types of CAD for your project.

Boolean Operations and how they allow one to make complex shapes using simple ones.

You can use grayscale raster image as a heightmap to generate 3D models.

You can scan a drawing and convert it into a vector image.

Ways to make 3D shapes from less dimension shapes :

  • Start with 2D shape and extrude (even from a 3D object face)
  • Start with 2D shape and revolve
  • Start with 1D shape and sweep

You can measure stuff in CAD software.

Ways to make 2D shapes from 3D shapes :

  • Projection
  • Cross Section

Rendering process consists in giving some physical properties and simulate how light interacts with your model.

Tools to make 2D/3D shapes from scratch :

  • Constraints
  • Assemblies
  • Parametric Design
  • Generative Design

Agent-based Modeling

Interchange Formats

2. Assignment#

This second week's asignments are :

  • Model (raster, vector, 2D, 3D, render, animate, simulate, ...) a possible part of your final project
  • Compress your images and videos
  • Post a description with your design files on your class page

Below you will find the achievement of the latter.

Peristaltic Pump Modeling#

Insipiration#

After doing some reasearch about easy to make and control pump for my final-project, I found a lot of tutorials for building controlled peristaltic pumps using 3D printing and Arduino controller.

Here is an excerpt of the Wikipedia definition of peristaltic pumps :

A peristaltic pump, also commonly known as a roller pump, is a type of positive displacement pump used for pumping a variety of fluids. The fluid is contained in a flexible tube fitted inside a circular pump casing. Most peristaltic pumps work through rotary motion, though linear peristaltic pumps have also been made. The rotor has a number of "wipers" or "rollers" attached to its external circumference, which compress the flexible tube as they rotate by. The part of the tube under compression is closed, forcing the fluid to move through the tube. Additionally, as the tube opens to its natural state after the rollers pass, more fluid is drawn into the tube.

and an excerpt of a DIY peristaltic pump tutorial showing the working principle :

DIY Peristaltic Pump

For this second assignment, I will model the central part of the pump that attach the compressing rollers together and to the rotor's axis. The .stl files of tutorial are available here so I will first download the central part file and open it in a CAD software to understand how it is made. I will first use OpenScad because for now it is the only one I know.

In OpenScad, if you want to open an .stl file you have to run the following command :

import("example.stl")

And so I can see how it has been modeled :

Roto STL

My goal for this second week will be to reproduce this model with different softwares.

Parametric Inkscape Modeling#

I would like to start with 2D modeling. I already know how to use Inkscape however I think it does not support parametric drawing by default. I know parametric modeling is not mandatory for this assigment but it is highly recommended since we will do computer controlled cutting next week. Therefore I looked for extensions that allows parametric drawing in Inkscape and I found Simple Inkscape Scripting that converts Python scripts into svg files.

Extension Installation#

To install the extension, I followed the instructions that can be found on the extenstion repository.

You first have to identify your Inkscape extension directory. The easiest way is to open Inkscape and go to Edit > Preferences > System > User Extensions Field. There you will find the directory.

Once you know the directory, open a terminal in it and clone the extension repository by running :

git clone https://github.com/spakin/SimpInkScr.git

To test your installation, restart Inkscape and go to Extensions > Render > Simple Inkscape Scripting…. It should open a window that gives you the option to enter a filename for a Python script or to directly write Python code. Try entering the following Python lines :

circle((100, 100), 50)

and click Apply. You should now see a black circle of radius 50 at position (100,100).

Clear function definition#

The extension adds something to your .svg file each time you apply your code. However, I would like that my code generates something that replaces what is already on the file.

Therefore I defined a clear() function to easily get back to a blank sheet :

def clear():
for obj in all_shapes():
    obj.remove()
Rotor Modeling#

I wrote this code :

Python Code in Inkscape
import numpy as np

def clear():
    for obj in all_shapes():
        obj.remove()

def triangle(center,length,color):
    height = length*np.sqrt(3)/2
    rad = height
    S2=center+rad*np.array([-np.cos(np.pi/6),np.sin(np.pi/6)])
    S1=center+rad*np.array([0,-1])
    S3=center+rad*np.array([np.cos(np.pi/6),np.sin(np.pi/6)])

    return polygon([(S1[0],S1[1]),(S2[0],S2[1]),(S3[0],S3[1])], fill=color), S1, S2, S3

def struct(center, length,hole_rad,contour_width,chole_rad,wheel_rad):
    color1='#55ddff'
    color2='#ff5555'
    color3='#800080'

    height = length*np.sqrt(3)/2

    t, s1, s2, s3= triangle(center,length,color2)
    t=t.to_path()

    att1=circle((s1[0],s1[1]+2*hole_rad),hole_rad, fill=color1).to_path()
    contour1=circle((s1[0],s1[1]+2*hole_rad),hole_rad+max(3,contour_width), fill=color2).to_path()

    att2=circle((s2[0]+2*hole_rad*np.cos(np.pi/6),s2[1]-2*hole_rad*np.sin(np.pi/6)),hole_rad, fill=color1).to_path()
    contour2=circle((s2[0]+2*hole_rad*np.cos(np.pi/6),s2[1]-2*hole_rad*np.sin(np.pi/6)),hole_rad+max(3,contour_width), fill=color2).to_path()

    att3=circle((s3[0]-2*hole_rad*np.cos(np.pi/6),s3[1]-2*hole_rad*np.sin(np.pi/6)),hole_rad, fill=color1).to_path()
    contour3=circle((s3[0]-2*hole_rad*np.cos(np.pi/6),s3[1]-2*hole_rad*np.sin(np.pi/6)),hole_rad+max(3,contour_width), fill=color2).to_path()

    chole=circle((center[0],center[1]),chole_rad).to_path()

    Struct=t+contour1+contour2+contour3-chole

    ct=triangle(center,2*(chole_rad+1)/np.tan(np.pi/6),color3)[0].to_path()
    wheel1 = circle((s1[0],s1[1]+2*hole_rad),wheel_rad).to_path()
    wheel2 = circle((s2[0]+2*hole_rad*np.cos(np.pi/6),s2[1]-2*hole_rad*np.sin(np.pi/6)),wheel_rad).to_path()
    wheel3 = circle((s3[0]-2*hole_rad*np.cos(np.pi/6),s3[1]-2*hole_rad*np.sin(np.pi/6)),wheel_rad).to_path()
    chole=circle((center[0],center[1]),chole_rad).to_path()

    cStruct=ct-wheel1-wheel2-wheel3-chole


clear()

chole_rad=2
wheel_rad=12
hole_rad=3
contour_width=4
center=[50,50]
length = 25

style(stroke='none')
struct(center, length,hole_rad,contour_width,chole_rad,wheel_rad)

that generates :

Rotor SVG

OpenSCAD#

Here is my code

r=35;
n=3;
thickness=5;

r_a=5;
h_a=15;

r_w=4*r_a;

r_s=2*r_a;

angles=[ for (i = [0:n-1]) i*(360/n) ];
coords=[ for (th=angles) [r*cos(th), r*sin(th)] ]; 

module struct(){
union(){
linear_extrude(height=thickness)
polygon(coords);
for (i=[0:n-1]){
    translate(coords[i]*(r-2*r_a)/r){
    translate([0,0,h_a/2])
    cylinder(h=h_a,r=r_a,center=true);
    translate([0,0,thickness/2])
    cylinder(h=thickness,r=r_s,center=true);
    }
}
}
}


module centre(){
difference(){

scale([0.3,0.3])
linear_extrude(height=2*thickness)
polygon(coords);
union(){
    for (i=[0:n-1]){
    translate(coords[i]*(r-2*r_a)/r){
    cylinder(h=2*thickness,r=r_w,center=false);
    }
}
}
}
}

difference(){
union(){
    struct();
    centre();
}
    cylinder(h=2*thickness,r=3,center=false);
}

that generates for n=3,4,5, 6:

n=3 n=4

n=5 n=6

Media Compressing#

Image Magick#

For image compressing and format converting, I use ImageMagick.

From video file to Gif#

To cut a video and generate a Gif I used the Windows tool.

https://www.freeconvert.com/gif-compressor