RogerBW's Blog

OpenSCAD as a non-linear editor 01 December 2017

I use OpenSCAD as my primary tool when I'm designing objects for 3D printing. But it's also remarkably useful as a non-linear editor for existing 3D objects.

For those who aren't familiar with the term: a non-linear editing system, usually used for video or audio editing, is one that, rather than modifying the original recording, stores that original and a list of things to do to it, as it might be "reduce noise", "play this bit followed by that bit", etc. The process of editing becomes much faster, and even decisions made early in the process can easily be un-done later.

The same concept applies to 3D modelling. I can take a mesh file and load it into Blender, and muck about with it as much as I like, but while I can undo changes in the reverse of the order in which I did them, if I messed up something early in the process everything I did later is wasted.

But OpenSCAD can import mesh files. So I can import a model (without changing the original), select bits of it and remove or modify them, and export the result as a new mesh.

For example, I was working on a mailbag token for the Colt Express boardgame. (Other people had already uploaded three-dimensional replacements for all the other tokens to Thingiverse, and I wanted to complete the set.)

I didn't fancy trying to make the whole thing, but there was already a set of dungeon loot markers on Thingiverse, and I started by extracting one of those. (In Blender, because that was easiest.)

Then it was OpenSCAD time to reshape the bag (to be more "mailbag" and less "generic sack"), and to bring in the debossed text:

epsilon=0.001;
difference() {
  scale([4,2,4]) import("mailbag.stl");
  translate([0,0,-epsilon]) linear_extrude(height=0.6+epsilon) rotate([180,0,0]) text(text="$1200",size=5,halign="center",valign="center");
}

with the result:

Now, sure, I could have done that in Blender. But then I'd have had to re-do it each time I wanted a new bit of text, or to change the size or the font. This way I can have any text I like.

I did a similar thing with the existing loot markers to make Cursed Loot, which looks identical to normal loot but has a much lower value. That's just a matter of putting in new material to remove the existing debossed text (with the union() operator), then carving away at the composite object (with difference(), just as above) to put in the new text label.

There are drawbacks to this. Models are often set up far away from the coordinate origin, and need to be moved back into it. Some models are too degenerate for OpenSCAD to render, even if the original can be fed to a slicer with no problems. And, as OpenSCAD users will already know, complex models often look odd in preview mode, with missing front faces.

That's solved by not relying on preview mode, but checking that the final render comes out in one piece.

Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.

Search
Archive
Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 2300ad 3d printing action advent of code aeronautics aikakirja anecdote animation anime army astronomy audio audio tech base commerce battletech bayern beer boardgaming book of the week bookmonth chain of command children chris chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup covid-19 crime crystal cthulhu eternal cycling dead of winter doctor who documentary drama driving drone ecchi economics en garde espionage essen 2015 essen 2016 essen 2017 essen 2018 essen 2019 essen 2022 essen 2023 essen 2024 existential risk falklands war fandom fanfic fantasy feminism film firefly first world war flash point flight simulation food garmin drive gazebo genesys geocaching geodata gin gkp gurps gurps 101 gus harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo 2019 hugo 2020 hugo 2021 hugo 2022 hugo 2023 hugo 2024 hugo-nebula reread in brief avoid instrumented life javascript julian simpson julie enfield kickstarter kotlin learn to play leaving earth linux liquor lovecraftiana lua mecha men with beards mpd museum music mystery naval noir non-fiction one for the brow opera parody paul temple perl perl weekly challenge photography podcast politics postscript powers prediction privacy project woolsack pyracantha python quantum rail raku ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs ruby rust scala science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance the weekly challenge thirsty meeples thriller tin soldier torg toys trailers travel type 26 type 31 type 45 vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1