Gel Printing!#

This notebook will introduce you to printing gels with the syringe tool!

Before Starting:#

  • Clear any existing items off the bed of your machine!

  • You should have already calibrated the Z-Offset for your syringe

[ ]:
from science_jubilee.Machine import Machine
from science_jubilee.tools.SyringeExtruder import SyringeExtruder
[ ]:
m = Machine(address = "192.168.1.2")

The first thing you do is to home the machine, if you need to! Make sure the build plate is clear.

[ ]:
# m.home_all() # uncomment and run this cell if you need to home the machine

Homing could take a minute.

Tool Setup#

To use your tool, you’ll need to set a tool_index and a tool_name. These should be the same as the ones defined in your machine’s config.g file that appear in the Duet Web Control panel.

You will also import a configuration file for your syringe. We’ve already made one; it’s called 10cc_syringe

[1]:
syringe_index = 10000           # change this number to match the tool number for the syringe on your machine!
syringe_config = "10cc_syringe" # no need to change this
syringe_name = "Sryinge"        # No need to change this
[ ]:
syringe = SyringeExtruder(
                        index = syringe_index,
                        name = syringe_name,
                        config = syringe_config
                        )
m.load_tool(syringe)

Next, prep your F-127 for the syringe - Danli and Blair can show you where this is!

Prime the Nozzle#

[ ]:
m.move_to(z = 25)         # move the bed away if it's too close to the nozzle so that you can more easily clean ooze
syringe.move_extrude(e=1) # you may need to re-run this cell several times, until the syringe starts oozing!

These are some helper functions to load gcode and print gcode:

[ ]:
# These functions will let us print a pre-sliced cylinder model
# nothing will happen when your run this cell
def load_gcode(file_path):
    try:
        lines = []
        with open(file_path, 'r') as file:
            for line in file:
                lines.append(line.strip())
        return lines
    except FileNotFoundError:
        print(f"File '{file_path}' not found.")
        return None
    except Exception as e:
        print(f"An error occurred: {e}")
        return None

def print_gcode(gcode):
    for line in gcode:
        if len(line) > 0:
            if not line.startswith(';'):
                print(line)
                m.gcode(line)

Now try printing! When we start the print, the machine will first home the z axis to level the bed, and then it will start printing.

If you’re using a glass plate, you should remove the plate while the machine is homing, and the put it back in place when the print starts!

[ ]:
# Once you run this cell, the machine will start printing a small cylinder!
# First it will park all tools and home the z axis
# and then it will pick up the syringe and start printing
# Position your glass plate in the center of after the machine is done homing if using
# press the 'Stop' button in the top toolbar to stop the print
gcode = load_gcode("cylinder-20mm.gcode")
print_gcode(gcode)

You might notice that it doesn’t look great on your machine! This example was sliced with a bunch of default parameters like speed and extrusion. To tune your print, you may want to slice your own model and tune different settings; take a look at the README.md file for more information.

[ ]:
m.park_tool()

Other 3D Printing Options!#

With the syringe extruder tool, we can also directly specify simple toolpaths to print; this might be useful if you want to directly extrude in a particular location, or do other things of that nature

Note that this functionality is quite basic, especially compared to built-in slicer features!

Test cube#

Here we’ll print this test cube with a raised side:

cube.png

[ ]:
# Pick up your syringe
m.pickup_tool(syringe_0)
[ ]:
# Set up some printing parameters
# Change these if and as you'd like!
z = 0              # starting z value
layer_height = 0.2
z_off = 0          # how much to offset one corner

# put your glass plate at the center of the bed if using
start_x = 150      # x start position
start_y = 150      # y start position
side_length = 20   # side length of the cube

m.move_to(x=start_x, y=start_y, z=z)


# the move_extrude command will extrude gel from the current position to the specified position
# you can edit the extrusion multiplier if you'd like more/less gel extruded, or specify a speed to move at
for layer in range(40):
    syringe_0.move_extrude(x = start_x + side_length, y = start_y, z = z, multiplier = 1)
    syringe_0.move_extrude(x = start_x + side_length, y = start_y - side_length, z = z + z_off, multiplier = 1)
    syringe_0.move_extrude(x = start_x, y = start_y - side_length, z = z + z_off, multiplier = 1)
    syringe_0.move_extrude(x = start_x, y =start_y, z = z, multiplier = 1)
    z += layer_height
    z_off += 0.1