Library for enclosures, cases, boxes footprints

I just finished the outline, cutouts and mounting holes for a box. It took me some time, and got the idea that I might share it with others so they don’t have to draw it themselves.

But what if we all contributed to the same library when we share our enclosure PCB designs? The principle is the same as for a component footprint. Not sure if it should be shared as a footprint or a pcb that you append, though. For those who only use extruded aluminum get by with only making a square, but for hammond boxes and non-standard designs like altoid tin cans you can spend at least some time designing it from scratch. And if your box has no drawing, like the one I just did, then you have to take your caliper out and really start spending some time.

I would be nice it was integrated in kicad library.

This project I did here (with complex shape):
https://meocloud.pt/link/6c985c59-3b92-4abf-8179-7a522b17ecf9/20160213/

Was made for this Hammond enclosure:
http://www.hammondmfg.com/pdf/1551R.pdf

but… in my case, I was not using the support for the screws… I cut the plastic support and my PCB board was completely touch the top plastic of the enclosure.

Exactly what I mean. What is the best way of sharing enclosure designs, though?

I think it is as a footprint. So you can add it to your schematic / BOM.
but… I am not sure the footprint will not allow you to add board cuts?

If the cut lineout was easy, I was happy to have the shape in the footprint as a comment or silkscreen… and then I will draw it myself in the board…

if the footprint dont support cut-outs then the only way is share it as a board :confused:

I think the preference will depend on the user…
Myself I will prefer it as a footprint and have the outlines as comments… so I can use it as guide and choose my options (eg: put or not the holes. or how or where to cut… )

Definitely best as footprint for me too. Also because there’s no library for pcb’s today, there’s no obvious way to share them.

I saw you couldn’t use cutout layer in footprints, shame. I tried making the cutout on a different layer, hoping to change the layer of the cutout after footprint is placed. No luck. then the next thing I can think of is to use another layer then make sure to include that for the outline when creating the gerber.

There are other ways of making PCBs for enclosures with kicad. Another will be to get the DXF? (sorry I never did it in kicad) and import it to PCB… then I am not sure if you are able to convert to cutout or have to draw it yourself.

But, since the enclosure also involves mechanical drawing, I like the comments lines as guidelines where I should place the components (eg: connectors of the borders) So it is not just eh PCB cut out but the enclosure limits it self (and thickness)

Yes but those can be added as comments, right. Either in the SVG or in the footprint file.

I edited the footprint text file and changed the outline layer to edge cuts. When I now add the footprint to my pcb it works perfectly :slight_smile: All though if I try and edit the outline in footprint editor again I get this error message:


I can just press cancel and it keeps my outline on the outline layer.
Edit: I press OK then Cancel on the next window.

Did you by the way know that you could paste images directly in the text edit field when posting to this forum? I love it, just found out. Perfect when you use Snipping Tool in windows.

uhmm I think you are trying to explore a possible issue with KiCad :slightly_smiling:

the easiest is by DXF import, if you have a DXF drawing to start from
http://docs.kicad.org/en/pcbnew.html#_creating_a_board

but if you have also a STEP 3D model of the board (as in the e.g. http://www.hammondmfg.com/3DZip/1551R.zip )
you can convert your 3D model to VRML with kicad StepUp internal macro and have your enclosure displayed in the 3D viewer like that
https://kicad-info.s3-us-west-2.amazonaws.com/original/2X/0/0b70db5f2bd661b6417bd086cf45035a5fa263ff.gif

4 Likes

Yes but how will the DXFs be distributed? I like the idea of contributing to the github libraries.

Well yeah but one should not edit the footprint if they don’t want it ruined the :wink: As far as I can see, the only thing hindering this is if a user decides to edit the footprint and have to deal with the error message I posted and maybe accidentaly convert the Edge.Cuts layer to silkscreen layer.

You can move lines/arcs onto the edge.cuts layer via text editor… if you open that footprint in the FP editor they will be moved to some other layer… think Dwgs.User or something.

If I would do this I would put the outline information on Dwgs.User and have all the mounting holes etc ready.
Then after importing into the pcb layout I would redraw the outline on edge.cuts and voila, done.
Can always adjust the outline if needed without losing the original information, as that is fixed in the footprints Dwgs.User layer…

Example:
PCB_RPiPlus_Hat_NPTH.kicad_mod (8.0 KB)

[EDIT]
I confirmed the dimensions of that footprint with a RPi B+ I got here.

in your github repo you can add a folder e.g. mechanical or case and add your dxf and may be also a 3D (e.g. in FreeCAD) of your enclosure
see what they have done for hackrf

1 Like

I see that many ways can lead you to Rome. But Rome to me is when I can use the “place footprint” tool in pcbnew, find my mechanical layers as a footprint and bam place it on my pcb. I don’t want to bundle extra files and/or or instruct the user to convert or import anything. The essence of my first post was about how to share mechanical footprints as easy as electrical ones. And it can be done today, but it has three downsides this far I have discovered:

  1. No User.Cuts layer in footprint editor. You must manually edit the footprint textfile.
  2. User will get an error message if he tries to edit the footprint.
  3. When the footprint covers the whole perimeter of your board, it will always show up in the context menu for selection clarification, which is annoying.
1 Like

to 3) If you put PCB** into the reference field (or HAT**) and it is in the selection que you will be able to ‘avoid’ it:

to 1&2) if you get the edge.cuts via the footprint then for any change you need/want/might do to the outline, you have to change the footprint (or the pour soul who got it from you). I would avoid that kind of fixation - especially if the thought behind the whole thing is to share ‘possible’ pcb outlines with others. If the outline is on some other layer, it will always be there as orientation and you can easily follow it on the edge.cuts layer and see the difference you get when you do it.

For example, the above RPi+ outline… some more practical person might not like the hole for the camera FFC, as to mount it the camera would need to be disconnected - every time. So he’d like a slot. Cool. With above version he just draws it on the edge.cuts layer after importing the footprint. If the edge.cuts are delivered by the footprint he’s got to change that instead and in cumbersome ways as the FP editor will be of no help.

1 Like

I see your point, but the “hassle” of editing a footprint is equal for those who use actual footprints also. I think it’s a neat systematic way of adding both mechanical and electrical footprints. The issue with footprint editor not allowing you draw edges we agree on being a showstopper. But I don’t see why Edge.Cuts is deactivated in footprint editor?

Edge.Cuts I can even understand somewhat - you do it once per board and it should be modificable on layout level, not on footprint level… but Dwgs.User, EcoX.User or Cmts.User?
They also don’t support copper tracks or thermal pads really.
For an answer on that a dev would need to chime in or you ask it over here:

I’m working on creating outlines for Hammond’s 1590A, 1590B and 1590BB enclosures.
So far I’ve only worked on the 1590B, and it’s a bit more difficult than I anticipated. Looks nice though :slight_smile:

It would indeed be useful if the dimension tool and other layers were available in the footprint editor, if only to indicate measurements. I will be working on the other enclosures aswell, but I need to standardize workflow and grid size etc. first.

Now, I draw the maximum ‘inner’ (between the screw holes) and outer size from the datasheet as rectangles on the F.Fab layer, add some arcs (size guesstimated, needs to be standardized) to go around the screw hole, and save that as a footprint. Then I copy that footprint, and trace the outline of the board with, say, a millimeter of clearance, again on the F.Fab layer. This then gets saved, and edited in a text editor to swap the layers to Edge.Cuts. Then I add the 3d model, which Hammond happily provides, scale/rotate and presto :wink: I’ll be happy to provide these once they’re done, but it’ll take a couple of days.

suggested workflow:

  • center of mount hole = center of arc
  • grid to suit datasheet source (inch/mm)
  • when placing the center, hit [space] to get the relative coordinates to show the radius…

The radius of the plastic for 1950A can be deferred from ‘Top View Looking Inside Box’ (inside short measure given as 22.50 mm) and ‘Top View of Assembly’ (short distance of screw holes given as 28.50 mm).
r = (28.50 mm - 22.50 mm) / 2 = 3.00 mm

1 Like

Doh, I totally forgot about the hole specs from the datasheet! Thanks for the heads up. I guess I have some more calculating and drawing to do, might aswell make these as close to perfect as it gets :frowning: Yeah the spacebar is almost more often used than the left mouse button when doing these kind of things. Did I mention it’s a pain to draw on a 0.025 mm grid? My scrollwheel is on fire!

When doing it the incorrect and/or imprecise way, I noticed a 0.025 mm discrepancy between length and width when drawing the arcs, but now I calculate the it from the datasheet (idem to your calculations, but for the other direction: (82.60 mm - 76.65 mm) / 2 = 2.975 mm. I guess with a board-to-enclosure tolerance of about 1 mm, the 0.025 mm won’t matter much, but perfectionism is starting to take its irritating toll here. I’m going to have to think about what I’m going to do here to keep things as simple as possible. Scripting even crossed my mind for about 0.025 seconds :wink:

Little test… 15 minutes:
PCB_HAMMOND_1950A.kicad_mod (1.9 KB)

I used the pads as markers… pretty easy to set their diameters and positions with the edit properties dialog to what’s in the datasheet. Something similar would be needed if one draws the outline in pcbnew again - the cross is missing in the center for the pads anyway, so they might not be the best choice for that.
The Dwgs.User outline has got 1 mm space to the plastic on that level according to the datasheet.

PS: I had to use the 0.05 mm grid for the outline as the positions of the holes didn’t line up with the 0.25 mm grid.
You do know that you can move the cursor with the arrow keys, right?