# EX.02 3D G-code

Elliptical 3D prints

This exercise is focused on manual export of G-code straight from the Beetle Blocks to a 3D printer. The geometry of the following experiments is based on a custom-built Ellipse component that is described in detail below. The misalignments between two adjacent ellipses forces the extruded material to drip, creating a range of different patterns. All of the 3D prints below were created by adjusting the rate of extrusion, the increment of rotation and the speed, with which ellipses were deformed along their major axis.

Elliptical Tower

Rotating Ellipses code that stacks ellipses in Z dimension while gradually changing the ratio of their major axis, as well as rotating them in XY plane. The rotation is introduced through creating a secondary XY list, which is populated in a following manner. For every point in the original coordinate list, the beetle, located at the centroid of the ellipse, measures its distance to that point, then points to it and rotates away from it by a set rotational angle. Then the beetle moves forward by measured distance and records its new XY that are used to populate the secondary list. After all the points have been rotated around the centroid, the beetle proceeds to draw the actual ellipse. Playing the Rain Man

The math behind an ellipse translated from a Wolfram Alpha function into a Beetle Blocks script. The function is solved for Y on the white board below and then translated into a BB definition. The beetle starts at the center and then moves to the left side of the horizontal major axis. Then it divides the X axis into equal components based on the Resolution parameter and calculates a Y coordinate for each X position based on the Ellipse formula. Once the lists of point-coordinates are established, the beetle proceeds from one point to the next drawing the actual ellipse. 