LA3 – “Travel through Another Dimension”

This large assignment gave us the understanding and experience of the computational design process behind 3D printing. We used programming in Grasshopper+Python to create a custom slicer and GCode generator for 3D printing.

task 1: Create A Basic Slicer for 3D Printing

In this section we created a custom slicer for 3D printing that generates perimeters and rectilinear infill. We wrote an algorithm that takes a 3D model (BREP) as an input and creates thin slices. I first started by creating a basic cylinder

I then created a line that was the length of the diameter of the circle, and moved it over to one edge of the circle. I then used a linear array with spacing of the extrusion width to create lines across the surface, then used an intersection to contain the lines to inside the surface

I then took those lines and split them into points of 0.1mm, then reconstructed those points into line segments.

I then made multiple layers to see if it would slice by layer, and then visualized it using caped pipes.

Task 2 – Create a G-Code Generator in Python/GH

Now that we had the line segments for our perimeters and infill, we used them to construct G-code. I started with the python code provided, and added an if statement to calculate extrusion.

To calculate the distance between the points, I used the formula sqrt((x2-x1)+(y2-y1)). To make sure that it wasn’t a negative value in the sqrt, I took the absolute value of each difference. To find the volume out, I took the equation for the extrusion shape, which was (w-h)*h + pi(h/2)^2, where w is the extrusion width and h is the layer height. After calculating that, we know that the volume out is equal to the volume in, and using the equation Vin = Le * pi * (D/2)^2, I reorganized it so that Le = Vout/(pi(D/2)^2). This gave us the extrusion parameter, which I then added to parameter array.

To figure out when the machine should extrude, we know that it shouldn’t if it is first moving from the origin, if it is moving up a layer, or if it is moving to another section without needing infill. I set the boolean value to false whenever these things were true. On the other hand, we wanted it to be true when it was moving between line segments.

output text file

grasshopper file

Here is the gcode from the output text file shown in the gcode analyzer.

Leave a comment