It is currently very impractical to 3D-print electronics, though conductive filaments and inks do show a lot of promise. But you can still integrate electronic components with your prints. The simplest way to do that is to design your 3D-printed parts with places to mount those components, like you would if you were making a project enclosure. You can also avoid mounting hardware completely if you design clips or other means of holding the components in place. If you’re especially forward-thinking, you can even place components during the printing process. LuckyResistor has a very helpful guide that will walk you through how to completely embed electronic components in your 3D prints.
One of the many great qualities of 3D printing is that it can be used to produce geometry that is difficult or impossible to fabricate by other means. For example, it is easy to print a hollow plastic sphere—something that is virtually impossible to do with any other fabrication method except rotomolding. This enables some really interesting possibilities if you think outside of the box. Want to keep yourself from spending your emergency cash? Just print a hollow cube and drop the cash inside before the top face is printed. In this guide, LuckyResistor is using a similar technique to seal electronic components inside of 3D-printed enclosures that have no openings or seams.
This does mean that you won’t be able to access those electronics again without breaking open your 3D print, so you’ll want to make sure you’ve thoroughly tested your circuit before embedding it. Heat can also be an issue, since there is no air circulation for cooling. Those caveats aside, this is a really cool method for making sealed electronic devices. Just like if you were hiding cash, this technique essentially boils down to pausing your print, placing the electronics, and then starting the print back up. You probably don’t want components rattling around inside of the print, so it is best to design your geometry so that they’re held in place. But that does mean you have to be careful about how you’re orienting the components.
Unless you take special steps to prevent it, your printer will likely move horizontally across the space where your component is resenting. If that is a PCB, then individual components on the board or even just solder joints can protrude into the hot end’s path and cause a collision. The best way to avoid that is to use PCBs with SMD components on only one side to ensure that the opposite side is completely flat. The PCB can be placed in its mounting location with the SMD components facing down, so that the hot end will glide harmlessly over the top of the smooth side. Just give the mounting tabs a little bit of tolerance and place the PCB just before the layers on top of the board are printed. A couple of simple G-code commands (dependent on your firmware) can be used to pause your print and move the hot end out of the way while you place the board. This is a technique that is easy to implement if you want to make unusual devices.