In previous tutorials, we explored creating simple parts using FreeCAD's Sketcher and Part Design workbenches. Now, we'll advance to building assemblies with multiple bodies that fit together seamlessly. Specifically, we'll design a simple keepsake box with a lid that slides onto a base. Additionally, we'll demonstrate how to import a STEP file and use it as reference geometry to create a mounting plate or enclosure. If you have access to a 3D printer, you can bring these designs to life for your own projects.
Let's dive in!
1. Setting Up Global Parameters with Spreadsheets
Using a spreadsheet in FreeCAD allows you to define global parameters that can be referenced throughout your design. This makes your model parametric and easily adjustable.
Steps:
Create a New Document:
Open FreeCAD.
Close any previous documents.
Go to File > New.
Switch to Spreadsheet Workbench:
Select Spreadsheet from the workbench selector.
Create a New Spreadsheet:
Click the New Spreadsheet icon.
Rename the spreadsheet to globals by right-clicking on it in the tree view and selecting Rename.
Define Parameters:
In column A, list the parameter names:
length
width
base_height
lid_height
fillet
thickness
gap
In column B, enter the corresponding values.
60 mm (length)
40 mm (width)
10 mm (base_height)
10 mm (lid_height)
4 mm (fillet)
2 mm (thickness)
0.2 mm (gap)
Note: Adjust these values as desired.
Assign Aliases:
Right-click on each cell in column B.
Select Properties > Alias.
Assign the alias matching the parameter name (e.g., cell B1 alias is length).
2. Designing the Box Base
We'll use the Part Design workbench to create the base of the box.
Steps:
Switch to Part Design Workbench:
Select Part Design from the workbench selector.
Create a New Body:
Click the Create Body icon.
Create a New Sketch:
Click the Create Sketch icon.
Select the XY plane.
Draw the Base Rectangle with Fillets:
Use the Rectangle tool to draw a rectangle centered around the origin.
Use the Fillet tool to round all four corners.
Apply Equal Constraint to all fillets to keep them the same size.
Constrain the Sketch:
Set Length and Width:
Use the Dimension tool.
Click on opposing points of the rectangle.
Enter expressions referencing the spreadsheet (enter ‘=’ or click on the small equation editor icon):
Length: <<globals>>.length
Width: <<globals>>.width
Set Fillet Radius:
Click on a fillet arc.
Set radius: <<globals>>.fillet
Center the Sketch:
Use the Symmetry Constraint to center the rectangle around the origin.
Right-click on the lid in the Tree View, select Appearance
Change color via Custom appearance > Ambient color
Change the Transparency with the slider in the Task Pane
4. Adding Chamfers and Fillets
Adding chamfers and fillets enhances the aesthetic and functionality of your design.
Steps:
Click the Chamfer tool
Task Pane will guide you through creating chamfers
Select Edges for Chamfering:
Click on the edges you want to chamfer (e.g., bottom edges of the base).
Hold Ctrl to select multiple edges.
Apply Chamfer:
Click the Chamfer icon.
Set the chamfer size (e.g., 2 mm).
Click OK.
5. Exporting and 3D Printing
With your design complete, you're ready to export and 3D print. Feel free to check out our Introduction to 3D Printing series to learn more!
Steps:
Export Bodies as STL Files:
Select the base body.
Go to File > Export.
Choose STL Mesh format.
Name the file (e.g., keepsake_box_base.stl).
Repeat for the lid body.
Prepare for 3D Printing:
Open your slicing software (e.g., Cura, PrusaSlicer).
Import both STL files.
Arrange them on the print bed.
Adjust settings (layer height, infill, supports if needed).
Slice and save the G-code.
Print the Model:
Transfer the G-code to your 3D printer.
Begin printing and monitor the process.
Importing STEP Files for Reference
Using STEP files allows you to design enclosures or mounts that fit existing components like a Raspberry Pi.
Steps:
Download a STEP File:
Visit GrabCAD, go to Library, and search for your component (e.g., Raspberry Pi).
Download the STEP file.
Import the STEP File into FreeCAD:
Go to File > Import.
Select the downloaded STEP file.
Wait for the import to complete.
Adjust Orientation:
If the model isn't oriented correctly:
Right-click on the imported part in the tree view.
Select Transform.
Rotate it as needed.
Create a SubShapeBinder:
Create a new body for your enclosure or mount.
With the new body active, select the imported part (e.g., PCB)
Click the SubShapeBinder icon.
Hide the original imported part.
Create Sketches Using Reference Geometry:
Use the Sketcher to create mounting holes or outlines.
Use the External Geometry tool to reference edges from the SubShapeBinder.
Design Your Enclosure or Mount:
Create pads, pockets, and other features as needed.
Ensure all dimensions are accurate for a proper fit.
Challenge: Create a Mounting Plate
Now that you've learned how to use STEP files and SubShapeBinders, try designing a mounting plate for one of your development boards.
Guidelines:
Choose a Board: Arduino, Raspberry Pi, or any other PCB.
Import a STEP File: Find and import the STEP file of your board.
Design the Mount:
Use the board's mounting holes as references.
Create a plate with pegs or holes to secure the board.
Add Personal Touches:
Incorporate design elements like logos or text.
Consider adding a snap-on lid or cover.
Share Your Creation:
Take a screenshot or photo of your design.
Share it on social media with the hashtag #DKFreeCAD.
Tag relevant accounts to showcase your work.
8. Conclusion
Congratulations! You've advanced your FreeCAD skills by learning how to work with multiple bodies, create assemblies, and use external references like STEP files. These techniques are invaluable for designing complex projects and ensuring your parts fit together perfectly.
Next Steps:
Experiment with more complex assemblies.
Explore additional FreeCAD workbenches for advanced features.
Stay tuned for the next tutorial, where we'll dive into creating mounting holes and using heat-set inserts.