Tuesday, July 19, 2016

Create a Rounded Cube in OpenSCAD


There are two ways to easily make a rounded cube. The first is to use the hull function:

module RoundedCube(size, radius) {
    width = size[0];
    height = size[1];
    depth = size[2];
    
    hull() {
        translate([radius, radius, 0]) cylinder(r = radius, h = depth);
        translate([width - radius, radius, 0]) cylinder(r = radius, h = depth);
        translate([radius, height - radius, 0]) cylinder(r = radius, h = depth);
        translate([width - radius, height - radius, 0]) cylinder(r = radius, h = depth);
    }
}

The second is to use linear_extrude and the offset functions:

module RoundedCube(size, radius) {
    width = size[0];
    height = size[1];
    depth = size[2];

    translate([radius, radius, 0]) linear_extrude(height = depth) offset(r = radius) square([width, height]);
}

Now they aren't exactly identical. They will produce slightly different rounded cubes, but hopefully this helps someone out there use OpenSCAD.

Monday, July 18, 2016

Photographing People

A while back I ran into Joe Edelman YouTube channel. If you want to photograph people and use flash this is a very good channel. Specifically I suggest checking out One Light Portrait Lighting for AWESOME Portraits & Headshots.



Wednesday, July 13, 2016

Remove Every Other Line in a Text File

Once in a while a while you need to remove every other line in a text file. It's really easy to do with awk from the Terminal:

awk 'NR % 2 == 0' infile > outfile

There are obviously a lot of ways to accomplish this simple task but this is by far the easiest.