Sunday, April 13, 2014

Day 230 - Sofamaker

It's official; we are moving to NYC this summer! This means downsizing from a house to an apartment, and some interesting furniture decisions. To help sort things out (and to procrastinate actually packing for as long as possible) I wrote a customizable sofa generator in OpenSCAD, and used it to model our sofas:

Technical notes, OpenSCAD flavor: The code below makes sofas in the same way that we made knots in Day 153, by using hulls of collections of spheres. For example, the sofa code starts by forming an upright rectangular solid to make the back of the sofa, with eight spheres placed at the corners and then hull() filling in the space between by taking the convex hull of those eight spheres. Of course we could also have used the cube() command to make the rectangular solid, but taking the hull of spherical corners is what gives our sofas a rounded, comfy look.

We used a scale of 1:50 for these models (meaning that our furniture is fifty times as long, wide, and tall as these models) and a conversion factor that allowed us to enter our dimensions in inches. For example, one of our sofas has depth 59", length 70", and height 32". To convert these to inches we have to multiply by 25.4, since there are 25.4 millimeters in an inch. Then to make the scale 1:50 we divide by scale=50. In the future we'll add the ability to scale automatically to certain types of graph paper.

Yes, I noticed this dimension problem and tried to ignore it... but it did make a noticeable difference so I am going to do what you just suggested when I write the general program for all the furniture on Sunday and post to Thingiverse. I appreciate your refactored code as well - a cuboid module is definitely wise to construct since I have to use it over and over. Thanks!