跳转至

Week 2: Computer Aided Design

This week, my goal is to familiarize myself with the use of CAD (Computer Aided Design) software and engage in 2D and 3D modeling practice.

1. Selection of Modeling Objects and Production Ideas

My goal this time is to design a housing for an electronic project I previously worked on, the NeoPixDot light chain pixel lamp. During this modeling process, I can simultaneously practice the design methods for 2D drawings and 3D solid models.

My enclosure design is divided into two parts:

  • Shell Body: Used to carry the PCB board, with reserved light-emitting holes for lamp beads and PCB mounting slots;
  • Top Cover: A square flat plate with screw holes pre-reserved at the four corners, used to close the housing and secure the overall structure, and used in combination with the housing body.

The top cover is designed in 2D, and after completion, it is exported as a .DXF file for laser cutting acrylic and diffuser plates; the main body of the housing is modeled in 3D, with the bottom extruded to form a solid, and the "Shell" function is used to create an internal cavity to ensure space for PCB installation. Finally, 3D printing is used to verify the dimensions and assembly effects.

img

2. Select a suitable CAD (Computer Aided Design) software

In this assignment, I need to select appropriate CAD (Computer Aided Design) software for 2D and 3D design. I mainly considered the following commonly used CAD software:

Software Core Advantages has deficiencies Adaptability Analysis
Fusion 360 Integrated Function: Capable of completing 2D sketching and 3D solid modeling; Supports STL / DXF file export for convenient 3D printing and laser processing; Strong parametric modeling capabilities and user-friendly interface Account registration is required, some features require an internet connection; new users may face a certain learning curve Optimal choice, fully adapted to the requirements of this assignment and the final project
KiCad Free and open source, suitable for PCB and electronic schematic design; can generate Gerber files for PCB fabrication Primarily focused on PCB, not suitable for housing mechanical structure modeling; 2D drawing capabilities are limited Not suitable for this assignment
SolidWorks Professional 3D mechanical modeling software, supporting complex parts and assemblies; comprehensive functionality and high precision The software is expensive, has a high learning curve, and is slightly complex for simple shell design Optional, suitable for complex mechanical parts, but slightly overkill for enclosure projects
FreeCAD Free and open source, supports 2D/3D modeling, and can export STL/DXF files The interface is complex, the modeling efficiency is low, and it is difficult for beginners to get started is an alternative, but not a priority

After comparison, I chose to use Fusion 360 because it can not only create 2D sketches but also perform 3D modeling, and supports exporting STL or DXF files, which is convenient for 3D printing or laser processing. Meanwhile, its user-friendly interface and comprehensive functions make it highly suitable for completing this week's modeling exercises.

Content above come from GPT4

3. Modeling Workflow

3.1 Overview of Modeling Objects

The core reference object for this modeling is the NeoPixDot light chain pixel lamp PCB, which has a square shape with a side length of 90mm. The main body of the enclosure I am about to design will be structured around the dimensions of this PCB to ensure that the PCB can be securely installed and meet the requirements for subsequent assembly.

img

3.2 Initial 2D Sketch

First, I create a Sketch in Fusion 360 and select the bottom plane as the drawing plane. Based on the dimensions of the PCB, sufficient redundancy is left during the design, with the side length of the enclosure body set to 95.50mm and the side length of the top cover set to 90.10mm. Four corner screw holes are then drawn at the positions of the four corners.

img

3.3 Preliminary 3D Modeling

After completing the 2D sketch, first extrude the main body of the shell by a thickness of 2 cm to form a solid, then perform shelling and set the shell thickness to 2 mm, while the top cover is extruded by a thickness of 2 mm to form a preliminary flat plate.

img

3.4 Secondary Sketch and Additional Modeling

Perform a secondary operation on the stretched solid, create a new sketch on the side of the housing body, draw the contour of the hole to be cut out, and expose the switches and interfaces of the light chain pixels.

img

img

Through the above process, I completed the full modeling from 2D sketches to 3D solids and then to functional holes.

4. Physical Manufacturing and Testing

After completing the 3D modeling, I exported the main body of the enclosure as an STL file and printed it using a 3D printer, while the top cover was exported as a DXF file in the 2D sketch section and processed using a laser engraver.

The final display effect is shown in the figure below:

img

5. Compression of Images and Videos

5.1 Image Compression:Squoosh

When organizing the assignment, I found that the original screenshot and photo files were relatively large, and if not compressed, the entire assignment package might exceed 200MB. To control the size, I used Squoosh to compress the images.

Squoosh is an online tool developed by Google, which is easy to operate and has excellent compression results. The specific operation steps are as follows:

Step 1: Open the Squoosh online tool:https://squoosh.app/ (English version) or https://www.starfavor.cn/compress/ (Chinese version);

img

Step 2: After dragging the images to be compressed onto the Squoosh interface, you can set the image format, post-compression quality, and image size. Moreover, the web interface will display the compressed effect in real time, allowing us to confirm that there is no significant loss of image quality before downloading.

img

Step 3: After confirming the parameters, click Export and save the compressed image.

5.2 Video Compression: FFmpeg

FFmpeg is a very powerful command-line tool that is highly professional for video compression. Although it requires entering a few commands, the results are highly controllable and the steps are not complicated. The specific operation steps are as follows:

5.2.1 Install FFmpeg

Open the Dpwnload FFmpeg official website:https://ffmpeg.org/download.html, select the installation packagewindows builds from gyan.dev.

img

Scroll down to find therelease buildssection, selectffmpeg-7.1.1-essentials_build.7zto download. This version is a streamlined core version, containing all the functions required for compression, with a small size and strong compatibility, suitable for use in assignments.

After the download is complete, unzip the file to obtain the FFmpeg folder, and check the folder structure, which mainly contains three directories:

  1. bin: The folder where the FFmpeg executable file is located. All commands to run FFmpeg need to be executed through the files in this directory.
  2. doc: Document materials.
  3. Presets: Preset formats and encoding schemes.

Enter bin directory, you can see the three core executable files of FFmpeg:

  1. ffmpeg.exe: Mainly used for video processing
  2. ffplay.exe: Used for playing videos
  3. ffprobe.exe: Used for analyzing video information

To enable the system to recognize the FFmpeg command in any folder location, we need to add its bin directory path to the system's "environment variables".

Type “Environment Variables” in the Windows Search bar, then select “Edit system environment variables”. In the pop-up “System Properties” window, click the “Environment Variables (N)...” button at the bottom.

img

In the open environment variables window, in the of the " System Variables " area, find and select the variable named Path, click the " Edit... " button below, and a blank input line will be added. The full path of the binfolder you just copied, for example: F:\ program\ ffmpeg - 7.1.1 - essentials_build\ binPaste it in, and finally click "OK" all the way to save and close all open property windows.

img

In the new command-line window, enter the following command and press Enter:

C++
ffmpeg -version

The command line displays a long string of text including detailed version information, compilation configuration, etc. of FFmpeg, instead of prompting "'ffmpeg' is not an internal or external command...". This proves that FFmpeg has been successfully installed and configured, and can be invoked from any location in the system.

img

At this point, the installation and configuration of FFmpeg are all completed. Next, I can directly call the ffmpeg command using the command line in any folder to compress videos. The next step will introduce the specific usage of the compression command.

5.2.2 Compressed Video

After installation and configuration are complete, you can now open the Command Line Tool (CMD) in any folder to use FFmpeg to compress videos. The basic idea is to specify the input file, output file, and key compression parameters through a simple command.

Below is my operation record:

Step 1: Open the command line

You can use CMD to navigate to any directory without having to enter the directory where the video file is located, or you can directly write the full path.

Step 2: Enter the compression command

The basic command format is as follows:

C++
ffmpeg -i 输入视频路径 -vcodec libx264 -crf 23 -preset medium -acodec aac 输出视频路径

Parameter Description:

  • -i Input video path: Specify the path of the original video file
  • -vcodec libx264: Use H.264 video encoding
  • -crf 23: Controls video quality, where a smaller value indicates higher quality, and a value around 23 results in a video quality that is not significantly different from the original video
  • -preset medium: Balances compression speed and effect, with options slow, medium, fast
  • -acodec aac: Compresses audio while ensuring sound quality
  • Output Video Path: Save path for the compressed video file

Step 3: Wait for compression to complete

After executing the command, the command line will display compression progress and frame rate information, and a compressed video file will be generated upon completion.

Step 4: Check video quality

Play the output video to confirm that there is no obvious blurriness, laggy playback, or audio-video out-of-sync. Once satisfied, you can use the compressed video for assignment submission or sharing.

6. Design and Processing Documents

光链像素源文件.f3d

外壳主体.stl

顶盖.dxf

7. Reference Links

Fusion 360 Learning Link:https://docs.geeksman.com/print3D/

FFmpeg Installation Tutorial:https://blog.csdn.net/Natsuago/article/details/143231558