Introduction: Creating Random Art for Puzzles

Are you still making puzzles with photos? That's too easy! I'm going to show you how to create a puzzle using the power of code, and randomness, and vector art... Read on!

This project is one part code, one part art, and one part physical object. Along the way we’ll use Processing and Inkscape, and from there you can make physical object with either a laser cutter or a plain old inkjet printer.

For this project you will need:
  • Processing
  • Inkscape
  • Desktop printer -or- laser cutter
Let's start with Processing...




Step 1: Processing: Art From Code

Processing is a programming language which is fairly easy to get started with. Instead of “programs” it use what are called “sketches” which are really just simplified programs. You can create visual art with Processing in very few lines of code.

Processing is available for Mac OS X, Windows, and Linux, and you can download it from: http://processing.org/

We’re going to use Processing to generate some art, in this case, a grid of circles, which we’ll then save as a PDF file and import into Inkscape. We could just draw a bunch of circles in Inkscape, but using Processing will allow us to easily inject some randomness info the process. Our circles will vary in sizes, and the sizes will vary according to random numbers generated in the sketch, but the circles will align perfectly to a grid.

After you’ve got Processing installed, download the file "Circles.zip" so you can run the Circles.pde file. (Note that I've also included a sample output file if you just want to view the PDF for now.)

There are comments in the Circles.pde file explaining what various things do. You can adjust a number of variables by changing the numbers. Try using a higher number or lower number to see what effect it has. Processing is a great environment for artists who want to get started writing code, and the learning curve is such that many artists can get up and running with it rather quickly.

Many Processing sketches just output to the screen, and you get to see some great things float across your monitor, but since we want to create a file we open with Inkscape, we’re going to save a PDF file after our sketch runs.

It’s time to run your sketch! It’ll display a window and start to draw circles on it, and then disappear once it’s done. If everything worked properly there should be a file named “Circles.pdf” in the sketch folder along with your original “Circles.pde” file. (Files with a “pde” extension are for Processing, and files with “pdf” at the end are PDF files, don’t get them mixed up!)

Step 2: Inkscape: Importing Our Circles

If you haven’t installed Inkscape yet, that will be our next step. It’s available for Mac OS X, Windows, and Linux, and you can download it from: http://inkscape.org/

Inkscape is an amazing drawing application, similar to Adobe Illustrator, that is open source and has oodles of useful plugins. For this project we’re going to keep it pretty simple though.

Launch Inkscape, and it should create a new blank file. I’m going to resize my file to be 11.75” x 11.75” though you can always resize it to fit the dimensions of your PDF once it’s imported.

Import your PDF file into your Inkscape document, and it should show up as a large object full of circles. Select the arrow tool and then do a “Select All” command and it should create a dotted line around all the circles. Select the “Ungroup” command. If your circles do not get individually highlighted, you may need to use the “Ungroup” command a few times. (In my first test it took 4 attempts before it ungrouped all the circles.) You should now be able to click and drag across rows or columns of circles to select them, which will allow you to delete some if you’ve got too many.

Step 3: Inkscape: Adding Grid Lines

OK, now that we’ve got circles on our canvas, what do we do with them? We’re going to create some guidelines and then we’re going to draw some squares which will be used when we cut our piece apart. Start by using the magnifying glass to draw a rectangle around the first circle, and it will zoom in to make it larger. Now we’re going to see a great trick, if you look under the “View” menu you’ll see “Display mode” which should be set to “Normal” but for this we’re going to change it to “Outline”.

In outline mode you don’t see any width to the lines, just a single pixel representation of everything. We’re going to use this to put our guides in place. Create your first guide by putting the arrow tool up into the horizontal ruler and then click and drag down, and a guideline will appear. Drag it to the center of the circle so it divides it in two equal halves. Now do the same for the vertical guideline. If you want, you can do this for each row and column (it’ll make things easier later on.)

We should now have a large grid with rows and columns of circles, and the gridlines intersect the centers of each circle. We’re going to use this as our artwork... but what are we going to do with the artwork? I’ve got a few ideas...

Step 4: Inkscape: Adding Cut Lines

We're now going to prepare our file to be laser cut. (Don't have a laser cutter? Don't worry... we'll also talk about using a plain old desktop printer.)

We’ll start by drawing a few squares along the guidelines. First, create a new layer in Inkscape, so under the “Layer” menu you’ll see “Layers...” which will display the Layers pallet. Our current layer is “Layer 1” so if we click on the plus sign we’ll add another layer. We’ll call the new one “Layer 2” and place it above the current layer. (You might also want to lock Layer 1 for now, since we won’t be making any edits to it for now.)

We’ll now use our rectangle tool to draw a square. (Let’s change back to “Normal” display mode in the “View” menu first though.) I’ve drawn my square to cover 9 sections of the grid, or a 3x3 area. If your stroke is too thin it may be difficult to see, so change the stroke to be at least 1 pixel wide, and choose a color besides black, something like red is a good option. If we turn off the “Guides” under the “View” menu, things are much easier to see. We should now have one red square cutting circles in half around the perimeter, and a few full circles in the middle. We’ll copy and paste our red square and position three more until we have four squares in total, in a 2 by 2 grid. (Use the guides to help you position them, and switch between “Normal” and “Outline” display modes. (You can always delete all the extra circles that fall outside the space we’ll actually be using, or you could define more areas to be cut.)

Alright! Now we’ve got the basic design down, it’s time to prepare our file to be etched and cut by the laser. Select all of the red lines, and change the stroke to be 0.002” wide. If you’re in the “Normal” view mode, you’ll see that the red lines are just barely visible. Once that’s done, lock Layer 2, and then unlock Layer 1 and select all the black circles and give them a 0.002” stroke as well. The black lines, just like the red lines, should be just barely visible. The idea here is, we’re going to use the black lines to etch with the laser cutter, and then the red lines to cut each piece out, and we’ll end up with 4 pieces that work as a set, since they fit together. We’ve made the lines very thin (sometimes called “hairline”) so the laser cutter sees them as vector art.

Step 5: Etching and Cutting With the Laser

I don't own my own laser cutter, so I had a friend etch & cut these for me with the laser cutter his company owns. We used 3mm Baltic Birch plywood. Now, these 4 pieces don't just function as a puzzle, but they double as artistic coasters! I typically finish coasters by staining them with a light color and then attaching pieces of cork board or rubber feet to the bottom. Here’s what the completed coasters look like.

(I've also included a "WRONG!" photo so you can see how it looks when you solve the puzzle  incorrectly. Oh, and there's also a nice photo of the coasters in action.)

Laser cut puzzle coasters may seem a bit weird, but just think of the fun your guests will have at your next gathering as they get to know each other by trying to solve the puzzle by arranging the coasters in the correct order.

Step 6: Alternative to Lasering

What's that? You don't have access to a laser cutter, or you're just incredibly cheap? Don't worry... we've got you covered.

With the basic techniques we've used, you should be able to modify what we've done to print your design on paper, and then with a bit of spray glue you can attach your printout to some art board and then cut out the pieces with an X-ACTO knife and a metal edged ruler. I ended up printing two sheets, one with just the circles, and one with the circles and the cut lines, and then taping the cut lines version directly on top of the circles version before cutting. This let me use the guides to cut but not have them show in the final piece.

From here you can use your imagination! Don't limit yourself to circles and squares, try squares and squares, or hexagons, or octagons, or.... As long as you bisect the shapes, you can create some interesting puzzles.

The 16 piece puzzle I made took my 13 year old daughter about 25 minutes to solve, with my help of course. :) My plan from here is to create more complex and larger puzzles, hopefully with a laser cutter as it'll create more durable (and beautiful!) puzzle pieces.

Comments

author
Frivolous Engineering (author)2012-09-19

Well done!

author
MercuryCrest (author)2012-09-17

Excellent! I suspect that this will be my first foray into Processing....

About This Instructable

2,605views

2favorites

License:

Bio: I like to design things, and build things, and hack things.
More by rasterweb:littleBits Serial ControllerlittleBits Serial DataPlacas de impresión hechas con un cortador láser
Add instructable to: