welcome to this video, which is designed tointroduce you to beetle blocks. beetle blocks is a new tool for making 3dmodels. it offers some unique and exciting ways touse simple blocks of code to generate models that can range from simple to incredibly complex. beetle blocks is different from most traditional3d design tools, such as autodesk 123d design, currently being shown on the screen. these tools are great for building simpleand complex models that start with geometric shapes, and typically we interact with thosekinds of models by either dragging out 2d or 3d objects, defining their size, and thenusing various tools such as fillet, currently
being shown on the screen, to modify thoseshapes. beetle blocks is totally different from thisapproach, however, and we’ll see some differences in the ways that we use beetle blocks, alongwith examples of the kinds of models that it can produce, in this first video. one big difference between beetle blocks andlots of other 3d design tools is that beetle blocks is software that runs in a web brower. currently, it only runs in google chrome,but once you have the web site pulled up, you can launch beetle blocks directly inside your browserwithout having to install special software. you can create an account in beetle blocks, and use thisto save your projects directly to your browser,
or to the cloud. let’s take a look at an example of a firstbeetle blocks project. you’ll notice there are three main sectionsto the beetle blocks window. there’s the code blocks on the far left,the area where we can connect code blocks in the middle, and then the 3d window on theright. above the 3d window are several tools, includingthe green flag and a red stop button. this is how we will generate our 3d models,and where we’ll see them. to start creating a 3d model, we’ll startdragging blocks out of the code column in the left, and into the code creation areain the middle.
as you might've guessed from the name, thestar of the show in beetle blocks is the beetle. the beetle is the object that we use to movearound and generate 3-d objects, and if we zoom in, you can see the beetle itself, sittingthere in the 3-d window. now, in order to make 3-d object in beetleblocks, we need to tell the beetle how to move, where to move, and how often to do it. so we'll start with the code block from theleft. typically we'll start a program in beetleblocks by using some kind of event. the most common event that we use is whenthe green flag is clicked, so i'll drag the "when green flag clicked" block into the codewindow.
now i need to tell the beetle what to do,so i'll go to the motion category on the left, and drag out a block the tells the beetlehow far to move. if i press the green flag, we can see thebeetle move one space by changing this number, i can make the beetle move furtherdistances, such as three spaces. you'll notice that the beetle starts movingfrom the last position that it was at, so rather than going back to the origin in the center, the beetle will continuemoving from wherever it's currently placed. if i want the beetle to go back to the center andto clear out anything i've done i can use a special block called reset. often times in beetle blocks programs we'll use resetas a way to make sure that whatever thing
we're generating starts from the beginningand clears out anything that might've been there before. so now when i press the green flag the beetlewill start at the origin and then move three spaces. so far you've seen the beetle move in just one direction. but because beetle blocks is a 3-d program, the beetle can move in any of threedimensions. let's tell the beetle to slow down a littlebit in between moves so that we can see this a little more easily. i'll drag out a "wait one second" block inbetween each of our blocks of code, so we see the beetle return to the origin, and thenmove three spaces.
after the beetle moves, let's tell it to rotatearound the z axis, and let's tell it to rotate 90â°. so now our beetle will return to the originwith its reset, wait one second, move three spaces, wait one second, and then rotate aroundthe z axis by 90â°. the z axis is the blue axis that we see rightaround here and we'll see what that looks like. so i'll press the green flag, and let's takea look. notice that the beetle has now turned 90â°and if we move three spaces again we can see that the beetle will now be moving in thatdirection.
again, i'll add a "wait one second" blockso we can watch the beetle a little more easily. now, in addition to simply moving, we cantell the beetle to start generating a 3-d object, and that's where the real power ofbeetle blocks starts to come in to play. let's take a look at shapes. in our shapes category, we can tell the beetleto start extruding, and extruding simply means leaving a trail of three-dimensional shapebehind it as it moves on its path. so after our reset here, let's add a new blockcalled "start extruding". i'll drag this block in here and now reconnectour wait block, and let's take a look at what our beetle does now.
you'll notice that our beetle has now lefta trail of solid three-dimensional object. i can orbit around that in our 3-d windowand we can see what that looks like. that's not the only way our beetle can move,however. in addition to extruding curves, it can alsoextrude lines. let's take a look at the difference betweenthose two. you may have noticed that instead of tryingto make a curve between the points, our beetle is now moving in straight lines. there are curves at the edges but that's simplybecause what our beetle is extruding looks like a tube or a sphere.
if i wanted to complete a three dimensionalsquare, i could simply tell my beetle to move and turn two more times. one powerful tool in beetle blocks, however,is the ability to tell it to do those things multiple times with code instead of havingto simply drag out blocks multiple times. in coding, a common control structure fordoing that is a repeat. we want to move and rotate around the z-axisfour times to make our square so we'll drop just those blocks into our repeat. once we connect up the repeat, we'll takea look at the entire piece of code. we can see now that our beetle has moved allthe way around our square, leaving a trail
of 3-d object behind it. we can always run our code and change it to see what thatwould look like with a curve instead. as you can see, we've now made a relativelysimple three-dimensional object with just a few blocks of code. let's take a look at some more advanced examplesusing these same techniques. we'll start our next program in the same waythat we started the first program, which is using the control block "when green flag clicked"to start the program. each time our program runs, we'll want toreset the beetle, so we'll drag a "reset" block out as well.
now what we'd like to do in this program ishave the beetle move in a circle, or at least close to a circle. a circle has 360â°, so we need to tell thebeetle to move 360â° in a circle which means a combination of moving and turning to dothat. just like before, we'll use a control blockcalled "repeat" in order to tell the beetle to keep doing the same motions over and over. let's drag our repeat out and, since 360â°divided by 10 is 36, we'll tell the beetle how to move using that number. we'll tell the beetle to move one space andthen rotate z by 36â°.
36 times 10 gives us 360, so let's take alook. in order to see more clearly what the beetleis doing we'll use the same technique as we did earlier, and we'll ask the beetle to simplywait .5 seconds in between each of these moves. let's take a look and see if the beetle movesin a circle. it's not a perfect circle but we can see thegeneral outline. this will be easier to see if we go into ourshapes menu and tell the beetle to start extruding. that will leave the shape behind so we canmore easily tell if the beetle is doing what we want it to do. let's take a look now.
as you can see, the beetle definitely moves ina circular direction, but we can see lots of the angles where each of those turns occurs. let's tell it to do 20 repetitions and changethis by half. now the beetle will make twice as many movesand turns, but each one will be smaller, getting us closer to a perfect circle. because we can pretty easily see what thebeetle is doing, let's get rid of those wait blocks. one thing that can be a little tricky withbeetle blocks is that we have to detach the blocks that we don't want from the bottomto get rid of them, and then drag them away.
so i'd like to get rid of both wait blocks;i'll drag them back over to the side and then reattach my rotate block. that will make our beetle move a little bitfaster, so we can test this out. so we've made a pretty nice looking ring butlet's add a few layers going up of the same ring. if we want the beetle to do that, we needto tell it to not turn but move its z position. in another words we want to beetle to moveup in the z-axis after it's made this first we can do that with a different motion block. instead of turning or rotating in the z axis,we'd like to change the absolute z position
of the beetle, meaning we want it to moveup one space in the z-axis. so after it does, this let's change the absolutez position of the beetle. let's run this and take a look. you notice that, as the beetle moves up one,it already starts extruding this little bit right in here in the next layer. and let's see what this would look like ifwe did this two times. just like before, when we want something tohappen more than once, instead of dragging out those same blocks over and over, we'llgo to our control structure and we'll use a repeat.
we'll put both of these blocks inside of ourrepeat and let's look at what this would look like if we did this three times. here, you can see that our beetle has leftthree sets of trails, but because we're doing our "change absolute z" inside our repeat,what's happening is that the beetle is using this to rotate and move in its circle andthen change this, we're getting an extra little nub at the top. so let's do this: after our beetle moves inits circular pattern, let's tell it to stop extruding. that way, when it moves up, it won't leavethat extra little nub at the top.
in order to do this, we're going to move our"start extruding" block into this repeat. and what we'll do is tell it to stop extrudingbefore it changes its position. so now what our code says is to repeat thisthree times: start extruding, move in a circular pattern, stop extruding, move up by one. let's take a look. you'll notice that our beetle is still therein the middle, hanging out right above our rings. now, if we'd like to take this one step further,we can get some input from the person that's running the program, so instead of three layershigh, our ring structure can be as many as
we like. and we can do that by getting some input fromthe person that's running the program. let's say that when the green flag is clicked,we'd like to find out how many layers this structure should be. when the person types in an answer, that willappear as this block right here. this is a variable that beetle blocks comeswith that just lets us get the information that the user typed in. one thing that would make sense here is toswitch the positions of our reset block and our request for user input, so that the screenis cleared before we get our user input.
let's click the green flag now. how many layers high? let's try five this time. so what you've seen now is a powerful wayto use a few relatively simple blocks of code to make a relatively complex object. we could do this with a traditional 3-d modelingtool as well, but this give us a very different way to approach 3-d modeling. since one of the really interesting uses of3-d modeling is 3-d printing, let's take a look at what it takes to export a beetle blocksmodel and get it ready for 3-d printing.
to do this is very simple. we're going to come up to the menu here inbeetle blocks, we're going to choose "download 3-d model as stl", and our stl file will download. at this point depending on the type of softwarewe're using to control our 3-d printer, the process will look a little different, buti'll show what it looks like using the software cura. cura is software that lets us take a 3d modelfile that's been saved as an stl file, and send it to our 3-d printer. in cura, i'll place the 3-d model file thatwe downloaded as an stl file file so that
it can be 3d printed. so i'll load the model file, and now we cansee the object that we modeled in beetle blocks represented on the bed of our 3-d printer. because it's relatively small, i can scaleour model some, in order to make it a little easier to see, and bigger, as we 3-d printit. using cura's controls, i can also change itsorientation by rotating it, and it will automatically update to show me how much time it estimatesthis file will take to 3-d print. currently it's showing that this will take53 minutes to 3-d print this object. let's watch as the 3-d printer generates aphysical representation of what we made in
beetle blocks. the printer i'm using here is a printrbotsimple, which is an inexpensive 3d printer that my son and i actually assembled together. if you're interested, i'll put a link to thatvideo in the description of this video. many 3d printers use this same type of technology,called fused deposition material, or fdm. basically, these printers work by heatingup plastic filament, squeezing it through an extruder, which is the red end shown inthe video here, and repeating that process over and over to build up very thin layersover time. so an object begins from the bottom, and thenis built up with those layers of plastic, building
one on top of the other. let's watch the 3d printer as it goes. you can see the 3d printer moving in all 3dimensions. the bed of the printer, with the blue tapeand the object, is moving in the x direction. the head of the 3d printer is moving backand forth in the y direction. and, although it's hard to see, over a timelapselike this you can start to see the object itself being built up, which is a result ofthe arm of the 3d printer moving up in the z dimension, just like we saw in beetle blocks. so here's the finished printed object.
you can see that it has five layers of rings,just like the object that we designed in beetle blocks. and it's pretty amazing to be able to pickthis up, hold it, and move it around, to see
design 3d models for printing,something that started out as code turnedinto a 3d object. thanks for watching this video! if you enjoyed it, leave a comment below,and i may be able to produce more videos demonstrating some of the amazing things you can do withcode and 3d modeling using beetle blocks.