Introduction: Create Country Flag With Tinkercad Codeblock Editor

Simple shapes are all around us. If we notice the basic shape, we can make it in 3D model using the tinkercad.

Most of the flags are made from simple shape. And complicated logo also have many basic shape in it.

If we find simple flag, we can code the shape with the Codeblock Editor.

This is example of code using Tinkercad Codeblock Editor.

Supplies

You need a laptop or a PC.

Open tinkercad website. Make sure to register/sign up with the tinkercad.

https://www.tinkercad.com/codeblocks

Step 1: Find the Flag With Dimension If Possible

In order to make an accurate flag , you will need an image of the flag with dimension if possible.(construction sheet)

The dimension of the flag will be use to put the coordinate in the block later.

I choose my country's flag and the image i get is in the wikipedia. Here is the link to the image.

Step 2: Find the Basic Shape Inside the Image

Find the most basic shape you can find in your flag:

  • circle/oval
  • rectangle/square
  • triangle
  • star


Step 3: Coordinate in Tinkercad

How the coordinate works in tinkercad ? Lets consider the 3D model/environment is a little extra thing to mind , because in 3D we have extra Z -axis. Lets look at my first image above. You can see which is x, y or z axis.

Now look at second image, you will notice which direction is positive or negative . This is important because we want to put the value (interger) either positive or negative number.

Refer to the topic of Cartesian coordinate system for more detail.

Step 4: 3D Model's Coordinate in Tinkercad

For every shape you put inside the codeblock, the center of the shape will be the coordinate of that 3D model.

For example if you put basic shape like box, with the parameter W = 20 ,L = 20, H = 20 , and then you put MODIFY Block , Move to X = 0 , Y = 0 , Z = 0 , the centre of the box will be at that coordinate.(refer to the image, which i circle the red one) . So if move around the coordinate, you will notice the centre of that model will move according to your input value.

Step 5: Put the Shape in Your Tinkercad

Now its time to look back at the image and start to code!

First, decide where you want to put the flag in the 3D axis.(the workplane). Refer to the image provided.

For my project, i choose the x and z axis workplane.(the FRONT) Now you have to decide where the flag will appear in that workplane. Refer to the image. This action cannot be done in the tinkercad. I just edit in inkscape to let your imagination attach to the workplane. :)

Next you pick the scale of the image to the 3D workplane. I pick the ratio of 1:1 . So its easy to code.

  1. Now i make my first 3D object, which is the blue rectangle in the flag. I create a new Object with Shape of Box with the following parameter.( W = 14 , L = 8 , H = 2 ). Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7 , Y = 0, Z = 4) .Rename the object1 to your prefer. Refer to the image.
  2. Make a new object2. You can rename it. Insert the new shape of Cylinder with parameter :Radius (3) H (3) Sides(50). Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -8.25 , Y = 0, Z = 4) Create another cylinder with TRANSPARENT color, Radius (2.67) H (3) Sides(50). Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7.58 , Y = 0, Z = 4) . Then make these two cylinders group together by Block (Create Group)
  3. Create a new object (Star) with parameter Sides(14) Radius(2.5) Inner Radius (0.4) H (3). Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -5.25 , Y = 0, Z = 4) .Refer to the image.
  4. Now we want to create red stripes on the sides with dimension of 14 by 1. We use Create New Object block, and Create Variable named RED(rename the item into RED, value of Z-coordinate of red stripes) with a value of 7.5. Next we put a control block , Repeat (value = 4) Times (the reason is we have 4 red stripes). Inside this LOOP parameter, we create a box with ( W = 14 , L = 1 , H = 2 ) . Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7 , Y = 0, Z = RED (variable)) . We put another Math block Change (RED) by (-2) .So the next stripe will be below (by -2) the previous red stripe.Refer to the image.
  5. We have successful create the 4 red stripes, now we want to duplicate the step (4) with a different of WHITE stripes only. Use Create New Object block, and put block Create Variable .Rename item into WHITE( for value of Z-coordinate of white stripes) with a value of (6.5). Next we put a control block , Repeat (value = 4) Times (the reason is we have 4 white stripes). Inside this LOOP parameter, we create a box with ( W = 14 , L = 1 , H = 2 ) . Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7 , Y = 0, Z = WHITE(variable)) by (-2) .We put another Math block Change (WHITE) by value of (-2) . So the next stripe will be below (by -2) the previous white stripe.Refer to the image.
  6. Next I choose long red stripes.Use Create New Object block, and put block Create Variable .Rename item into LongRed ( for value of Z-coordinate of long red stripes) with a value of (-0.5). Next we put a control block , Repeat (value = 3) Times (the reason is we have 3 long red stripes). Inside this LOOP parameter, we create a box with ( W = 28 , L = 1 , H = 2 ) . Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7 , Y = 0, Z = LongRed). We put another Math block Change(LongRed) by value of (-2) .So the next stripe will be below(by -2) the previous red stripe.Refer to the image.
  7. Next I choose long white stripes.Use Create New Object block, and put block Create Variable .Rename item into LongWhite ( for value of Z-coordinate of long white stripes) with a value of (-1.5). Next we put a control block , Repeat (value = 3) Times (the reason is we have 3 long white stripes). Inside this LOOP parameter, we create a box with ( W = 28 , L = 1 , H = 2 ) . Then rotate around (x- axis) by (90) degrees from Pivot (X=0 , Y = 0, Z = 0) . Move to (X = -7 , Y = 0, Z = LongWhite). We put another Math block Change(LongWhite) by value of (-2) .So the next stripe will be below(by -2) the previous white stripe.Refer to the image.

Step 6: Done! You Get Your First 3D Model by Code

You can view the finish code in here - https://www.tinkercad.com/codeblocks/jPvXQDxY33r

Block Code Contest

Runner Up in the
Block Code Contest