Art of 3D printer in the middle of printing a Hackaday Jolly Wrencher logo

OpenSCAD In Living Color

I modified a printer a few years ago to handle multiple filaments, but I will admit it was more or less a stunt. It worked, but it felt like you had to draw mystic symbols on the floor of the lab and dance around the printer, chanting incantations for it to go right. But I recently broke down and bought a color printer. No, probably not the one you think, but one that is pretty similar to the other color machines out there.

Of course, it is easy to grab ready-made models in various colors. It is also easy enough to go into a slicer and “paint” colors, but that’s not always desirable. In particular, I like to design in OpenSCAD, and adding a manual intervention step into an otherwise automatic compile process is inconvenient.

The other approach is to create a separate STL file for each filament color you will print with. Obviously, if your printer can only print four colors, then you will have four or fewer STLs. You import them, assign each one a color, and then, if you like, you can save the whole project as a 3MF or other file that knows how to handle the colors. That process is quick and painless, so the question now becomes how to get OpenSCAD to put out multiple STLs, one for each color.

But… color()

OpenSCAD has a color function, but that just shows you colors on the screen, and doesn’t actually do anything to your printed models. You can fill your screen with color, but the STL file you export will be the same. OpenSCAD is also parametric, so it isn’t that hard to just generate several OpenSCAD files for each part of the assembly. But you do have to make sure everything is referenced to the same origin, which can be tricky.

OpenSCAD Development Version Test

It turns out, the development version of OpenSCAD has experimental support for exporting 3MF files, which would allow me to sidestep the four STLs entirely. However, to make it work, you not only have to run the development version, but you also have to enable lazy unions in the preferences. You might try it, but you might also want to wait until the feature is more stable.

Besides, even with the development version, at least as I tried it, every object in the design will still need its color set in the slicer. The OpenSCAD export makes them separate objects, but doesn’t seem to communicate their color in a way that the slicer expects it. If you have a large number of multi-color parts, that will be a problem. It appears that if you do go this way, you might consider only setting the color on the very top-most objects unless things change as the feature gets more robust.

A Better Way

What I really wanted to do is create one OpenSCAD file that shows the colors I am using on the screen. Then, when I’m ready to generate STL files, I should be able to just pick one color for each color I am using.

Continue reading “OpenSCAD In Living Color”

Custom Touchpad PCBs Without The Pain

Many of us use touch pads daily on our laptops, but rarely do we give much thought about what they really do. In fact they are a PCB matrix of conductive pads, with a controller chip addressing it and sensing the area of contact. Such a complex and repetitive pattern can be annoying to create by hand in an EDA package, so [Timonsku] has written a script to take away the work.

It starts with an OpenSCAD script (originally written by Texas Instruments, and released as open source) that creates a diamond grid, which can be edited to the required dimensions and resolution. This is then exported as a DXF file, and the magic begins in a Python script. After adjustment of variables to suit, it finishes with an Eagle-compatible board file which should be importable into other EDA packages.

We’ve never made a touchpad ourselves, but having dome other such repetitive PCB tasks we feel the pain of anyone who has. Looking at this project we’re struck by the thought that its approach could be adapted for other uses, so it’s one to file away for later.

This isn’t the first home-made touchpad project we’ve brought you.

Closeup of a rackmounted custom HiFi setup

Rackmount All The Things, Hi-Fi Edition

For those who love systems and structure, owning a 19-inch rack with just one slot filled is just not it. But what if the rest of your gear isn’t 19-inch? Well, then you go out and make it so, just like [Cal Bryant] did recently.

The goal was to consolidate multiple devices — DAC, input selector, streamer, and power routing — into a single 2U rackmount unit. His first attempts involved drilling 1U panels to attach gear with removable faceplates. That worked, but not all devices played nice. So his next step became a fully custom enclosure with CAD-modeled brackets and front panels.

OpenSCAD turned out to be a lifesaver, letting [Cal] design modular mounting solutions. Exporting proper circles for CNC turret punching however appeared to be a nightmare. It was FreeCAD to the rescue for post-processing. After some sanding and auto-shop painting, the final faceplate looked factory-made.

Custom switch boxes for power and audio routing keep things tidy, housing everything from USB to XLR inputs. A 4-pole switch even allows seamless swapping between his DAC and DJ controller, while UV-printed graphics bring the finishing touch to this project. For those looking to clean up their Hi-Fi setup (or just love modding for the sake of it), there’s a lot to learn from this build.

If buying a rack is not within your budget, you could start with well-known IKEA LACK furniture.

Cyanotype Prints On A Resin 3D Printer

Not that it’s the kind of thing that pops into your head often, but if you ever do think of a cyanotype print, it probably doesn’t conjure up thoughts of modern technology. For good reason — the monochromatic technique was introduced in the 1840s, and was always something of a niche technology compared to more traditional photographic methods.

The original method is simple enough: put an object or negative between the sun and a UV-sensitive medium, and the exposed areas will turn blue and produce a print. This modernized concept created by [Gabe] works the same way, except both the sun and the negative have been replaced by a lightly modified resin 3D printer.

A good chunk of the effort here is in the software, as [Gabe] had to write some code that would take an image and turn it into something the printer would understand. His proof of concept was a clever bit of Python code that produced an OpenSCAD script, which ultimately converted each grayscale picture to a rectangular “pixel” of variable height. The resulting STL files could be run through the slicer to produce the necessary files to load into the printer. This was eventually replaced with a new Python script capable of converting images to native printer files through UVtools.

On the hardware side, all [Gabe] had to do was remove the vat that would usually hold the resin, and replace that with a wooden lid to both hold the UV-sensitized paper in place and protect the user’s eyes. [Gabe] says there’s still some room for improvement, but you wouldn’t know it by looking at some of the gorgeous prints he’s produced already.

No word yet on whether or not future versions of the project will support direct-to-potato imaging.

Belfry OpenSCAD Library (BOSL2) Brings Useful Parts And Tools Aplenty

OpenSCAD has a lot of fans around these parts — if you’re unaware, it’s essentially a code-based way of designing 3D models. Instead of drawing them up in a CAD program, one writes a script that defines the required geometry. All that is made a little easier with the Belfry OpenSCAD Library (BOSL2).

Designing a part like this is a cinch with BOSL2.

BOSL2 has an extensive library of base shapes, advanced functions for manipulating models, and some really nifty tools for creating attachment points on parts and aligning components with one another. If that sounds handy for designing useful objects, you’re in for even more of a treat when you see their functions for gears, hinges, screws, and more.

There’s even one that covers bottle necks and caps. (Those are all standardized by the way, so it’s never been easier to interface to existing bottles or caps in a project.)

OpenSCAD really is very versatile software. It powers useful tools like this screw, washer, and nut generator as well as having more unusual applications like a procedural terrain generator. It’s free, so if you’ve never looked into it, check it out!

Handy Online Metric Screw, Nut, And Washer Generator

For those times when you could really use a quick 3D model, this metric screw generator will do the trick for screws between M2 and M16 with matching nuts and washers. Fastener hardware is pretty accessible, but one never knows when a 3D printed piece will hit the spot. One might even be surprised what can be usefully printed on a decent 3D printer at something like 0.08 mm layer height.

Behind the scenes, [Jason]’s tool is an OpenSCAD script with a very slick web-based interface that allows easy customization of just about any element one might need to adjust, including fine-tuning the thread sizing. We’re fans of OpenSCAD here and appreciate what’s going on behind the scenes, but one doesn’t need to know anything about it to use the online tool.

Generated models can be downloaded as .3mf or .stl, but if you really need a CAD model you’re probably best off looking up a part and downloading the matching 3D model from a supplier like McMaster-Carr.

Prefer to just use the OpenSCAD script yourself, instead of the web interface? Select “Download STL/CAD Files” from the dropdown of the project page to download ScrewGenerator.scad for local use, and you’re off to the races.

Procedurally Generated Terrain In OpenSCAD

We’re big fans of OpenSCAD here at Hackaday — it’s free and open source software, runs on pretty much anything, and the idea of describing objects via code seems like a natural fit for producing functional parts. Rather than clicking and dragging elements on the screen, you can knock out a quick bracket or other simple component with just a few lines of code. But one of the things we don’t often get a chance to showcase is the incredible potential of generating 2D and 3D objects algorithmically.

In a recent Reddit post, [ardvarkmadman] dropped an extremely impressive snippet of OpenSCAD code that he calls TerrainGen. In fewer than fifteen lines of code, it’s able to create randomized “islands” which range from simple plateaus to craggy mountain ranges. After dropping the code in the OpenSCAD editor, you can just keep hitting F5 until you get a result that catches your eye. This seems like an excellent way to generate printable terrain elements for gaming purposes, but that’s just one possibility.

Continue reading “Procedurally Generated Terrain In OpenSCAD”