Tips for making parts that push/snap together I would like to make some parts that will fit together. Specifically, I'm making an array of holders for small glass vials, which will stack together vertically to make a kind of extensible spice rack, for a scientific application.

Of course, I could just give each module a flat top and bottom surface and glue them together. However, it would be more convenient (and more fun) to make some kind of connector, so that I can just push the parts together and pull them apart when needed. The connection will need to be relatively sturdy, and they'll need to sit flush against each other with no flexing where they join. I am a novice at 3D printing, so I'm looking for tips on how to design interlocking components, both in general and for this particular case.

These parts will be printed in ABS using the Zortrax M200, and I'm designing them using OpenSCAD. They will almost certainly be printed lying on their side.

One option is that there are several parametric Lego brick clones available, which I could easily incorporate into my OpenSCAD project. My only worries are that this might be overcomplicating the problem, and that printing Lego type parts on their side will result in having to scrape a lot of support material out of the hollow parts. (Though on the plus side, the lego compatibility might actually be useful, in terms of not having to manufacture additional supporting material.)

Any tips would be welcome on how to design and print parts that can be pushed together. I am sure I can work it out myself in time, but any knowledge that will save me a design iteration or two would be very greatly appreciated.
There are many different ways too approach this and the question may be too broad, but here's a stab at it...

Here are a few different ways that I've made parts that connect in the past:

Example 1: Utilize the elasticity of the plastic by creating a semi circle to fit around another object. When fitting the part to the other object, the "wings" will flex out and relax around the back end of the object.

Example 2: T-Slot style designs are a nice choice for semi-permanent or interchangeable parts. The key here is just using trapezoids and make sure the "female" end is slightly larger and/or tapered to make it easier to insert the slides.

Example 3: Create snaps. This can be a bit more difficult, but can provide a more professional look to your design. It's best to start off by designing on L-Shaped slot on the parent part and a smaller L-Shaped extrusion on the child part. Then you can add a taper to the bottom area of the "L" to make it easier to insert into the slot.

Example 4: Creating plugs are similar to snaps, they're just circular. Try starting off with a cylinder and joining either a sphere or a slightly larger diameter and tapered cylinder on top. Then you should be able to snap the assembly into a hole that is slightly smaller than the "top" of the plug.

It's important to weigh the usefulness of some design choices against the purpose of your part. For me, if I'm designing something for the shop or something that I think I'm going to be swapping out often, I'll use the T-Slot idea. Other things that "looking pretty" is more important, I'll try to hide the connections by designing a type of snap that can go into the walls of the part.

The T-Slot designs seem to print quite easily with no need for supports (depending on how gradual the angles of your trapezoid are) and provides a lot of structural strength.

Printing snaps has been difficult for me in the past and its best not to try to unsnap the part too much as you run the risk of shearing the snap upon removal. Printing such a small feature means that it is usually not marginally strong. However, including multiple snaps in an area and designing them with tight clearances can provide a very neat/clean connection that is appealing for consumer products (for example, phone cases).