2.- Computer-Aided Design

In this week, we will learn how to use different design tools in both 2D and 3D.

2D design

The 2D design is characterized by being made in two dimensions (height and width). 2D programs can be divided into " raster " and " vector ". In the following " link " you can find the most used tools when designing in 2D and 3D.

Inkscape

One of the reasons to use " Inkscape " is that it is a free and open-source vector graphics editor, compatible with Windows and macOS.
In this case, the objective of using this 2D tool is to make the internal region of the eye (cornea, iris and pupil) that will be part of the final project.
To begin the design flow of an eye, we start by drawing a circle using the circle tool, once done, in the work area we can change radiu in " Rx " and " Ry " as shown in the figure.

We make a smaller circle that must be centered, for that we use the "Align and distribute" tool, which is the icon shown in the figure. Pressing the icon opens another window, in which we select "center with the vertical axis" and "center with the horizontal axis".

Centered images are shown below.

The two circles are selected since it is necessary to combine them. Once selected, we enter the "path" menu and select "combine" or simply press "⌘k" for macOS users. If everything has gone well, the two circles should be part of the same selection (be a single image).

Once the two circles are combined, you need to go to the "path" menu again and select "path effects" or use the shortcut "⌘&". This opens a new window, before clicking on the effect we want on the tab we must have the image of the concentric circles selected.

Pressing the tab opens a new window, where we select "sew".

In the new window we place the number of concentric lines between the two circles and with the bind-key "⇧⌘F" or "Object - fill and border", a window opens where can be chosen the width of the concentric lines.

Once the number of concentric lines has been selected, we go to the "filters" menu where we follow the path "Distort" and "Torn Edges", there the concentric circles look as follows.

It is necessary to duplicate the layer to have two figures with the same characteristics. The advantage of working with layers is that it allows you to implement a drawing in sections so that in case of error or for edits, only the selected layer is affected.

We select the figure from layer 1, and rotate it 90 degrees ("Object" route - Rotate 90°), we can use the bind-keys "⌘]" or "⌘[", the objective of rotating is that the figures are out of phase.

When the figures have already been phase shifted, it is necessary to add color to the lines, it is recommended to choose an eye color. From the color palette it is suggested to choose a light color in layer 1 and in layer two the desired eye color.

Since it is necessary to add the background of the eye, another layer can be created where a circle is made concentric to the previous ones, but slightly larger than them. This new circle is filled with the same color palette with the same eye color but in a dark tone. We can apply a blur to the stroke to add realism to the eye.

Finally, in a new layer you can create two circles that will represent the brightness of the eye. These circles must have a blur and opacity determined according to the designer's criteria.
The final eye is shown below.

All applied layers and their position are shown in the following figure. It is suggested to place a layer name that describes its function.

In the following link you can download the image.

Eye file.svg

GIMP

GIMP is an Open Source Image Editor. It is available for GNU/Linux, macOS, Windows and more operating systems. It was decided to work with GIMP, since we were looking to edit the image of eyebrows . The feature of GIMP is that the workflow is similar to "photoshop".

To begin, we open a new file "⌘N" (macOS users), which displays a new window where we must describe the characteristics of the work area such as the size of the image (width and height) or simply select one of the templates suggested. Another important point is "Fill with" where it is suggested to place "Transparency", since the aim is to leave only the eyebrows without any background.

Performing the previous steps creates a new layer with a transparent background.

Now, we need to insert an image, for that we go to the menu "File - Open as layers" or simply "⌥⌘O", it is done this way to separate the background from the image.

In our case, the image was smaller than the work area, so we can use the "crop tool (⇧C)" to adjust to the size of our image and with "enter" the cut is made.

Now, we need to select the eyebrows, for that we must use the selection tool, although there are many tools, for this task the "Foreground Selection" was chosen. Once the tool is selected, we continue to contour the eyebrow. When the contour has been made, we can notice that the selection is not perfect, however, one of the characteristics of the tool is that with a pencil you can select the eyebrow tones that you want to include. With the pencil you can choose the "stroke width" option and make the selection finer.

Once we achieve the desired contour, press "enter" and the selection will be made.

To finish, invert the selection in the "Select - Invert" menu or using "⌘I".

Once the selection is inverted, click delete and only the eyebrows are obtained.

In the following link you can download the image.

eyebrow.xcf


3d design

The characteristic of 3D design is that it allows objects to be represented in 3 dimensions (length, width and height). In the following sections, two tools will be used in 3D design ("Onshape" and "SolidWorks"), in which pieces that could be part of the "final project" will be made.

Onshape

Onshape is "not open source" software, however, the fact that you do not need to install any software on your computer makes it a very interesting option since you can work from any computer just by having an active account and an internet connection.

To begin, we enter the following " Onshape link " , where we register. Once inside, we select "Create" and "Document...” and write a representative name.

The above opens our work area; In the image below you can see the different elements that make it up.

We select a plane (Front) with the help of our views and select "Sketch", which opens the drawing tools.

Before starting to use the tool, it should be emphasized that following the objectives of the proposed project (animatronic), we want to design a contour of springs around the mouth that allow to emulate the natural movement of the lips. For this, a first design is made, which consists of drawing the contour of the lips, placing concentric circles, which will serve to fix the structure created with the mandible (corner of the lips), and with servomotors that will be used to generate the movement.
To create the lines, press “Line” or “L”, and to create the circles "Center point circle" or "c". Finally, to have the correct dimensions, it is important to use the "Dimension" or "d" tool which helps us dimension.

Once the periphery is made, it is necessary to give it depth, for this we select "Extrude (shift+e)", which opens a new window where it allows us to select the areas we want to extrude and their depth. Doing this shows the changes automatically. If we agree, we accept the changes so that they apply.

The next step would be to make cuts that allow the structure to work like a spring, for that we select the view in which we are working "Front", once the view is selected, click the "Sketch" option and with "Line" we make triangles. When all the triangles are ready, we click accept.

The final step is to remove the triangles that were sketched, so "Extrude" is used again. In the dialog box that opens we select "Remove", we indicate the depth that will be removed from the material, and we must select all the places that we want to remove, ensuring that the contours are completely closed.

The final piece is shown below.

In the following link you can see the file.

Spring

Onshape is an intuitive tool, with a good workflow and portable; The only negative point is that it depends on a good internet connection.




SolidWorks

SolidWorks is one of the most powerful and most popular tools in engineering when creating 3D CAD designs. SolidWorks is not only used to make designs, but it also allows you to make:

  • Simulations
  • Assemblies
  • Animations
  • Render

SolidWorks will be an essential tool when carrying out the "final project", since all the mechanical parts and pieces will be designed with this tool.

The objective of this section is to render a part, for that the model of a jaw is downloaded from the network.

We will select "appearance" in case of giving color to the object so that it looks more realistic.

This opens a new window with different appearances that can be worked with.

A material is selected, and the appearance of the piece is chosen. That selection, without releasing it, is dragged to the area of the piece where you want to provide those characteristics. When you release on the piece, a new menu is displayed, in which you must select where you want the changes to be made (in the entire material or in certain parts of it).

Once the above is done, the piece has the selected appearance.

The next step is to render the piece, for that we must have "Visualize" in our bar, if it does not appear, it is necessary to enter the Options menu and select "Add - Ins". This displays a new window in which we can select "SOLIDWORKS Visualize".

Now the "Visualize" tab should appear in the bar, we select it and click on "Export simple".

This should open the renderer, in which our piece will be displayed, with green, blue and red lines that indicate the orientation in the "x", "y" and "z" axes.

To make the piece look realistic, you can change the type of lighting and modify the characteristics of the material that was previously placed in SolidWorks.

Once all the changes have been made and the piece has been placed in the desired orientation, the next thing is to render the piece. To do this, press the icon shown in the figure.

The above opens the "Render Wizard", where we must select the type of rendering and its quality, when finished we press "Next". Then it opens "Media", where it asks us for the "Format" of the image. The following options are "Size" which asks us for the size of the image and resolution, "Quality" which asks us for the quality of the "Render", and finally "Output", in which we must give a name and the location where it will be will save the Render.

By doing all the previous steps, the piece has been rendered. All that remains is to save it and the result is shown below.

SolidWorks is a very powerful tool, with a user-friendly workflow. One of the advantages of working with SolidWorks is that there is a lot of information and tutorials on the Internet, which makes it easier to implement what you want to design.




Image and video compression

Image

One of the easiest ways to reduce the size of images is through the following " link "page.

When the images have been placed, the program begins to compress them automatically, making reductions in some cases above "80%".

If all the images have been compressed, press " Download all images", which downloads all the images in a ".zip"



Video

In the case of the macOS operating system, it is necessary to install "Homebrew". For that it is necessary to open the following link , where you must press the button shown in the image and paste it into the terminal.

When the thermal installation is carried out, it is necessary to execute the following instructions in the terminal.

  • brew install ffmpeg
  • ffmpeg -version

When you finish executing the instructions, it is now possible to perform video compressions. Below are some examples of compression instructions.

  • Compress video ffmpeg -i input.mp4 -vcodec libx264 -crf 28 output.mp4
  • Compresses video and reduces resolution ffmpeg -i video.mov -vf scale=1280:720 -vcodec libx264 -crf 28 output_720p.mp4
  • Compresses the video and removes the audio ffmpeg -i video.mov -vcodec libx264 -crf 28 -an output_noaudio.mp4
  • Increase video speed and removes the audio ffmpeg -i video.mov -r 16 -an -filter:v "setpts=0.25*PTS" salida.mp4

In the following link you can see a tutorial in Spanish with explanations of the different commands.

Tutorial in spanish
Transloadit

Learning outcome

This week we learned the use of 2D and 3D design tools, emphasizing the differences between them, their scope and their different applications. On the other hand, image and video compression methods were used, such as websites and “Homebrew” through “ terminal”, respectively.