Skip to content

Week 02. Computer-Aided Design

Exercise for this week;

  • Model (raster, vector, 2D, 3D, render, animate, simulate, …) a possible final project, compress your images and videos, and post it on your class page.

Disclaimer: All the Assignments and Documentations are done and written by me, however after writing it myself, some I pass it through chatGPT to fix my language and grammar.

Types of Designs:

  • 2D Design: Primarily used for creation of images or objects in two dimensions – length and width, with no depth. Examples of free 2D design software include:

  • 3D Design: 3D design involves creating objects or scenes that have three dimensions – length, width, and depth. They can be viewed from different angles, rotated, and manipulated in a virtual space. Examples of 3D design software:

2D Design

  • Raster Images:

    • Usually in format such as JPG, PNG, GIF, TIFF, BMP.
    • Output of digital cameras and most graphics editing software.
    • Composed of pixels, forming a grid of colored rectangular dots.
    • High resolution allows fine control over color and shape.
    • Millions of colors for realistic appearance.
    • Quality declines with manipulation; resizing may cause pixelation or blurring.

image from google

  • Vector Images:

    • Created with vector graphics software (e.g., Inkscape).
    • Uses mathematically-defined lines and curves instead of dots.
    • Lines can be joined to form larger objects with individual styles.
    • Maintains sharpness regardless of size changes; no loss of quality.
    • Versatile for different image sizes; consistent sharpness and colors.
    • Proprietary file formats for various applications (fonts, CAD, etc.).
    • Potential for a too-clean, artificial look in “realistic” drawings.

Inkscape:

  • Usage: Inkscape is a vector graphics editor used for creating and editing vector-based illustrations and graphics.
  • Features: It provides tools for drawing shapes, paths, text, and manipulating objects.

Installing Inkscape on Windows

  1. Downloading and installing directly from Inkscape website’s download page for Windows.
  2. Choose the installation method (exe, msi, archive) and wait for the download to complete.
  3. Click on the downloaded file to initiate the installation process.
  4. Respond to any User Account Control pop-ups by clicking “OK.”
  5. The installer will start, attempting to switch to your system language; click “Next” on the welcome screen.
  6. Click “Install” to begin the installation process and monitor the progress bar for component installation.
  7. Once complete, click “Finish” to finalize the Inkscape installation.

Interface Areas

image source

  1. Menu Bar: Located at the top, it provides general and Inkscape-specific menu options for file management and editing.
  2. Tool Controls Bar: Positioned just below, it adjusts based on the selected tool, displaying customizable options for the active tool.
  3. Toolbox: On the left side, it houses main drawing tools for creating and editing shapes, including zoom functions.
  4. Canvas:The large blank area where image editing takes place, with a white rectangle representing the visible page area.
  5. Commands Bar: On the right, it offers quick access to commonly used commands, accessible via dropdown menus with additional options.
  6. Snap Controls: Located in the top right corner, it provides access to snap settings, including the ability to deactivate snapping with the magnet symbol.
  7. Rulers and Scrollbars: Rulers aid in grid and guideline placement; scrollbars on the right and bottom enable canvas navigation.
  8. Color Palette: Near the bottom, it allows users to change the fill color of objects, contributing to design customization.
  9. Status Bar: At the very bottom, it provides essential information such as selected object colors, cursor coordinates, zoom level, and page rotation. Also, displays helpful texts for troubleshooting.
  10. Page area: It is typically depicted as a white rectangle and serves as a visual reference for the boundaries of the document.

To convert a raster image to a vector format using Inkscape, follow these steps:

  1. Begin by going to New document and importing the raster image in PNG format using the “File” menu.
  2. With the image selected, access the “Path” function and choose “Trace Bitmaps.”
  3. During vectorization, utilize three functions—brightness, border, or color—available within the Trace Bitmap tool. Each function provides a different approach to creating vectors.
  4. Adjust the threshold settings to influence the definition of the vector lines. A higher threshold value results in a more defined vector, offering flexibility in the level of detail.
  5. Choose “Single Scan” for monochrome images and “Multiple Scan” for colored images, based on the nature of your raster image.
  6. Fine-tune the Brightness cutoff to control the thickness of the vector lines, ensuring the desired visual outcome.
  7. Click “Apply” once satisfied with the editing and tracing adjustments.
  8. Preserve the aspect ratio by clicking the lock icon.
  9. Set the width (W) to 210 mm for A4 size or adjust according to your specific requirements.
  10. Verify sizing through “Document Properties” and resize the page to match the drawing.
  11. After adjusting parameters for white space, click “Resize page to drawing” again.
  12. Save the file in the designated folder.

Boolean operations in Inkscape:

Some common Inkscape boolean operation includes:

  1. Union: go to Path > Union to combine them into a single shape.
  2. Difference: Path > Difference to subtract the top most path from the one beneath it.
  3. Intersection: Path > Intersection to keep only the overlapping areas of the selected paths.
  4. Exclusion: Path > Exclusion to create a shape excluding the overlapping areas of the selected paths.
  5. For some common use cases, the Path menu also contains a few commands that combine multiple basic, Fracture: fractures a set of overlapping paths along every line in any path.

GIMP:

GIMP definition generated from chatGPT

GIMP which stands for GNU Image Manipulation Program, is a free software for editing images which can be used for tasks like drawing, retouching photos, and creating graphics.

GIMP user interface

khorlo image from here

When you open GIMP for the first time, it shows user interface:

  1. Main Toolbox:

    • Icon buttons for tool selection.
    • Displays foreground and background colors.
    • Customizable with additional items like brushes and patterns.
  2. Tool Options:

    • Located below the main Toolbox.
    • Displays options for the currently selected tool.
  3. Image Windows:

    • Separate window for each open image.
    • Allows for multiple open images simultaneously.
    • Includes the main menu for commands (File, Edit, Select, etc.).
  4. Brushes, Patterns, Fonts Dock:

    • Dock with tabs for brushes, patterns, fonts, and document history.
    • Brushes tab shows the type of brush used by paint tools.
  5. Layers, Channels, Paths:

    • Docked dialog below brushes dialog.
    • Tabs for managing layers, channels, and paths.
    • Essential for handling multiple layers in GIMP.

Image compression

XnConvert:

XnConvert is a open source tool and supports a wide range of image formats and provides various options for manipulating images.

To work on with XnConvert:

  • Open XnConvert
  • Add the images you want to compress
  • Choose the output format and set compression options
  • Adjust quality settings to find a balance between file size and visual quality
  • Click “Convert” to apply the compression.
  • Make sure to check the directory where it will saved and also whether to delete original or not.

ImageMagick:

Software suite to create, edit, compose, or convert bitmap images.

How to use for compression:

  • Open a command-line interface or a front-end interface for ImageMagick.
  • Use the convert command with appropriate options to compress images.
  • Common options include setting quality, resizing, or applying specific compression algorithms.
  • Example command: convert input.jpg -quality 80% output.jpg

Video Compression

Video compression with FFmpeg

ffmpeg commands and explainations are generated from chatGPT

  1. First FFmpeg Download and follow this Youtube Tutorial.
  2. Next open terminal on your computer.
  3. Go to Video’s Directory and use the cd command to move to the directory where your video is located.
  4. Compression Command: ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac -b:a 128k output_compressed.mp4
    • Explanation:
    • -i input.mp4: Specifies the input video file.
    • -c:v libx264: Sets the video codec to H.264, a commonly used codec for compression.
    • -crf 23: Adjusts the video quality. Lower values (e.g., 18) result in higher quality but larger file sizes.
    • -c:a aac -b:a 128k: Sets the audio codec to AAC with a bitrate of 128 kbps.
    • output_compressed.mp4: Specifies the name of the compressed output file.
  5. Execute the Command: Press Enter to run the command. FFmpeg will start compressing the video.
  6. Check the Result: Once the process completes, check the compressed video in the same directory.

Here’s the FFMPEG Cheatsheet

Honestly, getting FFmpeg on my laptop is like trying to teach a cat to juggle – a few too many steps, a bit of confusion , and my laptop’s protest sounds like it’s auditioning for a heavy metal band.

3D Design

SolidWork

I have successfully created individual parts, assembled them into a cohesive unit, and developed an animation using SolidWorks for final project electronics enclosure.

EnclosureBottom Part

  • Start with a sketch and use the Boss-Extrude feature to create a 3D solid by extruding the sketch in the specified direction.
  • Create another sketch or use the existing geometry and apply the Cut-Extrude feature to remove material from the existing 3D solid.
  • Apply a fillet to round or soften edges or corners on model.

  • Create a new sketch or modify an existing one and use Boss-Extrude to add material as shown below.
  • Rememeber to select pariticular flat face where you want to do sketch.

  • I applied material ABS because ABS is a commonly used filament for electronic enclosures due to its strength, durability, and ability to withstand higher temperatures. It also has a high level of impact resistance and can be easily post-processed through sanding, painting, and gluing.
  • Finally, I looked at mass properties of the part.

EnclosureTop Part

  • Begin with a new sketch on Top plane.
  • Use the Boss-Extrude feature to create a 3D solid by extruding the sketch in the specified direction.
  • Add Extrude-cut feature by sketching required shapes.
  • Give fillets on the shape corners/edges.

  • Select face and add text>Extrude-cut to debossed.

  • By going to edit material specified material as pine wood.
  • Evaluate mass properties.

Assembly and Animation

  • Here, open Assembly and import Enclosure Top and Bottom parts.
  • Keep bottom part as fixed part.
  • To create certain relation between surfaces or bodies>Go to mates tool. The most common mates in SolidWorks assemblies are coincident and concentric due to how often things are made to be flush or aligned with one another.
  • For my Assembly I gave coincident between the contact surfaces and specified distace for linear motion.

Here’s the simple motion animation of exploded, collapse and rotation of the assembly.

Blender

Rendering

  • Open Blender and set up scene by adjusting the camera, lighting, and background.
  • Import STL File: go to “File” > “Import” > “STL (.stl)” to import electronic enclosure STL file.
  • Position and Scale: After importing, adjust enclosure positioned and scaled correctly. Use the transform tools (G for grab/move, R for rotate, and S for scale) to position and scale it accordingly.
  • Material and Texture: from “Shading” workspace.
  • Set Camera View: Adjust the camera view to frame scene. Select the camera, press N to open the side panel, and set the camera properties, including the focal length.
  • Render Image: Click on the “Render” button or press F12 to render the image and Save Rendered Image

Blender Parametric Modeling

  • Launch Blender, choose Geometric Node workspace.
  • Set Unit System to Metric.

  • Create a new Geometry Node tree.
  • In Modeling Window, select and delete the default cube.

  • SHIFT+A to add a Combine XYZ node, connecting its output to the Cube geometry’s Size input.
  • SHIFT+A to add a Group Input node, linking XYZ inputs to empty slots, and renaming them (e.g., boxLength, boxWidth, boxDepth).
  • Create a frame for selected nodes using CTRL+J, press N to
  • unhide the side menu, add a label, then hide the side menu again.

  • Now, for Hole > duplicate the geometry by selecting the Mesh Cube node and pressing SHIFT+D.
  • SHIFT+A, add a Vector Math node with the operation set to subtract, connecting its vector output to the cube’s size input.
  • Add 2 Combine XYZ nodes, arrange and connect them to the subtract node as follows: top node’s XYZ to boxLength, boxWidth, boxDepth; bottom node’s XY to an empty slot (rename as wallThickness).
  • Combine XYZ node, a Transform Geometry node, and a Mesh Boolean node to complete the process.

  • Here’s the full node tree for the parametric design that I have completed.

Fusion 360

Manufacturing Workspace

In Fusion 360, I employed CAM functionalities to generate G-code for EnclosureTop Part milling operations . This component was initially designed using SolidWorks.

Steps that I followed to generate G-code from Fusion CAM:

  • Stock Setup and Dimension Verification: Begin by setting up the stock, ensuring accurate dimensions.

  • Facing Operation: Navigate to the facing operation and select the appropriate face tool and geometry for the task. Then confirm toolpath settings for the facing operation.
  • Adaptive Clearing: Proceed to the adaptive clearing operation and choose a flat end mill tool suitable for the material. Configure parameters for adaptive clearing, considering the geometry and material of the part.

  • Drilling for Holes: Perform a drilling operation to create holes in the designated locations.
  • Contour for Outer Boundary: Move on to the contour operation for creating the outer boundary of the part. Simulation at Each Step: After each operation, simulate the toolpath to visualize the machining process. Verify that the toolpaths align with the design and check for any issues.

NOTE: Ensure that multiple depths are accurately accounted for in the toolpaths. Verify that the tool engagement and cutting parameters are appropriate for each depth.

Files for the Week

SolidWork File

Inkscape File

Gimp File

Blender File

Fusion File