Here I will describe step-by-step how you can design a 3D printed enclosure for your own project in the free program Blender. The enclosure shown here will be modelled on popular universal enclosures often purchased by hobbyists. Once completed, I will print the enclosure on a 3D Ender 3 Pro printer using PLA filament.
Losely related topic - tutorial on modelling an object from a photo
I also recommend reading the related topic in which I show a similar process for creating a 3D model in Blender, but slightly different and modelled on a photo:
https://www.elektroda.pl/rtvforum/topic3717892.html
The topic linked above is a separate whole and is not the 'first part' of the tutorial below, they are independent, although they use many of the same concepts.
Used version of Blender - Blender 2.79
In this tutorial I have used Blender version 2.79:
But the model creation procedure itself is the same in different versions of Blender (even those with the new GUI), so you can follow it at the same time using the version you prefer.
I downloaded my version from here:
https://www.blender.org/download/releases/2-79/
Basic knowledge
Before starting the tutorial, it is a good idea to familiarise yourself with the absolute basics of Blender, ie:
- moving the camera (mouse wheel zooms in/out, number keys 1, 3, 7, 9 set up different camera projections, 5 toggles ortho/perspective camera mode, keys 4, 6, 8, 2 , the ones with arrows, rotate the camera)
- flying the camera ( SHIFT+F activates a convenient mode of flying the camera using the mouse and moving the buttons W S A D )
- selecting objects (right mouse button selects a clicked object, SHIFT + right mouse button adds the clicked object to the selection, A selects or deselects everything)
- bulk selection, e.g. via key B (Box Select) or key C (quick selection under mouse cursor)
- editing mode ''Edit mode'' / ''Object mode'' (toggle with key TAB )
- panning (grab, key G ), rotating (rotate, key R ), scaling (scale, key S ) by a given value (key is pressed, e.g. G , the axis is selected by pressing X, Y or Z and enter from the keyboard the value by which you want to perform the transformation. E.g. another pressing of G Y -2.5 will move by -2.5 units along the Y axis).
- hiding objects for convenience ( H hides the selected object, ALT+H shows hidden objects, also on the object list view in the scene we have an eye icon which serves the same purpose)
- the 3D cursor concept in Blender; it determines where the added object will appear, as well as the centre of certain operations. It is set by the keyboard shortcut SHIFT+S , among others
Itp. etc., although I will try to include this information in the steps of the tutorial.
Here we go.
Step 0: Design assumptions
I made the following requirements and assumptions for this case.
Assumptions regarding the overall appearance of the enclosure and its implementation:
- the enclosure will resemble the well-known and popular universal enclosures for DIY projects for hobbyists
- the enclosure will consist of 4 components: front panel, rear panel, top cover and bottom cover
- ideally, the top and bottom covers should be identical
- the housing will be screwed together using screws and nuts (you can screw the screws into the filament and this works well, but such threads weaken over time and a nut solves this)
Assumptions for designing the case in Blender:
- all significant dimensions should be implemented on a grid and be integers (e.g. the height of the case is 50mm, not 50.43432432mm)
- the enclosure should be made, among other things, based on Blender modifiers, so that it can be easily edited (e.g. changing the screw size of the mounts, which are 4 times in the model, should be done once, and the other 3 mounts should update themselves)
- the case should be easy to edit (as above, modifiers, etc)
Step 1: We add the Plane
We start modelling in Blender with an empty scene (I removed everything that was there by first selecting everything with A , and then deleting with DELETE ).
We add a Plane from which we will make the shape of the case (front projection). SHIFT+A and select Plane:
In the menu on the left we set its position to the centre of the coordinate system (0,0,0):
It should be set up like this:
It is worth making sure it is in the centre of the coordinate system and not somewhere far out in space.
Step 2: Set up the camera
For convenience we should set the Ortho view. Ortho/Perspective modes are switched with the key 5 . The individual views (front, side, top) are set with the numerical keys 7, 9, 1, 3 . We set this view:
Step 3: Edit mode
We can now switch to Edit Mode. We exit Object Mode and enter Edit Mode by pressing TAB (we must have the object we want to edit selected)
The current editing mode (Edit Mode, or Object Mode, or other) is displayed here (you can also change it manually here, but it is more convenient to use the TAB ):
Step 4: Display dimensions
It will be useful to display the edge lengths - this is turned on in the menu shown with N . These are under the Display tab. Enable "Length" from "Edge Info".
To do this we need to be in Edit Mode - in Object Mode this option is hidden.
It is also worth remembering that this option is ''per object'', i.e. if we add a separate object we have to re-enable it.
Step 5: Give initial dimensions
Now we can start giving dimensions to our Plane. I first scaled it in each axis 20 times for this purpose (key S and then we simply type from the keyboard 20 ):
Then in the X-axis I scaled 2 times (key S , and then 2 ):
I then switched to edge mode, here:
Then I selected the left edge once and then the right edge separately with the right mouse button and moved them according to the Y or X axis (you press G , and then e.g. X to move along the axis) while holding CTRL to respect the 1mm grid:
(instead of moving the mouse you can also just press G , then select the axis by pressing e.g. X and then from the keyboard enter how much mm to move - e.g. 10. You can also not press at all G and just grab the red axis X on the screen and pull, it is also worth holding CTRL to move according to the grid).
During all the operations above, we must take care that the centre of the figure (the orange dot) is in its real centre. Later this will come in handy when making a mirror!
The final result is a rectangle measuring 110mm by 60mm.
Step 6: Mirror modifier (automatic mirroring) - preparation
We will now add a modifier that creates a mirror image of what we are editing. The mirror image will keep updating with all the changes we make ourselves.
To do this, we cut the object we have in half (it is very important to cut according to its centre, i.e. the origin). We cut by pressing CTRL + R , which is the Loop Cut And Slide tool:
Cut through:
Switch to wall mode and remove the left wall:
After removal:
Step 7: Mirror modifier (automatic mirroring) - add modifier
Mirror modifier is added from the menu on the right, from the Modifiers menu:
Mirror is in the list:
We do not click ''Apply''. ''Apply'' would remove the modifier and store its result in the current object, and we don't want that. We want the mirror to run on the current object and reflect the changes we are going to make. In this way, the mirror is added and creates a reflection of the object for us according to the X axis:
Step 8: Mirror along the other axis
Now we can repeat the operation with CTRL + R and Loop Cut And Slide and turn on the mirror according to the second axis (we do not add a second modifier, we just change the settings of the current one). Result:
One mirror can work simultaneously for one, two or three axes.
Step 9: Initial shape of the case - we add a vertex
Now we can model the corner of the case. It will be slightly chamfered, the side wall will be on a slant. Of course we can model it as we wish.
To do this, I switched to vertex editing mode:
I selected both vertices of the side wall (right mouse button selects, SHIFT + right mouse button adds another object to select):
And I selected from the menu enabled by the In Subdivide option - this will add another vertex which we can also move:
Result:
Step 10: Initial case shape - cut corner
I then simply selected one and the other vertex and moved them (key G ) while holding CTRL at will (and according to the grid). Result:
Step 11: Preparation for 3D transition - wall thickness
Now we need to decide on the wall thickness. I have decided on 2mm.
We prepare the object so that it has these walls with the key I - it makes an internal tracing of the shape whose distance from the edge is the given value.
We switch to wall mode and select what we have:
We type from the keyboard I and then 2 :
Done - but a few things need to be tweaked.
Step 12: Preparation for 3D transition - corrections
The wall division in the middle of the case (where the transitions to the mirror image are) is unnecessary. We will remove these walls manually and then move the vertices accordingly:
(I delete, of course, with the key DELETE , move G while holding CTRL ):
Much better:
Step 13: Preparation for 3D transition - second 2mm contour, to hold front and back panel
We will now essentially repeat the earlier operation. We need a margin to hold the front and back panel. I have decided on a thickness of
2mm. We do this as before:
And we also correct:
Step 14: A 3D glance at what we have
It is now worth looking at the results of our work. In the perspective view, everything looks slightly different. We switch views with the number key 5 :
I edit and create the highlighted corner of the object, the other 3 corners are created for us by the modifier mirror according to the two axes.
Step 15: We duplicate the object into a panel and a case
From what we have we will make both the panel (front and back) and the enclosure.
There will be two separate objects.
So we switch to Object Mode (key TAB ):
And in this Object Mode we use SHIFT+D to make a duplicate of what object we have.
(if we would do SHIFT+D in Edit Mode, we would only copy within the object what we have selected, e.g. its walls)
List of objects in the scene before Shift+D :
And after:
Now we rename the objects to case and panel. Double-click on the name to change it. The renamed objects:
Step 16: Front/rear panel (without holes)
We will focus on the ''panel'' object. The second object retracted from the scene at all (we click on the eye icon, although pressing H when we have it selected will do the same. ALT+H reveals hidden stuff):
We select our panel in Object Mode and go to its Edit Mode (key TAB ). We remove its outer walls - they are redundant:
We mark what is left:
We give it a thickness of, say, 2mm via Extrude. We press E and enter 2 :
Panel ready. Now we're going to tackle the enclosure.
Step 17: Housing - preparation
Switch to enclosure in scene view, retractable panel display, select enclosure:
The enclosure looks like this:
We will want to have it in two parts, so we disable one of the mirrors (one of the mirror axes):
Step 18: Housing - removing the interior
The inside of the enclosure will also be empty, of course - for this we remove the wall from the inside. Standard - wall mode, select, delete:
Step 19: Enclosure - thickening
Now we can add a third dimension to the enclosure. We do this as we did with the panel - select everything and then extrude operation. I've decided on a size of 2mm.
At this point we make the part of the case that will hold the panel.
Step 19: Housing - thickening part2
We will now pull forward just a section of the case - without the attachment for the panel. We mark three walls:
And again we make an extrude of, say, 5mm:
Step 20: Housing - preview
This point is quite optional. We can switch on the panel display as part of the preview and move it accordingly to fit the case. This will give us an idea of the stage we are at:
Step 21: Housing - cd
We will now perform the extrude again. We are going to add this piece of casing, the thickness of which should be equal to the thickness of the panel. In my case it was 2mm.
We mark the corresponding walls:
And after extrude:
Step 22: Housing - second tooth on panel
Now you need to make a case tooth/foot that will hold the panel from the inside. To do this we simply copy a section of what we have and move it by a given amount of mm.
We mark what we will need:
We copy, as before, via SHIFT+D (Duplicate) and then move it along the Z axis by 4mm ( G, Z, 4 - possibly 4 with a minus):
Step 23: Housing - correction
Walls should only be where they are visible. They are not left in the interior of the model. This is the purpose of these walls:
We mark, detach from the model (key Y , so called. split, without this moving the wall/vertices/edges we would also move the connected walls) and move 2mm along the Z axis downwards ( G, Z, -2 ):
Step 24: Enclosure - Remove Doubles
After the copy, move, etc. operations, it is a good idea to perform "Remove Doubles". This operation removes duplicate vertices, i.e. it resolves the situation where we have two different vertices at identically the same position in 3D space. This is important because when moving walls, a given wall can either pull connected walls together (when they share vertices) or simply move itself (when walls have completely separate vertices).
We select everything (since this operation works on a selection):
Remove Doubles is in the menu on the left:
The result of Remove Doubles:
Step 25: Housing - Last Extrude
Now we have to repeat the Extrude operation one last time. Also only for a few walls:
At this stage we also decide how much space there will be in the case. Let's say, 80mm. But we only make the Extrude by 40mm:
We will add the other side of the enclosure via Mirror.
Step 26: Housing - Mirror for second side - preparation
Some may be tempted to turn on mirror now, but unfortunately this will not work. Mirror performs a mirror image according to the point (0,0,0) of the local object (its centre - not the global coordinate system) and our centre is not where we want it to be.
You can see this well in the Ortho view (the centre is that ball):
Therefore, we move everything (in Edit Mode!) so that the centre is where it should be:
Step 27: Case - mirror for the other side - turn mirror on
All done, you can turn on the Z-axis mirroring:
Result:
Including the panel:
Step 28: How to mount the case
We also need to determine how we will mount the enclosure. I decided to use 4 M3 bolts and nuts, such:
We will model the bolt holes right away, but we will start with the M3 nut model.
Step 29: M3 nut - nut dimensions
To start with, it's worth measuring the nuts we have. I had a standard M3:
Step 30: M3 nut - shape in 2D
We will make the nut by adding a separate object, a hexagon. We add it while in Object Mode, so it will add itself as a separate, new object. If we were to add it in Edit Mode, it would add itself as part of an existing object, which we don't want. We will create the hexagon as a Circle with six edges. First we add the Circle ( SHIFT+A and select Circle from the menu):
Then simply set its parameters in the menu on the left:
The radius value (the radius of our ''circle''), here 3.15mm, comes from the fact that we want a diameter of 6.3mm.
Step 31: M3 nut - we transfer in 3D
Then you can already "thicken" the 2D outline via Extrude by 1.6mm ( E and enter 1.6 ):
Result:
Step 32: M3 nut - export object to STL format for Cura and print to check dimensions
After such an operation, it is worth checking that we have all the dimensions as we need them. Printing this little "nut" takes a minute or so and tells us a lot.
Blender supports exporting the object(s) to STL in the File->Export menu:
When exporting, we can choose whether we export all objects or only the selected ones:
Then the STL can be dropped into a slicer for the 3D printer (I use Cura):
After printing:
Fitment:
It is fine - we will use this model in the next sections of the course.
Step 33: Holes - M3 bolt cutter
We will now add an object that will ultimately be used to cut the hole into which the bolt enters. We will add it in the centre of the nut, but as a separate object. If the cursor has escaped us, remember that we can set its position to the centre of the selected objects with the shortcut SHIFT+S and selecting "Cursor To Selected":
Switch to Object Mode and add a Cylinder ( SHIFT+A and select ''Cylinder''). The object will add itself where the cursor is. Its size should be such that an M3 screw will go into it just fine. I have chosen 3mm:
We can scale it - its length is not important.
Step 34: Holes - Cutting the hole
The two objects prepared earlier will be cut from another, separate object. This will be an appropriately scaled Cube - add it in Object Mode as a separate object:
In Edit Mode we scale/move its walls accordingly:
We add a Boolean modifier to it:
We configure it to cut our nut shape from its object:
Same for the other bolt element:
To preview the results, we can hide the other objects and admire the cut out shape in the Cube:
Step 35: Holes - Check the hole - test print
It is now a good idea to check that our bolt hole and nut location will be a good match for the bolt and nut we have.
To do this we will export the object from earlier to STL and print. The object after printing:
Fitting:
In my case, the parts fit together in a squeeze. I decided to slightly widen both holes in Blender.
Step 36: Positioning the hole on the housing
The hole only needs to be added to the housing once. Modifier mirror will repeat it four times in the corners.
Select both clipping shapes (click RMB + Shift ) and place them where you want the hole:
(for this we use G - sliding and R - rotation).
Step 37: Minor corrections regarding the opening
At this stage, it is a good idea to considerably thicken the piece responsible for cutting out the space for the nut. This will leave yourself a margin for error and the possibility of hiding the slightly protruding thread:
Step 38: Positioning the hole
Then move the two objects just so that they protrude slightly outside the casing (the two objects I have marked will eventually be used to cut holes out of the casing with Boolean anyway):
Step 39: Extend the bolt hole cutting piece
The bolt will pass through the entire housing (both halves), so we can afford to extend it considerably. This step will also be explained a little better in a moment, once I've done the Boolean. I did the scaling with S just along the Y axis:
Step 40: We add the leg body
We have already had two clipping objects for a long time, but the leg body is missing. We will now add them. We go to Object Mode, select the nut object and press SHIFT+S to be able to position the cursor in the centre of the selection ("Cursor to Center"):
Next, we add a new object, the Cylinder. We give it dimensions as desired and rotate it as necessary:
Step 41: We shape the leg
Now we need to adjust the shape of the cylinder so that it ends where the housing does. I will demonstrate how this will look in a moment.
We mark the wall of the cylinder:
We want it to be level with the marked walls:
The easiest way to do this is with a ''snap'' (aka Snap).
We enable it here:
The snap mode is selected on the walls (faces), the object being snapped on Active (i.e. last selected).
From this point on, when CTRL is pressed, instead of the grid, we have a snap to the place we point the mouse at.
Press G, Y (grab, move, along Y-axis) and then hold CTRL and point the mouse at the walls you want to adjust to:
The screenshot above shows this process in progress.
After:
We can check the results in Ortho view (as before; key 5 numeric and then select the appropriate one from the projections with the keys 7, 9, 1, or 3 ):
Step 42: We refine the shape of the leg
Now we can further refine the shape of the leg. For example, make it so that it tapers towards the end:
I simply scaled the wall at its end.
Step 43: We finalise the leg and connect it to the chassis
We will now add Boolean modifiers for the three elements of the leg:
- the leg itself, its ''body''
- the cutter from the nut
- the cutter from the bolt
We add these modifiers to the housing object. We must have it marked.
This object already has a modifier mirror, so the order of the modifiers is very important. We want to sequentially:
1. add the leg body to the case (Modifier Boolean; Union mode)
2. cut the nut from the result (Modifier Boolean; Difference mode)
3. cut the rest of the screw from the result (Modifier Boolean; Difference mode)
4. make a mirror (this modifier is already done, we will not change it, just move it to the last place)
The order of the modifiers can be changed with these arrows:
I won't describe here anymore step by step how I add it, it should be clear at this stage.
Final result:
Modifier settings:
(Where there is "Carve" you can also try to select "BMesh" - this is simply a Boolean operation algorithm, sometimes one works better, sometimes the other, but my impression is that Carve more often gives better results. Generally don't do complex Boolean operations because it's algorithms don't always work).
Step 44: Possible leg corrections
Here I would like to further emphasise that, thanks to the use of modifiers, we can edit a leg (this one via the cutters) at will and everything will update itself in the other legs. Very convenient.
We can also move the whole leg, we simply select all 3 objects (two cutters and the body of the leg) and move them together.
Before moving:
After:
View from the other side:
Step 45: First print of the case
The model shown above I have decided to print in its entirety. It does not yet include the mounts for the electronics board to the inside of the case, but these are not necessary as it is only one half of the case. We can attach the tiles to the other half.
The model above requires supports which need to be included in Cura (or the Slicer we are using). These are only needed for the nut locations.
Model in Cura:
Visible supports:
Entire case:
Housing in the process of being printed:
Printed:
When removed from the printer:
A glance at how the supports have printed:
Supports removed:
Nut fitting:
In addition, I printed the first panel (without holes). Housing with panel:
Step 46: Improvement: lower the height of the feet to make the edges of the case fit better
If we print two identical case halves like the ones shown earlier then there may be a problem such that their outer edges do not fit together perfectly. One solution to this is to lower the height of the feet from the screws:
Then the screw feet have a little more play than the outer edges of the case and we have more control over how tightly the case is screwed together.
Step 47: Upgrade: reinforce the feet and rigidity of the case
In addition, we can also reinforce the screw feet. We will connect them with filament to the walls of the case. This will not significantly increase the amount of material used, but will significantly increase the rigidity of the structure.
Mark the foot:
Set the view to ortho projection (this will be more convenient):
We press K and use the Knife tool to cut the leg in two (we prepare it so for the mirror):
We want to cut through the whole mesh, so we also enable Cut Through from Knife (key Z , its status is displayed in the bar at the bottom):
Knife cuts according to the selected points. We select them by clicking with the left mouse button. We then click on the points I show:
Then confirm with Enter:
With B (Box Select) we conveniently select half of the leg:
We remove it:
We now add it again, only this time using Mirror - as we did earlier in the previous tutorial sections:
Done, half of the leg is done automatically using Mirror:
Now we'll add the cut using CTRL + R (Loop Cut And Slide) across the leg:
We will then mark three of its sides (on the other side this will be repeated by Mirror):
And we will extract them using Extrude (key E , along the X axis):
Finally, you still need to make sure you haven't overextended and adjust the positions of a few edges accordingly (via the tool under G , grab, slide)
Done:
It is worth noting here at the end that in this situation we have the mesh of the feet going into the mesh of the case. This is not a preferred situation, but we can afford it sometimes for convenience. I haven't noticed this causing problems in Slicer (I use Cura), so it's not a problem.
And of course the previously prepared Mirrors and Boolean system mapped everything for the other legs:
Step 48: Improvement: we reduce the panel size slightly
The panel can be the same trouble as the feet. Depending on the accuracy of the print (and even specifically our printer, axle play, etc) there can be some differences in the thickness of the printed parts. These can be accommodated by gently sanding the surface, and you can also reduce the panel size slightly:
We first mark one wall and move it by 0.25mm, then the same for the other wall. The mirror will do the rest for us. This will reduce the height of the panel by 0.5mm (twice 0.25mm, because we have a mirror).
I didn't do this step in the end - there was no need, everything fit together without it. I leave it here just for information.
Final result
I printed the enclosure in ''Standard'' settings with Cura.
The case half weighs about 50g and took less than 7h:
The panel (without holes) weighs about 12g and took just under 1.5h:
I only gave the panel one side so that I could present the centre of the case in the photos on occasion:
(continued in post below - topic has been split into two parts due to character limit)
Cool? Ranking DIY Helpful post? Buy me a coffee.