Tinkercad Coding Tricks To Automate Modeling

If you want to do a quick design for 3D printing, Tinkercad is pretty easy to use. Although it was briefly in danger of going out of business, it was bought by AutoDesk who have made a lot of improvements. It is possible to program and simulate an Arduino in the same tool — which always strikes us as an odd juxtaposition. However, [Chuck] shows us in the video below how you can use the same Codeblocks to automate Tinkercad 3D modeling thanks to a beta feature in the software. Think of it as a GUI-based OpenSCAD in your browser.

You have to start a Codeblocks project, and when you do you can pick a starter design or just press the button for a new design to get a blank slate. The blocks look like other Scratch-related programming languages. You can create variables, repeat groups of commands, and create items. [Chuck] mentions the starter codes have no comments in them, which is a fair critique. There is a comment block you can use.

Many of the blocks have an arrow that makes them expand so you can see all the different parameters within. This makes the code easier to read and a bit more compact than it would be otherwise. Most of it is pretty easy to figure out, but there doesn’t seem to be much documentation. For example, it took us a while to realize “edge” on the cube block was how rounded the edge is.

Of course, like any language, you can use it smart or use it stupid. Setting the parameters at the top and deriving measurements from them as the example does, is certainly a best practice. Just plugging numbers in is only a little better than using the conventional GUI. Note that you can’t flip back and forth between graphic design and blocks. What you can do though, is export your result as a Tinkercad part that you can use in a regular design.

We liked how [Chuck] drew a table in the normal way and then showed the advantages of doing it with the blocks. What we always hate with these block languages is how hard it is to delete one block out of, say, a loop. You have to grab the block you want to delete and move it, which moves everything under it as well. Then move all the blocks under that block a second time to put it back where it belongs. Then you can delete the newly-orphaned block. Too much work!

We’d love to see some of the quasi-parametric things we’ve seen before in Tinkercad done like this. On the other hand, if you don’t mind installing software there is always SolveSpace.

19 thoughts on “Tinkercad Coding Tricks To Automate Modeling

    1. I did, but the punishing error dialogs in SolveSpace-speak and the freezing up trying to render a model from an inported DXF made me give up and go back to OpenSCAD. I haven’t looked back.

      1. I hear your pain over SS. I wasn’t even through the first official tutorial before it threw up an error that made zero sense to me. I’ve never used an app that more made me want to destroy my keyboard in pure rage. Fortunately, FreeCAD is also constraints-based, and it works just fine. Even better, it comes with as OpenSCAD workbench, so you can design components with an .scad script, right inside FreeCAD then use them with something else. There is even a Cura engine plugin for it!

    1. That’s the rub, isn’t it? Cloud applications are great for developers, terrible for users. For the developer, it means you can release it before it’s really ready, and fix bugs as they show up. For the user, for something with a learning curve, like any CAD system, it can change at the developers’ whim, either obsoleting a feature that’s critically important to your project, or introducing new ways of doing things, with their own learning curves. Or, surprise, a “free” application becomes subscription-only overnight, or BIG surprise, the company goes belly-up and the servers go away. Time after time, I’ve read about some cool new application, and then had to say, “oh. nevermind”, on discovery that it’s online only.

        1. There is a way to make this business model work for everyone: they can charge a nominal fee for the service and make a contract whereby the service is guaranteed to function; if the provider breaks the contract, then a third party, holding the source code in escrow, will release the source code to the customers, probably by releasing the code with an open source license. This type of setup is common with proprietary business software. The problem with this business model is that the software itself is not a considered to be a good asset, because it becomes worthless if the company becomes insolvent.

          1. It becomes worth less than nothing, if you have active projects that depend on software that suddenly becomes unusable. What happens when you design a printed circuit board using XYZ.com, which uses a proprietary project format, and XYZ corporation fails, or just loses interest in your market? The next time you want to make a change to the design, you have to start from scratch.

            The problem is that the subscription model is extremely attractive to software producers. If you sell someone software, you got some money from them one time, and they get to use the software over, and over, and over, without paying you another cent. The only way you make money from them again is when you produce a new version with improvements that are useful to them. And not only that, but you have to sink money into developing these improvements, to be paid back only if the market finds them to be valuable.

            If you sell them a subscription, the users pay in advance for future development, and they have to pay as long as they want to continue using your software, even over periods of time when they’re not using it. Using the PCB design example again, if I have a project that needs a printed circuit board, I need the design application for a few days at a time, and if I do four projects per year that need PCBs, I have to go on paying for it continuously even though I rarely use it, because the subscription model usually works on a year-by-year basis.

            I agree that this would be improved by some kind of follow-on guarantee, but this depends on some other company finding enough value in the customer base of a given software package to take over. I don’t see how anybody can guarantee this.

  1. “Think of it as a GUI-based OpenSCAD in your browser.”

    Well, okay. I am just as bewildered by this as I was by Scratch, or by “web editors” that let you drag and drop code elements onto a worksheet. How is it easier, more intuitive, or in any other way better to drag something from a toolbar to a worksheet, than it is to just type the name of that something in a text editor??? You still have to do any of the thinking necessary to implement whatever logic is required, and I know not everybody is a fast typist, but I’ve always found it awkward to drag things into a sequence, compared with just typing them in sequence.

    About all I can think of is that the toolbar gives you a kind of instant reference card reminding you of what the available modules are, along with the corresponding list of possible arguments. Which from what I can tell isn’t an improvement at all over, well, a reference card for the underlying language.

      1. Ostracus: whole different thing, if I understand your point. In the case of POV-Ray, you write code in text that defines geometric objects, much like in OpenSCAD. Most CAD programs are fundamentally different, in that you use a graphical display to draw the shapes of geometric objects, which is a completely logical application of a graphical interface. What is being described here is more like POV-Ray or OpenSCAD than other CAD systems, since the graphical interface is used to move abstract objects (effectively, blocks of text) that have no visual correspondence to the object being described. That is, what you draw using the graphical interface doesn’t look at all like the thing you’re describing. And yes, I do see that there is a rendering of the object on the screen, just as there is in OpenSCAD, but unless I’m completely missing something, you can’t alter the object using that portion of the display.

        I’m not saying that this is useless – I use OpenSCAD, and find it easier to use than most CAD programs, especially when trying to make changes to a design. I’m just saying I don’t see the point of the graphical aspect of the user interface.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.