Skip to content

Week 2. Computer Aided design

Choosing Softwares

During this week, I will try to learn new 2D and 3D software for myself. There are several programs that I know very well since I have been working with them for a long time — Fusion 360, PTC Creo, AutoCAD, and CorelDRAW. Ultimately, for designing the submarine, I will use Fusion 360 because it is very convenient to use.

After Neil’s lecture, I chose several softwares to learn:

Compressing Files

I talked about compressing files in my first week, so you can check it by following this link.

2D Softwares.

Inkscape.

What is Inkscape ?

Inkscape is a Free and open source vector graphics editor for GNU/Linux, Windows and macOS. It offers a rich set of features and is widely used for both artistic and technical illustrations such as cartoons, clip art, logos, typography, diagramming and flowcharting. It uses vector graphics to allow for sharp printouts and renderings at unlimited resolution and is not bound to a fixed number of pixels like raster graphics. Inkscape uses the standardized SVG file format as its main format, which is supported by many other applications including web browsers.

Changing icon sizes

alt text

When I opened Inkscape, the toolbox and control icon sizes were very small. I decided to share how to make them bigger—maybe someone will find this information useful.

Go to Edit > Preferences > Interface > Toolbars and change the Toolbox and icon sizes. alt text

Now Looks better 😊

alt text

Exploring tools

Drawing Objects

On the Inkscape website, I found the “Learn” section and started exploring the program. Let’s quickly go through the toolbox!

On the right side you can see the Toolbox icons, that icons are creating shapes , modifying , measuring and etc.
I drew a square to show everything in more detail.

alt text

At the top of the toolbox, when you select “Create some shape,” the parameters for that shape appear. In my case, I created a square and set the following options.

W (Width) = 50mm

H (Height) = 50mm 

Rx (Radius by X axis) = 10mm

Ry (Radius by Y axis) = 10mm
Moving Objects

For moving object by coordinates u need to select Selector Tool or use hotkey S. By selecting object, on the top side you can see current position of object. By changing values (X and Y) you can easily move object by coordinates.You can also freely move your object by selecting it and dragging it while holding the left click. On the right side you can also Mirror and Rotate your object.

alt text

Fill and Strokes

On the right side you can see the additional options of object. There is Fill and Stroke. alt text By clicking on the object, it gets activated, and here you can modify various settings like Unfill, Fill, Change color, Make wall thickness, and other options.

Union, Difference, Intersection, Exclusion, Division

Going to the Path section, you can find all the path tools.

I drew another square, and let’s try making these modifications with it. alt text

Let’s try to make a union, difference, intersection, and division by selecting two objects.

Image of Union. alt text

Image of Difference. alt text

Image of Intersection. alt text

Image of Exclusion. alt text

Image of Division. alt text

Layers and Objects

A very useful thing is manipulating objects in layers. You can find it on the left side of screen. alt text

This is image were I changed layers of two squares.

alt text

If you noticed, the black square was in the background and the green one was in the foreground. If you switch their places in the “Layers” section, they will switch positions. Now, I can show you the difference by using the Difference path operation.

alt text

As you can see, the interaction has now been inverted.That’s why it’s important to use layers.

Drawing Submarine

After learning the basic tools, I started drawing my final project’s sketch.

GIMP

What is GIMP ?

“GIMP is the GNU Image Manipulation Program. It is used to edit and manipulate images. It can load and save a variety of image formats and can be used to convert between formats.
GIMP can also be used as a paint program. It features a set of drawing and painting tools such as airbrush, clone, pencil, and paint brush. Painting and drawing tools can be applied to an image with a variety of paint modes. It also offers an extensive array of selection tools like rectangle, ellipse, fuzzy select, bezier select, intelligent scissors, and select by color.”

This text is taken from the GIMP website, which are free of charge to use.

Making Icon From Image

Since I work at Fab Lab Dilijan, Armenia, I want to add our logo to my website. Now I will try to do it using GIMP.

alt text I have a logo in PNG format with a white background. Now I will try to make it transparent and remove some elements.

First, I opened GIMP and uploaded an image.

alt text

Then, I created a new transparent layer.

alt text

I used the Paintbrush Tool to remove the text and leave only the objects.

alt text

Here’s how it looks.



After removing the text, I used the Bucket Fill Tool to delete the background.

alt text

Here is the result.

alt text

I decided to use the Crop tool to reduce the background size around the objects.

alt text

Voilà!

alt text

Now, I just need to export the file and add it to the code.

alt text

Changing code.

alt text

Tadaaam! 🎉

alt text

3D Softwares

OpenSCAD

What is OpenSCAD ?

OpenSCAD is software for creating solid 3D CAD models. It is free software and available for Linux/UNIX, Windows and Mac OS X. Unlike most free software for creating 3D models (such as Blender) it does not focus on the artistic aspects of 3D modelling but instead on the CAD aspects. Thus it might be the application you are looking for when you are planning to create 3D models of machine parts but pretty sure is not what you are looking for when you are more interested in creating computer-animated movies.

On the OpenSCAD website, in the Documentation section, I found books for Programming with OpenSCAD, and I’d like to share them with you. There is also a video playlist that really helps to quickly learn the program.

Overview of the OpenSCAD Interface and Controls

I want to quickly share some information about the interface and what you need to know to start writing code.
The program is mainly divided into 3 main parts:

  • On the left side – the editor
  • On the right side – the previewer
  • On the bottom side – the console and error log

alt text
Interaction with files happens using these buttons.

alt text
With these buttons, I can easily preview my code, render, export as STL, and send to print.
Every time you press Preview to see your model, the program compiles your design, and you can see the process in the console.

alt text
If there is an error in your code, the console will notify you, and you will see the error message in the error log.

alt text

Coding Primitive Solids

While watching the tutorial, I found a website with the OpenSCAD User Manual, which made coding much easier for me. Let me introduce some codes for primitive solids.

Cube
cube([10,20,30],center=true);

alt text
As you can see, we created a cube with dimensions 10, 20, and 30 mm.
Let’s take a closer look at the syntax.

alt text

  • cube() – This is the name of the solid.
  • [10, 20, 30]- These are the dimensions of the cube in relation to the X, Y, Z axes. This means X = 10mm, Y = 20mm, and Z = 30mm.
  • center=true - This means the center of the solid will be at the center of the coordinate system, where all coordinates are equal to zero.
Sphere
sphere(r=10);

alt text
As we can see, I drew a sphere with a radius of 10mm, and it is automatically placed at the center. From geometry, we know that the diameter is equal to 2 * radius, so instead of writing r=10, we can write d=20.

There are very important parameters for sphere and cylinder: $fn and $fa.

  • $fn is the number of fragments (or facets) used to approximate the shape. The higher the value of $fn, the smoother the sphere or cylinder will appear, but it will take more computational resources.

  • $fa describes the maximum angle (in degrees) between adjacent faces. A smaller value for $fa results in smoother surfaces, as the faces will be more closely aligned, but it also increases the number of facets and complexity.

alt text

As you can see, the sphere became smoother due to more faces.

Cylinder(Cone, Pyramid, Pentagon)
cylinder(h=50,r=10);

alt text

I wrote the code for a regular cylinder where:

  • h=50 – the height of the cylinder is 50mm.
  • r=10 – the radius of the cylinder is 10mm.

Using the cylinder, we can create a pentagon, pyramid, cone, and truncated cone or pyramid.
By changing r to r1 and adding r2 in the code, we can modify the top and bottom radii.

Cone and Truncated Cone
cylinder(h=50,r1=10,r2=0);

Result: alt text

We got a cone because r2 is currently set to zero. If we change r2 to another value, we will get a truncated cone.Here is an example:

cylinder(h=50,r1=10,r2=5);

Result:

alt text

Pyramid and Truncated Pyramid

To create a pyramid, you just need to change the number of faces in the cone using the $fn parameter.

cylinder(h=50,r1=10,r2=5,$fn=4);

I don’t know how it works, but in the case of a pyramid, r1 equals the diameter. 😄

alt text


By changing $fn we can get polygonal base pyramid.I also will change r2=0 to r2=5 to show Truncated polygonal base pyramid

cylinder(h=50,r1=10,r2=5,$fn=6);

Result:
alt text

Pentagon

To create a pentagon, we just need to change the number of faces in the cylinder.For that we will use $fn=5.

cylinder(h=50,r=40,$fn=5)

Result:
alt text

It becomes clear that to get a hexagon, we need to set $fn=6, for heptagon $fn=7 etc.

Moving and Rotating Objects

Moving Objects

To move objects, we need to use the translate parameter and write it before the object code.

translate([X,Y,Z])

This is example if we want to move cube to 10mm by X axis:

translate([10,0,0])
cube(10,20,30);

alt text

Rotating Objects

To move objects, we need to use the rotate parameter and write it before the object code.

rotate([X,Y,Z])

Here is an example if we want to rotate the cube by 45 degrees around the Z-axis:

rotate([0,0,45])
cube(10,20,30);

alt text

Important Note!!

Since the compiler works line by line, you need to understand that if you use move and rotate simultaneously for an object, then the object will first be moved and then rotated, or vice versa, depending on the order in the code. The operations will apply sequentially, so the final position and orientation of the object will depend on how you sequence the commands.

Here is an example:

alt text

As you can see in the first image, I first moved the cube by 10mm and then rotated it by 45 degrees. In the second image, I first rotated the cube by 45 degrees and then moved it. As you can see from the images, the object is not in the same place, which is very logical because the order of operations affects the final result.

Coding Submarine

After learning how to create simple objects, I started designing the submarine.

This is the final code for my submarine.

    rotate([0,90,0])
    translate([-40,0,0])
    cylinder(h=245, d = 80,$fn=300);

    rotate([0,90,0])
    translate([-40,0,245])
    cylinder(h=100, d1=80,d2 = 25,$fn=300);

    rotate([0,270,0])
    translate([40,0,0])
    cylinder(h=18, d1=80,d2=75, $fn=300);

    translate([-10,0,40])
    sphere(d=76.51,$fn=300);

    translate([25,-17.5,75])
    rotate([90,0,180])
    linear_extrude(height=35) { 
        polygon(points=[[0,0], [30,0], [0,20]]);
    }
    translate([110,0,85])
    cube([170,35,20], center=true);

    translate([195,17.5,75])
    rotate([90,0,0])
    linear_extrude(height=35) { 
        polygon(points=[[0,0], [50,0], [0,20]]); 
    }

    translate([60,0,95])
    cylinder(h=30,d=15,$fn=300);

    translate([110,0,95])
    cylinder(h=30,d=10,$fn=300);


    translate([60,7.5,95])
    rotate([0,0,-90])
    linear_extrude(height=30) { 
        polygon(points=[
            [0, 0],    
            [15, 0],   
            [12.5, 50], 
            [2.5, 50]   
        ]);
    }
    module wing(span=100, thickness=10, depth=30) {
        linear_extrude(height=span) {
            polygon(points=[
                [0, 0],
                [depth * 0.8, thickness * 0.5], 
                [depth, thickness * 0.1],    
                [depth, -thickness * 0.1],   
                [depth * 0.8, -thickness * 0.5], 
                [0, -thickness * 0.2]
            ]);
        }
    }

    rotate([90,0,0])
    translate([270,40,-70])
    wing(140, 5, 25);

    rotate([0,0,0])
    translate([260,0,-30])
    wing(60, 5, 25);

    rotate([90,0,0])
    translate([30,82,-50])
    wing(100, 2.5, 20);



3D Model

After coding the submarine, I uploaded my STL file to Sketchfab to share the 3D model.



Rendering in Blender

Since I have the STL file of the submarine, I decided to try render in Blender. Our Blender guru, Elen, helped me. 😊

First, I imported the file.

alt text

Now i need to add material. For this, we need to split viewport and one of windows change to Shader Editor.

alt text

Then go to Material, and press the New button.

alt text

Here is all parameters for material.

alt text

The alternative way to add the material is setting the image texture. We can go to add and search Image Texture.

alt text

Now we can connect color to base color.

alt text

To Add Image texture we need to click open and select image.

alt text

I downloaded texture image from Polyhaven page.When I download the file there was also displacement and roughness files. It usually using to get more realistic quality. Now I want to add also displacement and start rendering!!

To add displacement we need to add another image texture block, there is hotkey Ctrl + D to duplicate it. After duplicating we opening displacement file and connecting color to material output.

alt text

I want to show you what a big difference there is with and without displacement.

alt text

Before render We need to add Lights and set Camera position. Lets Set Camera

alt text

After Setting Camera I set 3 lights and set light options.

alt text

In the render section, there is a “Film” option, and inside it, a “Transparent” function. I selected this to get a contour PNG file without a background.

alt text

Following Elen’s advice, I selected the Cycles render engine and reduced the Max Samples to 200 because my laptop is not powerful enough.

alt text

Now, after pressing F12, the rendering will start!!

Result:

alt text

Last steps

After doing all this, I couldn’t resist and decided to 3D print my file! Haha 😆

alt text

And put it in the water. 😆

alt text

Conclusion

Learning new programs is quite interesting for me, but OpenSCAD was the most exciting because it was fun to write the object code. For my final project, I decided to use Autodesk Fusion 360 because I understand that my project is quite complex, and I know Fusion very well. It will help me quickly model parts.

Files of this Week


Last update: February 6, 2025