Maker.io main logo

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

2024-12-19 | By ShawnHymel

3D Printing 3D Printer

In the first part of this series, we explored the history of FreeCAD and why it might be the ideal CAD software for your projects. Now, it's time to roll up our sleeves and create our first design. In this tutorial, we'll guide you through using the Part Design Workbench to create a simple SD card holder. By the end, you'll not only have a practical item but also the foundational skills to tackle your own projects, such as designing a pen cup to organize your desk.

Note that this series was made with FreeCAD v0.22 (or v1.0RC1). We recommend using that version or later, as it fixes the topological naming problem. If you use a later version, note that some of the tools and icons might be different.

Getting Started with FreeCAD

Launch FreeCAD and Set Up Your Workspace

    1. Open FreeCAD:

    • Ensure you're using the latest version (preferably version 0.22 or 1.0).
    • You'll see a welcome screen; for now, you can ignore the extra options and focus on the default settings.

    2. Create a New Document:

    • Go to File > New or click the New Document icon.
    • This document acts as your project file, containing all your designs and parts.

    3. Select the Part Design Workbench:

    • Use the workbench selector at the top to choose Part Design.
    • Notice how the toolbar and menu options change to reflect tools specific to part design.

Understanding Bodies and Sketches

  • Body: Represents a single contiguous shape defined by features and sketches. You can have multiple bodies within a document.
  • Sketch: A 2D drawing that serves as the foundation for 3D features.

Designing the SD Card Holder

Step 1: Create a New Body

    1. Create Body:

    • Click the Create Body icon in the toolbar.
    • A new body appears in the Model Tree on the left.

    2. Activate the Body:

    • If you have multiple bodies, right-click on the one you want to work with and select Set Active Body.
    • The active body is highlighted, indicating it's ready for new features.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Step 2: Start a New Sketch

    1. Create Sketch:

    • Click the Create Sketch icon.
    • A dialog prompts you to select a plane. Choose the XY plane.
    • Click OK to enter the Sketcher workbench.

    2. Understanding the Sketcher Interface:

    • The X-axis is red, and the Y-axis is green.
    • The origin is marked by a blue dot.

Step 3: Draw the Base Rectangle

    1. Select the Rectangle Tool:

    • Click the Rectangle icon in the toolbar.

    2. Draw the Rectangle:

    • Click to set the first corner near the origin.
    • Click to set the opposite corner.
    • Press Esc or right-click to exit the rectangle tool.

Step 4: Apply Constraints to the Sketch

Constraints define the dimensions and relationships of your sketch elements, ensuring precision.

    1. Symmetric Constraint:

    • Select the Symmetric Constraint icon.
    • Click on the two diagonal corner points of the rectangle.
    • Then click on the origin point.
    • This centers the rectangle around the origin.

    2. Dimension Constraints:

    • Horizontal Distance:
      • Click the Horizontal Distance icon.
      • Select the top or bottom edge of the rectangle.
      • Enter 29 mm and click OK.
    • Vertical Distance:
      • Click the Vertical Distance icon.
      • Select one of the side edges.
      • Enter 42.8 mm and click OK.

    3. Fully Constrained Sketch:

    • Ensure the sketch status shows Fully Constrained (no degrees of freedom left).
    • This means all elements are precisely defined.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Step 5: Pad (Extrude) the Sketch

    1. Exit the Sketcher:

    • Click Close in the tasks pane to return to the Part Design workbench.

    2. Pad the Sketch:

    • With the sketch selected, click the Pad icon.
    • In the dialog:
      • Set Length to 18 mm (height of the holder).
      • Click OK.
    • The 2D sketch is now a 3D solid.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Step 6: Create the SD Card Slots

a. Start a New Sketch on the Top Face

    1. Select the Top Face:

    • Click on the top surface of the padded solid in the 3D view.

    2. Create Sketch:

    • Click the Create Sketch icon.
    • The new sketch is attached to the selected face.

b. Bring in External Geometry

    1. External Geometry Tool:

    • Click the External Geometry icon (looks like a pink line with an edge).

    2. Select Reference Edges:

    • Click on the top horizontal edge and the left vertical edge of the base.
    • These edges appear as pink dashed lines in your sketch.

c. Draw the Slot Rectangles

    1. Draw Four Rectangles:

    • Use the Rectangle tool to draw four rectangles above the X-axis.
    • They don't need precise positions yet.

d. Apply Constraints to the Slots

    1. Equal Constraints:

    • Use the Equal Length constraint to make all rectangles the same size.
    • Select corresponding sides (e.g., all top edges) and apply the constraint.

    2. Vertical Alignment:

    • Use the Vertical Constraint to align the left sides of the rectangles.

    3. Construction Geometry:

    • Toggle Construction Mode by clicking the Toggle Construction Geometry icon.
    • Draw vertical lines between the bottom corners of the slots to define equal gaps.

    4. Dimension Constraints:

    • Slot Width:
      • Set the width (horizontal distance) of a slot to 3.1 mm (SD card thickness plus tolerance).
    • Slot Length:
      • Set the length (vertical distance) to 25 mm (SD card width plus tolerance).
    • Gap Between Slots:
      • Set the vertical distances between slots to 2 mm.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

e. Mirror the Slots

    1. Select All Slot Elements:

    • Drag a selection box around the four rectangles.

    2. Symmetry Tool:

    • Click the Symmetry icon.
    • Select the X-axis as the mirror line.
    • Four additional slots appear below the X-axis.

    3. Apply Necessary Constraints:

    • Ensure the mirrored slots are fully constrained.
    • Use Equal and Vertical constraints as needed.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

f. Finalize the Sketch

  • Check that the sketch is fully constrained.
  • Click Close to exit the Sketcher.

Step 7: Create Pockets for the Slots

    1. Pocket Tool

    • With the slot sketch selected, click the Pocket icon.

    2. Set Pocket Parameters:

    • Type: Select Dimension.
    • Length: Enter 16 mm (desired depth of the slots).
    • Click OK.

    3. Review the Model:

    • Rotate the 3D view to inspect the slots.
    • The slots should be cut into the base to the specified depth.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Saving and Exporting Your Design

Step 1: Save Your Project

  • Go to File > Save As.
  • Name your project (e.g., SD_Card_Holder.FCStd).
  • Click Save.

Step 2: Export for 3D Printing

    1. Select the Body:

    • Click on the Body in the Model Tree.

    2. Export as STL:

    • Go to File > Export.
    • Choose STL Mesh from the file type dropdown.
    • Name the file and click Save.

Preparing for 3D Printing

Optionally, you can 3D print your design to get a usable SD card holder. Feel free to check out our Introduction to 3D Printing series to learn more!

Step 1: Load the STL into a Slicer

  • Open your preferred slicing software (e.g., Cura, PrusaSlicer).
  • Import the STL file.

Step 2: Adjust Print Settings

  • Orientation:
    • Ensure the model is oriented with the slots facing upward.
  • Supports:
    • Supports are generally not needed for this design.
  • Infill and Layer Height:
    • Adjust according to your preferences and printer capabilities.

Step 3: Slice and Export G-Code

  • Slice the model to generate the G-Code.
  • Review the estimated print time and material usage.
  • Save the G-Code file.

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Step 4: Start Printing

  • Transfer the G-Code to your 3D printer.
  • Begin the print.
  • Monitor the print to ensure the first layers adhere properly.
  • Admire your work!

Intro to FreeCAD Part 2: Sketches, Constraints, and Part Design

Challenge: Design Your Own Organizer

Now that you've mastered the basics, it's time to apply your skills to a new project.

Project Idea: Pen Cup

    1. Create a New Document in FreeCAD.

    2. Use Circles and Arcs:

    • Experiment with the Circle and Arc tools in the Sketcher.

    3. Design Considerations:

    • Think about the dimensions needed to hold pens and pencils.
    • Consider adding compartments or decorative elements.

    4. Apply Constraints:

    • Fully constrain your sketches to ensure precision.

    5. Create 3D Features:

    • Use Pad, Pocket, and other tools to shape your design.

Share Your Creation

  • Take a Screenshot or Photo of your model or printed object.
  • Share on Social Media (X, Instagram, LinkedIn):
    • Use the hashtag #DKFreeCAD and tag @DigiKey
    • Tag relevant accounts to showcase your work.

Conclusion

Congratulations! You've successfully designed and (potentially) printed an SD card holder using FreeCAD. You've learned how to:

  • Navigate the Part Design Workbench.
  • Create and constrain sketches.
  • Use features like Pad and Pocket to turn sketches into 3D models.
  • Apply symmetry and construction geometry to simplify complex designs.

These foundational skills are crucial for any CAD project. As you continue to explore FreeCAD, you'll discover more advanced features and techniques.

What's Next?

In the next tutorial, we'll delve into using Shape Binders and working with multiple bodies. This will enable you to create more complex assemblies, such as enclosures with lids.

TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum