When Unfolding An STL In Software, Math Isn’t The Tricky Part

Some time ago, [Trammell Hudson] took a shot at creating a tool that unfolds 3D models in STL format and outputs a color-coded 2D pattern that can be cut out using a laser cutter. With a little bending and gluing, the 3D model can be re-created out of paper or cardboard.

There are of course other and more full-featured tools for unfolding 3D models: Pepakura is used by many, but is not free and is Windows only. There is also a Blender extension called Paper Model that exists to export 3D shapes as paper models.

What’s interesting about [Trammell]’s project are the things he discovered while making it. The process of unfolding an STL may be conceptually simple, but the actual implementation is a bit tricky in ways that have little to do with number crunching.

For example, in a logical sense it doesn’t matter much where the software chooses to start the unfolding process, but in practice some start points yield much tighter groups of shapes that are easier to work with. Also, his software doesn’t optimize folding patterns, so sometimes the software will split a shape along a perfectly logical (but non-intuitive to a human) line and it can be difficult to figure out which pieces are supposed to attach where. The software remains in beta, but those who are interested can find it hosted on GitHub. It turns out that it’s actually quite challenging to turn a 3D model into an unfolded shape that still carries visual cues or resemblances to the original. Adding things like glue tabs in sensible places isn’t trivial, either.

Tools to unfold 3D models feature prominently in the prop-making world, and it’s only one of the several reasons an economical desktop cutter might be a useful addition to one’s workshop.

Mastering OpenSCAD Workflow

As you may have noticed in our coverage, we’re big fans of OpenSCAD around these parts. The fact that several of the Hackaday writers organically found and started using the parametric CAD package on their own is not only a testament to our carefully cultivated hive mind but also to the type of people it appeals to. Hackers love it because it allows you to model physical objects as if you were writing software: models are expressed in code, and its plain text source files can be managed with tools like git and make. If you’re a real Pinball Wizard you could design objects and export them to STL without ever using a graphical interface.

But as you might expect, with such power comes a considerable learning curve. OpenSCAD devotee [Uri Shaked] recently wrote in to share with us his workflow for designing complex interacting mechanisms, which serves as an excellent primer to the world of parametric design. From animating your models to recreating the “vitamins” of your build, his post contains plenty of tips that can help both new and veteran OpenSCAD users alike.

Perhaps the biggest takeaway from his post is that you should be thinking of your projects as a whole, rather than as individual models. [Uri] recalls his early attempts at designing mechanisms: designing each component individually, printing it out, and only then finding out if it fits together with the other pieces. This method of trial and error is probably familiar to anyone who’s designed their own 3D printed parts — but it’s slow and wastes materials. The alternative, as he explains it, is to design all of the pieces at the same time and “assemble” them virtually. This will allow you to check clearances and fitment without dedicating the time and materials to test it in the real world.

In fact, as [Uri] explains, you’re better off spending your time bringing real-world parts into OpenSCAD. By carefully measuring the hardware components you want to interact with (servos, gears, switches, etc), you can create facsimiles of them to use as a reference in your OpenSCAD project. As time goes on, you can build up your own library of drop-in reference models which will accelerate future designs.

He also spends a little time talking about something that doesn’t seem to be terribly well known even among the OpenSCAD converts: you don’t have to use the built-in editor if you don’t want to. Since OpenSCAD source code files are plain text, you can write them in whatever editor you like. The OpenSCAD model viewer even has an option specifically for this scenario, which will cause it to update the rendered preview as soon as it detects the source has been updated. For [Uri] this means he can create his designs in Visual Studio Code with a constantly updating preview in another window.

If you’re looking for examples of what the parametric capabilities of OpenSCAD can do for you, we’ve got no shortage of excellent examples. From creating customized computer cases to saving time by using mathematically derived components. Our very own [Elliot Williams] even has a write up about that most glorious of OpenSCAD commands: hull().

An OpenSCAD Mini-ITX Computer Case

We’re no strangers to 3D printed enclosures here at Hackaday. From the plethora of printed Raspberry Pi cases out there to custom enclosures for electronic projects, small plastic boxes turn out to be an excellent application for desktop 3D printing. But as printers get bigger and filament gets cheaper, those little boxes don’t always need to be so little. We aren’t talking about running off boxes for your sneaker collection either, if you’ve got the time and the print volume, you could whip up an enclosure for your PC.

[Nirav Patel] writes in to share his impressive 3D printed Mini-ITX computer case project, which would be a neat enough trick in its own right, but he took the concept one step farther and made it a parametric design in OpenSCAD. This allows the user to input their particular hardware configuration and receive STL files for a bespoke case. The list of supported hardware isn’t that long yet, but with the OpenSCAD code up on GitHub and released under the BSD license, hopefully the community can improve on that as time goes on.

To keep things simple (and strong), [Nirav] implemented what he refers to as a “bucket” design. The majority of the case is a single print, which does take a long time (just shy of 40 hours on his Prusa i3 MK3), but nearly eliminates any post-printing assembly. Only the optional feet and the lid need to be printed separately. Threaded inserts are used throughout the design for mounting hardware, so you don’t run the risk of blowing out the printed holes during hardware changes or upgrades.

A particularly neat feature, and a testament to the power of OpenSCAD, is the fact that the case’s internal volume is calculated and embossed into the side of the design. Does this have any practical purpose? Not exactly, but [Nirav] thought it would be appealing to the Mini-ITX case modding community which apparently measures their accomplishments in liters of volume.

We’ve seen a 3D printed computer case before, but it used acrylic sheets and couldn’t be made without a large format printer. There’s something to be said for a project that can be completed on the hacker community’s favorite printer.

GPS Overlays Give Real Life Racing A Video Game Feel

Racing is certainly exciting for the person rocketing around the track fast enough to get the speedometer into the triple digits, and tends to be a decent thrill for the spectators if they’ve got good seats. But if you’re just watching raw race videos on YouTube from the comfort of your office chair it can be a bit difficult to appreciate. There’s a lack of context for the viewer, and it can be hard to get the same sense of speed and position that you’d have if you saw the event first hand.

In an effort to give his father’s racing videos a bit more punch, [DusteD] came up with a clever way of adding video game style overlays to the recordings. The system provides real-time speed, lap times, and even a miniature representation of the track complete with a marker to show where the action is taking place. The end result is that recordings of Dad’s exploits on the track could pass as gameplay footage from Gran Turismo (we know GT doesn’t have motorcycles, but you get the idea).

The first part of the system is the tracker itself, which consists of a GPS receiver, an Arduino Pro Micro, and an SD card module. [DusteD] powers the device with two 18650 cells in parallel, and a DC-DC boost converter to step it up to 5V. Everything is contained in a 3D printed enclosure that he designed in OpenSCAD, with the only external elements being a toggle switch, a momentary switch, and most critically, a set of LEDs.

These LEDs play into the second part of the system, the software. The blinking LEDs are positioned so they’ll get picked up by the camera, which is then used to help synchronize the data stored on the SD card with the video. [DusteD] came up with some software that will take the speed and position information from the card, and turn it into PNG files with transparent backgrounds. These are then placed on top of the video with the help of FFmpeg. It takes a little adjustment to get everything lined up properly, but as the video after the break shows the end result is very impressive.

This build reminds us of the Raspberry Pi powered GPS helmet camera we featured a few years back, and it’s interesting to see how the two projects achieved what’s essentially the same goal in different ways.

Continue reading “GPS Overlays Give Real Life Racing A Video Game Feel”

OpenSCAD handles the Math in 3D Printed Holder for Magnetic Spheres

3D printed holder mounted to bike wheel, fitting precisely 38 magnetic spheres around its perimeter. Tedious math? Not if you make OpenSCAD do it.

Off-the-shelf components are great; the world and our work simply wouldn’t be the same without. But one of the constraints is that one has to design around them, and that’s what led [Antonio Ospite] to create a parametric design in OpenSCAD for a 3D printed holder which snugly fits a number of magnetic spheres around its diameter.

If that sounds a bit esoteric, it will become much clearer in the context of [Antonio]’s earlier work in making a DIY rotary encoder out of a ring of magnetic spheres. He found that such a ring in front of two Hall effect sensors was low in cost, high in precision, and thanks to 3D printing it also had a lot of potential for customizing. But hampering easy design changes was the need for the spheres to fit snugly around whatever shape was chosen for the hardware, which meant constraints on the encoder diameter.

In this case, [Antonio] wished to create an encoder that could be attached to a bicycle wheel but needed to know what outer diameter would best fit a ring of magnetic balls perfectly, given that the balls were each 5 mm. OpenSCAD did the trick, yielding a design that fit the bike wheel and spokes while perfectly nestling 38 magnetic balls around the outside edge with a minimum of wasted space.

OpenSCAD is a CAD program that’s really more like a programming language than anything else. For those who are not familiar with it, [Brian Benchoff] walked through how to make a simple object in OpenSCAD, and [Elliot] has sung the praises of a few advanced functions. Now that this project makes DIY encoders easier, perhaps they could be used to add intuitive new controls to OpenSCAD itself.

The A to Z of Building Your Own Keyboard

We’ve featured a number of people who’ve taken the plunge and created their own customized keyboard; at this point it’s safe to say that there’s enough information and source code out there that anyone who’s looking to build their own board won’t have much trouble figuring out how to do so. That being said, it’s nice to have a comprehensive at a process from start to finish. Why sift through forum posts and image galleries looking for crumbs if you don’t have to?

That’s precisely what makes this write-up by [Maarten Tromp] so interesting. He walks the reader through every step of the design and creation of his customized keyboard, from coming up with the rather unique layout to writing the firmware for its AVR microcontroller. It’s a long read, filled with plenty of tips and tricks from a multitude of disciplines.

After looking at other custom boards for inspiration, [Maarten] used OpenSCAD to create a 3D model of his proposed design, and had it printed at Shapeways. His electronics are based around an Atmel ATMega328P using vUSB, and Microchip MCP23017 I/O expanders to connect all the keys. He wrapped it all up by designing a PCB in gEDA PCB and having it sent off for production. As a testament to his attention to detail, everything mated up on the first try.

[Maarten] is happy with the final product, but mentions that in a future revision he would like to add RGB lighting and use a microcontroller that has native USB support. He’d also like to drop the I/O expanders and switch over to Charlieplexing for the key matrix.

From uncommon layouts to diminutive technicolor beauties, it seems there’s no end of custom keyboards in sight. We aren’t complaining.

3D Printering: When an STL File is Not Quite Right

STL files are everywhere. When there’s something to 3D print, it’s probably going to be an STL. Which, as long as the model is good just as it is, is no trouble at all. But sooner or later there will be a model that isn’t quite right in some way and suddenly project progress hits a snag.

When models interface with other physical things, those other components may not always be exactly as the designer expected. Being mindful about such potential inconsistencies during the design phase can help prevent problems, but it’s not always avoidable. The reason it’s a problem is because an STL file represents a solid model as a finished unit; it is not really intended to be rolled back into CAD programs for additional design changes.

STL files can be edited, but just like re-modeling a component from scratch, it can be a tricky process for those who don’t live and breathe this stuff. I’ll describe a few common issues related to STLs that can hold up getting that new project together, along with ways to deal with them. Thanks to 3D printing becoming much more commonplace, basic tools are within reach of even the least CAD-aware among us.

Continue reading “3D Printering: When an STL File is Not Quite Right”