Autodesk Creative Platform Core Version 1.19.0
A broad and deep collection of 2D and 3D capabilities.

Tinkercad's Gen6 Geometry Kernel

The geometric modeling kernel, or geometry kernel, is a core component of any Computer Aided Design system. Tinkercad uses a custom in-house kernel called Gen6. The purpose of this document is to give an introduction to how Gen6 works to help you better work against the Script APIs.

Gen6 is very similar to other geometry kernels in that it operates on a geometry tree called the Design Tree. The input geometry to Gen6 can either be precise analytical geometry, also called boundary representations, or mesh data represented by triangles. The output can be a triangle mesh for viewing or special files designed to drive devices like 3D printers. A very distinctive feature of Gen6 is that it has been designed from the ground up to run in a server cluster utilizing thousands of CPU cores. In practice this means that Gen6 can perform computations which would take minutes or hours using other geometry kernels in just a few hundred milliseconds.

Gen6 is the sixth-generation production quality geometry kernel developed by Tinkercad Inc. Like its five predecessors Gen6 was built from scratch utilizing the knowledge learned from operating the previous kernels in production. The architecture and core algorithms of Gen6 finally satisfied the target performance envelope so a seventh generation is highly unlikely during the next decade; instead development will focus on improving Gen6.

Design Tree

Every design in Tinkercad is represented by a Design Tree where the nodes are Solids or Groups. Every solid is generated by a script that takes as input user parameters and optionally an external file. Scripts that only take user parameters are called Shape Generators, scripts that operate on external files are called Import Scripts.

A group is a container node that can hold either solids or other groups. The group places its children in two sets: the add set and the sub set. When Gen6 evaluates a group to determine what kind of solid it represents it does a few solid boolean operations. First Gen6 forms two new temporary solids by doing a union on all the shapes in the add and sub groups separately. Then Gen6 creates the final result by subtracting the sub solid from the add solid. The resulting solid is then used in further calculations.

Shape is a term used in the editor UI. From the perspective of the Gen6 and the Script API a shape can either be a solid or a group. When the editor user groups their selection together to create a new shape they are actually creating a group in Gen6.

Scripts

Tinkercad is extended by writing Scripts using the JavaScript language. The Script API provides a specification of what functions and libraries are available in the JavaScript environment. While all scripts are created and edited in the Tinkercad editor they don't actually execute in the browser. The scripts are uploaded from the editor client to Gen6 and executed in the server cluster. This is also why the JavaScript environment is very different from a typical browser environment, the server runtimes only expose a small necessary set of functions for each script.

The output from Shape and Import scripts is always a solid. Sometimes the solid is defined using analytical interfaces in the API such as Path2D combined with extrude. For other scripts the output is a mesh consisting of triangles. An integral feature of the internal solid representation in Gen6 is the ability to use this triangle mesh to always correctly represent a solid. The internal representation is unaffected by problems in the triangle mesh like holes or intersections. The algorithms are designed to mimic human perception so that the solids are as close to what a human observer would expect.

Performance

The Tinkercad Gen6 kernel has been built from the ground up to be a aggressively distributed kernel running in a dedicated server cluster. The primary focus has been on decreasing the rebuild time for a single Design Tree, when talking about scaling the numbers always refer to evaluating a single Design Tree. The architecture of Gen6 is designed to scale to tens of thousands of CPU cores. The current version of Gen6 running in production only has a handful of the planned distribution options enabled and scales to several hundred CPU cores. Gen6 obviously supports a large number of concurrent users so the actual cluster can be a lot larger to increase throughput.

The internals of Gen6 are implemented in Go and tightly optimized C. The script API has been carefully designed to allow scripts to be evaluated aggressively in parallel. The script API is also focused on handling higher level objects and leave the low level operations to the core Gen6 code.

When Gen6 is evaluating a Design Tree it will always externally behave as if the whole tree was evaluated from scratch. This includes re-running shape and import scripts. There are however a number of caches both in the editor client and server side that speed up some of the operations but also decrease network traffic between the client and the server cluster.

Units and output precision

The base unit for Gen6 is the millimeter or 1e-3m. The editor user can display different units in the user interface but inside the kernel everything is handled as millimeters. All the coordinates and distances created by scripts are in millimeters, any conversion needs to be handled in the script itself.

A key concept in Gen6 is the output precision. Several output targets like 3D printers operate at a fixed precision and have limits on how much data they can accept from an outside source. Gen6 generates output data at a precision that is good enough to satisfy the printer but not any higher so as to limit output size. Output precision is handled automatically for scripts utilizing analytic ways of generating their solids (such as 2D paths combined with extrusion). Scripts utilizing the mesh interface need to manually adjust tessellation based on the error metric indicated in the API.