Ditch OpenSCAD for C++

There’s an old saying that a picture is worth a thousand words. If you’ve ever tried to build furniture or a toy with one of those instructions sheets that contains nothing but pictures, you might disagree. 3D design is much the same for a lot of people. You think you want to draw things graphically, but once you start doing complex things and making changes, parametric modeling is the way to go. Some CAD tools let you do both, but many 3D printer users wind up using OpenSCAD which is fully parametric.

If you’ve used OpenSCAD you know that it is like a simple programming language, but with some significant differences from what you normally use. It is a good bet that most Hackaday readers can program in at least one language. So why learn something new? A real programming language is likely to have features you won’t find readily in OpenSCAD that, in theory, ought to help with reuse and managing complex designs.

I considered OpenJSCAD. It is more or less OpenSCAD for JavaScript. However, JavaScript is a bit of a scripting language itself. Sure, it has objects and some other features, but I’m more comfortable with C++. I thought about using the OpenCSG library that OpenSCAD uses, but that exposes a lot of detail.

Instead, I turned to a project that uses C++ code to generate OpenSCAD output, OOML (the Object Oriented Mechanics Language)). OpenSCAD does the rendering, exporting, and other functions. Unfortunately, the project seems to have stalled a few years back and the primary web-based documentation for it seems to be absent. However, it is very usable and if you know how to find it, there is plenty of documentation available.

Why not OpenSCAD?

Continue reading “Ditch OpenSCAD for C++”

3D Printed Circuit Boards… Sort Of

Comedian Demetri Martin does a bit about the phrase “sort of”. He says:

“Sort of’ is such a harmless thing to say… sort of. It’s just a filler. Sort of… it doesn’t really mean anything. But after certain things, sort of means everything. Like… after “I love you”… or “You’re going to live.”

SCADboard is an OpenSCAD library that lets you create 3D printable circuit boards…sort of. The library lays out like a breadboard with two bus bars on each side and a grid of rows and columns. OpenSCAD modules provide a way to create a board, ICs, LEDs, wires and other fundamental components. You set a few initial variables (like the board thickness) then your code looks like this:

 wire(1,bln,1,e, neg); // Neg left trace to LED
 led(1,e+1, 1,e+2, yellowled); // LED
 wire(1,f, 1,i, pos); // LED Pos
 wire(1,j, 1,brp, resistor); // Resistor
 wire(3,c,3,h, pos); // Cap Pos
 wire(4,c,4,h, neg); // LED Resistor

Continue reading “3D Printed Circuit Boards… Sort Of”

Hackaday Links: November 20, 2016

The Raspberry Pi 2 is getting an upgrade. No, this news isn’t as big as you would imagine. The Raspberry Pi 2 is powered by the BCM2836 SoC, an ARM Cortex-A7 that has served us well over the years. The ‘2836 is going out of production, and now the Raspberry Pi foundation is making the Pi 2 with the chip found in the Raspberry Pi 3, the BCM2837. Effectively, the Pi 2 is now a wireless-less (?) version of the Pi 3. It still costs $35, the same as the Pi 3, making it a rather dumb purchase for the home hacker. There are a lot of Pi 2s in industry, though, and they don’t need WiFi and Bluetooth throwing a wrench in the works.

So you’re using a Raspberry Pi as a media server, but you have far too many videos for a measly SD card. What’s the solution? A real server, first off, but there is another option. WDLabs released their third iteration of the PiDrive this week. It’s a (spinning) hard disk, SD card for the software, and a USB Y-cable for powering the whole thing. Also offered is a USB thumb drive providing 64 GB of storage, shipped with an SD card with the relevant software.

Mr. Trash Wheel is the greatest Baltimore resident since Edgar Allan Poe, John Waters, and Frank Zappa. Mr. Trash Wheel eats trash, ducks, kegs, and has kept Inner Harbor relatively free of gonoherpasyphilaids for the past few years. Now there’s a new trash wheel. Professor Trash Wheel will be unveiled on December 4th.

YOU MUST VOICE CONTROL ADDITIONAL PYLONS. With an ‘official’ StarCraft Protoss pylon and a Geeetech voice recognition module, [Scott] built a voice controlled lamp.

Everyone loves gigantic Nixie tubes, so here’s a Kickstarter for a gigantic Nixie clock. There are no rewards for just the tube, but here’s a manufacturer of 125mm tall Nixies.

Here’s an interesting think piece from AdvancedManufacturing.org. The STL file format is ancient and holding us all back. This much we have known since the first Makerbot, and it doesn’t help that Thingiverse is still a thing, and people don’t upload their source files. What’s the solution? 3MF and AMF file formats, apparently. OpenSCAD was not mentioned in this think piece.

OpenFixture Takes the Pain Out of Pogo Pins

[Elliot] (no relation, but hey, cool name!) wrote in with his OpenFixture model for OpenSCAD. It’s awesome because it takes a small problem, that nonetheless could consume an entire day, and solves it neatly. And that problem is making jigs to test assembled electrical products: a PCB test fixture.

In the PCB design software, you simply note down the locations of the test points and feed these into the OpenSCAD model. ([Elliot] shows you exactly how to do it using KiCAD.) There are a few more parameters of the model that you can tweak to match your particulars, but you should have a DXF outline for a test jig in short order. Cut that out, assemble, and test.

If you have to make more than a few handfuls of a complicated circuit, it becomes worth it to start thinking about testing them systematically. And with this OpenSCAD model, you can have the test jig up and running before the first prototype boards are back in from the fab. How cool is that?

Hackaday Links: July 3, 2016

This week, Popular Mechanics published cutaway diagrams of ships that will be seen in Star Trek: Beyond, released later this month. This is your cue for spoilers for the remainder of this paragraph. The USS Franklin looks suspiciously like – and was likely built after – the NX-01, the titular ship of Star Trek: Enterprise. The Abrams-verse Franklin was the first Warp 4 ship, yet the prime universe NX-01 was the first Warp 5 ship, with previous ships having trouble reaching Warp 2. We must now consider the Abrams-verse Trek is not a parallel universe to prime-universe Trek and should therefore be considered a completely separate canon (yes, even the destruction of Vulcan. If you see the new Star Trek movie, the NX-01 launched in 2151, and your suggested viewing beforehand is ST:ENT, S02E24, First Flight.

The Mechaduino is a Hackaday Prize entry that turns steppers into closed-loop servos. It’s a phenomenal idea, and now it’s a Kickstarter.

Walk into a dollar store, and you’ll find stupid solar powered electronic flower pots. They’re bits of plastic that shake a plastic flower back and forth when placed in the sun. They’re selling millions, and I have no idea why. [Scott] put a jolly wrencher on one of these flower pots. Really, this is just an exercise in 3D printing, but [Scott] printed the jolly wrencher. We don’t see a lot of that, due to how difficult it is to render the wrencher in OpenSCAD.

In just a few hours, Juno will perform an insertion burn around Jupiter. Does this mean pretty pictures? Not quite yet. This is the closest a spacecraft has ever gotten to Jupiter, and over thirty or forty orbits, Juno will fly between Jupiter’s massive radiation belts. Here’s the NASA trailer.

This video recently caught the Internet’s attention. It’s squares and circles that when put next to a mirror look like circles and squares. Yes, it’s weird. People have 3D printers, so of course these ambiguous objects were quickly reverse engineered and printed. Here’s how they work

It looks like Brexit has caught up to Mouser. Here’s their country select dialog for eu.mouser.com. Thanks [Tom] for the screencap.

ImplicitCAD: Programmatic CAD Built with 3D Printing in Mind

Cornerstone of many useful things: This Prusa i3 part was modeled in OpenSCAD.

Programmatic CAD, in particular the OpenSCAD language and IDE, has accompanied the maker movement for a while now. After its introduction in 2009, it quickly found its way into the 3D printing toolbox of many makers and eventually became what could be called an Industry Standard among open hardware labs, makerspaces and tinkerers. The Prusa i3, one of the most popular DIY 3D printers, was designed in OpenSCAD, and even Makerbot, the company that sold 100.000 3D printers, uses the language for its “Customizer” – an online tool that allows users to customize 3D printable models with minimal effort.

OpenSCAD is indeed a wonderful tool, and we have been using it a lot. We have become used to its quirks and accepted working with polygon mesh approximations of the models we are trying to design. We have made our peace with excessive rendering times, scripting workarounds and the pain of creating fillets, and we have learned to keep our aesthetic expectations low. We are happy with the fact that there is a way to programmatically create and share virtually any object, but sometimes we wish there was a better way in the open source world. Hint: there is.

Continue reading “ImplicitCAD: Programmatic CAD Built with 3D Printing in Mind”

Using Photogrammetry To Design 3D Printed Parts

[Stefan] is building a fixed wing drone, and with that comes the need for special mounts and adapters for a GoPro. The usual way of creating an adapter is pulling out a ruler, caliper, measuring everything, making a 3D model, and sending it off to a 3D printer. Instead of doing things the usual way, [Stefan] is using photogrammetric 3D reconstruction to build a camera adapter that fits perfectly in his plane and holds a camera securely.

ScanPhotogrammetry requires taking a few dozen pictures with a camera, using software to turn these 2D images into a 3D model, and building the new part from that model. The software [Stefan] is using is Pix4D, a piece of software that is coincidentally used to create large-scale 3D models from drone footage.

With the 2D images turned into a 3D model, [Stefan] imported the .obj file into MeshLab where the model could be cropped, smoothed, and the file size reduced. From there, creating the adapter was as simple as a little bit of OpenSCAD and sending the adapter model off to a 3D printer.

Just last week we saw photogrammetry used in another 3D object scanner. The results from both of these projects show real promise for modeling, especially with objects that are difficult to measure by hand.