beanz Magazine

Creating a Jigsaw Puzzle

Greg on Flickr

Slice digital photos into pieces and have fun pasting them back together.

If you haven’t completed the previous SketchUp projects in this magazine, here’s where you need to go for the modeling application:

my.sketchup.com

This is the web-based version of SketchUp. There are versions you can download and install to your computer as well. But the project steps will be listed for the web version.

In this project, we’ll create a jigsaw puzzle from an image. Here’s the image I’m using, found during a search for “candy” in Google Images:

For whatever image you want to use (or create), make sure it’s saved somewhere on your computer.

After you go to the SketchUp page and launch your modeling session, here’s what you should see: a man (Josh) standing on the ground with axis lines around him. The red and green axes are on the ground, blue is for the vertical direction.

There’s no need to have Josh standing on our puzzle, so click the Eraser icon or press the E shortcut. Click on any edge of Josh to erase him.

Since the puzzle is supposed to lie flat, on the “ground,” we need to switch to a bird’s eye view – looking down on the ground from above. On the right side of the window, click the Views icon.

Click the icon that looks like the top of a house.

This is the view you should see now: looking straight down onto the red – green plane.

Now we can bring in the image. From the icons at the top left corner, click the Folder icon, then choose Insert.

Because the image is stored on your computer, click the computer icon.

Browse to where you have your image and choose that file to insert. Then SketchUp will ask how you want it inserted: as a material or an image. Materials are used to paint faces that already exist in a model, and we don’t have any faces yet. So choose Image.

Click the first corner, then move the mouse to get the image to the size you want, and click the second corner. (The size doesn’t really matter, since you can zoom in and out.)

An image in SketchUp isn’t really useful – it can’t do anything except just sit there looking pretty. But we can make an image into something usable. Right-click on the image and choose Explode.

Now we have a regular SketchUp face, with four edges, painted with the candy image.

Now that we have a face, that face can be divided up into puzzle pieces. But it’s a lot easier to break up the face while the picture itself isn’t showing. So we have to change the model’s style – the way the model is displayed. Click the Styles icon.

In the Styles window, click the magnifying glass icon to get the list of standard styles.

Open the “Straight Lines” category, because these styles have blank faces. Choose any style from this list.

Now the face is plain white, surrounded by a white background.

Press the L icon for the Line tool. Draw one line that goes from the top edge of the face to the bottom. You can make your lines perfectly vertical and horizontal, or make them slightly slanted.

Complete the lines that divide the face vertically.

Then add some that divide in the horizontal direction.

Now you’re probably thinking it’s time to move these pieces around. But not so fast – there are a few more steps needed before this. To see why, activate the Move tool by pressing M. Move your cursor inside one of the small pieces to see the face highlight.

Click inside the piece to start the move, then try to move the piece away. All of its neighboring pictures are dragged along with it – the piece can’t separate completely from the rest of the pieces.

If you didn’t complete the move, press the Esc key to end it. If you did complete the move, use Undo (Ctrl + Z or Cmd + Z).

What needs to be done now, before the pieces can be moved, is to make each piece a group. In SketchUp, groups are used for several things. In our case, a group will “wrap” each piece as its own object, not connected to any objects around it. For our first group, active the Select tool (press the Spacebar), then double-click the first little piece. This selects both the face and its four edges.

Right-click on the selected face and choose Make Group.

Now activate Move again (M key) and move your cursor over the new group. What’s highlighted now is the entire group, not just the face that was highlighted before. The little red “plus” signs are used to rotate the group – we don’t want to do that (unless you want a really hard puzzle).

Click the piece to start the move, slide it away from the rest of the puzzle, and click again to “drop” the piece.

Now you know the steps needed to make each piece movable: Activate Select and double-click the next piece. Make that piece a group. Repeat one by one for each piece – it’s easiest to just go along the rows in order.

Then, when each piece is a group, activate Move and slide each one away. Here are my scrambled puzzle pieces:

Now we need to change the style back, so that the image becomes visible again. Go back to the Styles window, and click the House icon. This shows a list of all styles in your model. The one we want is the original style – the one with colored faces and not blank ones.

Now we can start to solve.

When solving the puzzle, just keep the Move tool active the whole time. Find two pieces whose edges line up, like these two shown below:

Click a corner to start the move…

…and join that corner to the corner where it lines up.

Keep moving pieces, one by one, until all your candies are unscrambled.

You can try this project with puzzle pieces of all different shapes. You can use arcs instead of (or in addition to) lines, or try making actual jigsaw shapes with little arc bump-outs.

For a really neat version of this, use an image that has a written message for a friend. Scramble the pieces have your friend solve for the message.

Learn More

SketchUp Official Website

https://www.sketchup.com/

SketchUp Free Web-based App

https://www.sketchup.com/products/sketchup-free

Also In The April 2018 Issue

Logic puzzles help develop reasoning skills useful for programming, computer science, and anything you might do.

Find perfect and fun gifts for your loved ones that teach STEAM concepts and skills.

From light-up bow-ties to conductive thread, you’ll be the life of the party with this STEAM-inspired gear.

A free online test service reveals how much personal data your web browser is giving away.

Add more tools to your command line arsenal, including running mini-scripts and making backup copies.

Use switches to take your robotic creations to the next level.

An old classic with a electronic twist, featuring JavaScript and micro:bit.

Create the American flag in SketchUp using this detailed tutorial.

From lasers to supernovas, Berboucha is making science communication a priority.

Code can always be improved. Check out these tips to make you the best programmer you can be!

It’s a programming language unlike any you’ve seen before. Check out this symbolic system designed for mathematical calculations.

New, improved, faster, and sleeker - it’s Scratch 3, your new favourite block language!

Learn about the brilliant algorithm behind all of your GPS devices.

It’s free, comprehensive, and available on-the-go. This cool app helps you master Python faster than ever before.

Open up whole new worlds to explore through these interesting, diverse add-ons.

Links from the bottom of all the October 2018 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for October 2018.