Maker.io main logo

Intro to FreeCAD Part 5: Patterns and Boolean Operations

2025-01-23 | By ShawnHymel

3D Printing 3D Printer

In the previous tutorial, we explored using heat-set inserts and the mirror tool to replicate features in FreeCAD. This time, we'll dive into similar tools like linear and polar arrays to simplify designing patterns. Additionally, we'll discuss using Boolean operations to add and subtract parts. As a practical application, we'll design a custom servo horn that can attach to a micro servo motor and connect to LEGO® Technic parts. This project will involve creating a disc with holes, providing excellent practice for making feature arrays and applying Boolean operations.

Patterns in CAD software allow you to replicate features in a linear or circular fashion, saving time and ensuring consistency. Boolean operations enable you to add or subtract shapes from each other, which is essential when creating complex geometries.

By mastering these tools, you can create intricate designs more efficiently and with greater precision.

1. Setting Up the Project

Before we begin, ensure you have FreeCAD installed (preferably version 0.22 or later). Familiarity with the Part Design workbench and basic sketching is assumed. Please review the previous sections if you need a refresher on these workbenches.

2. Importing the Servo Motor Model

We'll start by importing a servo motor model to reference the shaft dimensions.

Steps:

  • Download the Servo Model:
    • Find a suitable micro servo model on GrabCAD or similar websites. I’ll use this model for the rest of this tutorial.
    • Ensure it includes a detailed servo shaft.
  • Import the Model into FreeCAD:
    • Open FreeCAD and switch to the Part Design workbench.
    • Go to File > Import.
    • Navigate to the downloaded servo model (preferably a STEP file) and open it.
    • Keep the import settings at their default and click OK.
  • Inspect the Model:
    • You should now see the servo motor in your workspace.
    • Locate the servo shaft in the model tree. It may be under a component or part in the hierarchy.

3. Preparing the Servo Shaft

We need only the servo shaft for our design.

Steps:

  • Isolate the Servo Shaft:
    • In the model tree, find and select the servo shaft.
    • Right-click and select Copy.
  • Create a New Body:
    • Collapse the imported servo model in the tree to keep things organized.
    • Right-click in the empty space of the model tree and select Paste.
    • This action creates a new standalone servo shaft.
  • Delete the Original Model:
    • Select the original imported servo model.
    • Right-click and select Delete to remove it from the workspace.
    • Confirm the deletion.
  • Create a Body from the Shaft:
    • If the shaft isn't already part of a body, select it and click Create New Body.
    • This converts the shaft into a Part Design body, allowing us to perform further operations.
  • Adjust Shaft Orientation:
    • The shaft might not align with FreeCAD's global axes.
    • Select the shaft body.
    • In the Property panel under Placement, adjust the rotation:
      • Set Angle to 90°.
      • Set Axis to (1, 0, 0) to rotate around the X-axis.
    • Adjust Position to (0, 0, 0) to align it with the origin.

4. Create Shaft Coupler

We'll design the main disc of the servo horn, which will connect to the servo shaft.

Steps:

  • Create a New Body:
    • Click Create New Body to start designing the horn.
  • Create a SubShapeBinder:
    • With the new body active, select the servo shaft.
    • Click the SubShapeBinder icon (found in the Part Design toolbar).
    • This action creates a reference to the shaft within the horn body.
  • Hide the Original Shaft:
    • Select the original servo shaft and press the Spacebar to hide it.
    • This helps keep the workspace uncluttered.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Create a Sketch for the Base Disc:
    • Create a sketch on the top of the servo shaft.
    • Note: Ensure you're sketching in the horn body.
  • Bring in Reference Geometry:
    • Use the External Geometry tool (magenta icon) to select the inner circle and an outer tooth section from the SubShapeBinder.
    • This allows us to reference the shaft's dimensions.
  • Draw the Base Circle:
    • Using the Circle tool, draw a circle centered on the shaft's center.
    • Use reference geometry to draw a line from the center of the circle to the outer edge.
    • Create a coincident constraint for a point on the outer tooth (external geometry) to be on the reference line.
    • Set the diameter of the circle to be 2 mm larger than the outer teeth of the shaft.
  • Constrain the Sketch:
    • Ensure the circle is fully constrained.
    • Use other dimensions and constraints as necessary.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Exit the Sketch.
  • Pad the Base Disc:
    • Select the sketch and click Pad.
    • Set to Reversed (so it covers the shaft)
    • Set the Length to 2 mm
    • Click OK.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

5. Create Disc

Next, we need to create the disc.

Steps:

  • Create a sketch on Top of the shaft coupler we just made.
  • Create a circle centered on the previous coupler.
    • Use external geometry.
    • Diameter: 24 mm
  • Pad sketch.
    • Length: 1.5 mm

Intro to FreeCAD Part 5: Patterns and Boolean Operations

6. Creating Holes for LEGO Technic Pins

We'll add holes to accommodate LEGO Technic pins.

Steps:

  • Create a Sketch on Top of the Disc:
    • Select the top face of the disc made in the last part.
    • Click Create Sketch.
  • Draw the First Hole:
    • Use the Circle tool to draw a circle on the disc.
    • Set the diameter to 4.8 mm (the size of LEGO Technic holes).
  • Position the Hole:
    • Apply a Horizontal Constraint between the center of the hole and the disc's center.
    • Set the horizontal distance to 8 mm (distance from the center).
  • Fully Constrain the Sketch.
  • Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Exit the Sketch.
  • Pocket the Hole:
    • With the sketch selected, click Pocket.
    • Choose Through All to cut through the entire disc.
    • Click OK.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

7. Applying Polar Patterns

Instead of manually creating each hole, we'll use a polar pattern to replicate the hole around the disc.

Steps:

  • Create a Datum Line for Rotation Axis:
    • Click the Create a Datum Line icon.
    • In the Attachment settings:
      • Select the center of the disc as the attachment point.
      • Ensure the datum line aligns with the disc's axis (usually the Z-axis).
    • Click OK.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Apply Polar Pattern:
    • Select the Pocket feature (the hole we just created).
    • Click the Polar Pattern icon.
    • In the Axis settings:
      • Choose Select Reference.
      • Click on the Datum Line we just created.
    • Set the Occurrences to 6 (or desired number of holes).
    • Click OK.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

8. Using Boolean Operations

Now, we'll subtract the servo shaft shape from our horn to ensure a perfect fit.

Steps:

  • Prepare the Shaft for Subtraction:
    • Since we need to slightly enlarge the shaft shape for a proper fit, we'll create a scaled copy.
    • Switch to the Draft workbench.
  • Clone and Scale the Shaft:
    • Select the original servo shaft.
    • Click the Clone icon (blue sheep icon in the Draft workbench).
    • Select the cloned shaft.
    • In the Property panel under Scale, set:
      • X, Y, and Z to 1.02 (scaling up by 2%).
    • Note: If you are 3D printing, adjust the scaling factor as needed for your printer's tolerances.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Align the Scaled Shaft with the Alignment tool.
    • The scaling may have shifted the shaft. We'll align it with our horn.
    • Switch back to the Part Design workbench.
    • Select the fixed object (original shaft part), hold ctrl, and select the movable object (the clone). Note that the order in which you select parts matters here!
    • Go to Edit > Alignment.
    • Click on a point on one object and the corresponding point on the second object (e.g., point 1 in red in the image) where you want them to line up
    • Click on a second point on one object and the corresponding point on the second object (e.g., point 2 in green in the image)
    • Right-click in the viewer, click Align, and then OK.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Perform the Boolean Cut:
    • With the horn body active, select the clone shaft part.
    • Click the Boolean Operation icon.
    • In the Task Pane dialog:
      • Set Boolean Type to Cut.
      • Base should be the horn body.
      • Tool should be the scaled shaft clone.
    • Click OK.

    Intro to FreeCAD Part 5: Patterns and Boolean Operations

  • Cleanup:
    • If there are any pieces of the cut remaining that you do not want, you can use sketches and pads/pockets to correct them.
    • For example, if there is a cylinder left over from the cut, create a sketch on the disc’s bottom and perform the Pocket operation.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

9. Final Touches and Exporting

We'll add chamfers to the edges and prepare the model for printing.

Steps:

  • Add Chamfers:
    • Select the outer edges of the holes and the disc.
    • Click the Chamfer icon.
    • Set the chamfer size to 0.3 mm.
    • Click OK.
  • Save Your Work:
    • Go to File > Save As.
    • Name your project (e.g., Servo_Horn.FCStd).
  • Export as STL:
    • Select the horn body.
    • Go to File > Export.
    • Choose Mesh Formats (STL) from the dropdown.
    • Name the file (e.g., Servo_Horn.stl).
    • Click Save.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

10. 3D Printing and Assembly

You can optionally 3D print your design. Feel free to attach it to a servo motor! Note that you might need to sand the holes some to get everything to fit.

Intro to FreeCAD Part 5: Patterns and Boolean Operations

Challenge

Try designing your own custom servo horn or attachment using the techniques learned.

Ideas:

  • Different Hole Patterns: Create linear or custom patterns for varied connections.
  • Complex Shapes: Use Boolean operations to subtract more intricate shapes.
  • Functional Attachments: Design a horn that interacts with other systems or components.

Share Your Work:

  • Take a screenshot or photo of your design or printed part.
  • Share it on social media platforms like X (Twitter), Instagram, or LinkedIn.
  • Use the hashtag #DKFreeCAD and tag @DigiKey to connect with the community.

Conclusion

In this tutorial, we've explored how to use patterns and Boolean operations in FreeCAD to create complex and functional designs efficiently. By designing a custom servo horn compatible with LEGO Technic parts, you've learned how to:

  • Import and prepare reference models.
  • Use SubShapeBinders to reference parts in your design.
  • Apply polar patterns to replicate features around an axis.
  • Use Boolean operations to subtract shapes and create custom fits.

These skills are valuable for any CAD project, especially when creating parts that need to interact with other components or systems.

What's Next?

In the next tutorial, we'll extend our sketches to create interesting features through revolutions, lofts, and pipes. These tools will allow you to design more organic and complex shapes.

制造商零件编号 KT-PR0058-BS1MLRP
TAZ SIDEKICK LE RED EDITION
LulzBot
制造商零件编号 SER0043
SERVOMOTOR RC 4.8-6V
DFRobot
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.