Sliding Puzzle Generator With Tinkercad Codeblocks

by di_joseantoniosv in Teachers > 9

4281 Views, 57 Favorites, 0 Comments

Sliding Puzzle Generator With Tinkercad Codeblocks

Instructables_cover.png

In this Instructable, I will show you how to use TinkerCad Codeblocks to design a sliding puzzle generator that allows you to create your own custom sliding puzzles. You will learn how to use Tinkercad Codeblocks to create a responsive grid and frame (up to 8 x 8 tiles) for the puzzle, and customize it with Tinkercad 3D Designs.

By the end of this tutorial, you will have a fully functioning sliding puzzle generator that you can use to create your own 3D printed custom puzzles. Whether you are a beginner or an experienced coder, this tutorial will give you the skills and knowledge you need to create your own sliding puzzles using Tinkercad Codeblocks. So let's get started!

Supplies

Software CAD / CAM

  • Tinkercad Codeblocks (to create the generator code)
  • Tinkercad 3D Design (to customize the design)
  • Ultimaker Cura 3D (for 3D Printing)

Materials and tools:

  • PLA 1.75 mm (3D printing filament)
  • Scraper
  • Cutting tweezers

Rapid prototyping machines:

  • 3D Printer (I use a CR-10S from Creality)

Introduction to Parametric Design

Sliding Puzzle Generator With Tinkercad Codeblocks - Intro to parametric design

Parametric CAD (computer-aided design) design refers to a design process where design elements are defined by a set of parameters, rather than fixed dimensions. This allows for easy modification of the design by changing the values of the parameters, which in turn updates the dimensions and other properties of the design. Parametric CAD design is often used in engineering and architecture to make design changes without having to start from scratch.

With parametric CAD, the design is defined by a set of rules and constraints that describe the relationships between the different parts of the design. This allows for the creation of complex designs that are easy to modify and update.

In this way, we can say that Tinkercad CodeBlocks can act as a parametric CAD software for beginners (before they evolve into Autodesk Inventor, Solidworks, Siemens NX or another more advanced software) because it allows us to create parametric assemblies, where multiple parts are assembled together and their relationships are defined.

How Does a Sliding Puzzle Work?

ezgif.com-gif-maker.gif

A sliding puzzle consists of a grid of tiles, where some tiles are blank and others have a picture or a number on them. The goal of the puzzle is to rearrange the tiles so that they are in a certain order, by sliding the tiles into the blank space.

But how does it work? In a physical sliding puzzles there is a simple mechanism that allows the tiles to slide.

The puzzle usually consists of a frame with a rail along its inner perimeter, and the tiles are placed in the center of the frame. Each tile has a small tab or protrusion on its outer perimeter that fits along the rail of the frame. This allows the parts to slide into each other and at the same time to be held together.

Sliding puzzles can be challenging and addictive, and they are a great way to improve your problem-solving skills and your ability to think logically.

Designing a Tile

Sliding Puzzle Generator With Tinkercad Codeblocks - Designing a tile

Clustering the Tiles

Sliding Puzzle Generator With Tinkercad Codeblocks - Clustering the tiles

Filling the Grid

Sliding Puzzle Generator With Tinkercad Codeblocks - Filling the grid

Code

Sliding Puzzle Generator With Tinkercad Codeblocks - Code

In addition to sharing my code for the puzzle generator, I would love to see how you modify and use it to create your own versions of the game. You can even share your creations with me and the community! Together, we can explore the possibilities and improve the code to make it even better. Take the opportunity to bring your ideas to life and see what you can create!

Sliding Puzzle Generator code on Tinkercad

Designing a Responsive Frame

Sliding Puzzle Generator With Tinkercad Codeblocks - Designing a responsive frame

To make sure that the frame generator code works correctly, you need to ensure that the variables between both codes remain the same, before exporting the files to .stl format.

Frame generator for sliding puzzle on Tinkercad

Import the Models Into Tinkercad 3d Designs

Sliding Puzzle Generator With Tinkercad Codeblocks - Import the models to tinkercad 3d designs

Tinkercad 3D Designs not only makes assembling the parts of your puzzle easy, but it also allows you to customize the design to make it truly unique. With the help of this, you can create custom shapes, add intricate details and textures, and even add personalization like names or initials.

But be careful when importing .stl files for the first time, at the beginning they will seem to be perfectly aligned (but they are not...)

Aligning Both Models

Sliding Puzzle Generator With Tinkercad Codeblocks - Align both models

It is of crucial importance to emphasize that these models MUST NOT ALIGN CONCENTRICALLY. In order to function correctly, they must be 0.5 mm apart from each other on both sides (their centers must not coincide).

I recommend changing the view type to "orthogonal view" and the grid spacing by 0.5 mm; this way you can better control the movement of the models, try to select one of the two parts (change its color to "transparent") and with the help of the keyboard arrows move the part slightly in two directions.

If you switch the view between the side and top view, you should be able to see a slight gap separating the pieces in all views.

Export to Ultimaker Cura 3D for 3D Printing

export.PNG
cura.PNG

To print this model and make sure it worked correctly, I used the following printing parameters in Ultimaker Cura 3D:

  • Material: PLA
  • Nozzle size: 0.4 mm
  • Layer quality: 0.28 mm or 0.20 mm
  • Infill: 20% grid pattern
  • Extrusion temperature: 200 C
  • Hot bed temperature: 60 C
  • Printing speed: 45 mm/s
  • Supports: No
  • Adhesion: Skirt

Most important of all, however, is the calibration of the 3D printer surface.

3D Print It!

Sliding Puzzle Generator With Tinkercad Codeblocks - Testing
02.jpg
01.jpg

Proper bed leveling and calibration is crucial for ensuring that a 3D printer produces high-quality prints. The bed must be level and the distance between the nozzle and the bed must be consistent across the entire print surface. If the distance between the nozzle and the bed is too great, the filament may not stick to the bed at all, causing the print to fail.

On the other hand, if the distance between the nozzle and the printing surface is too short, the thickness of the filament in the first layer could be too large, closing the gaps that separate the parts from each other (generating a "solid" first layer), which could interrupt the sliding operation of the prototype.

Customize It and Play!

Sliding Puzzle Generator With Tinkercad Codeblocks - Customize it

Congratulations, you have now completed the Instructable on how to design a sliding puzzle generator using TinkerCad Codeblocks!

I hope that you have enjoyed learning how to create your own custom sliding puzzles, and that you have gained a better understanding of how to use Codeblocks to create responsive designs.

With the skills and knowledge you have gained in this tutorial, you should be able to create your own sliding puzzles with ease, and even add your own custom features and improvements to your generator. I hope that you will continue to explore the possibilities of TinkerCad Codeblocks, and that you will share your creations with me and the rest of the Instructables / TinkerCad community.

Thank you for following along with our tutorial, and happy coding!