Setup |
ExtruderTurtle |
Constructor. Generates a turtle object.
Parameters:
N/A
Returns:
A turtle object located at the origin.
Example:
t = ExtruderTurtle()
|
setup |
Sets initial parameters for the turtle. A printer must be set either through this function or the set_printer function for the printer-based functions to work. A filename must be specified via this function for g-code generation to work.
The library currently supports the following printers:
Eazao Zero, "eazao"
3D Potter Super 10, "super"
3D Potter Micro, "micro"
Creatlity Ender 3, "ender"
UNM Civil Engineering Gantry printer, "civil"
Parameters:
x,y,z (optional): the x y and z location of the turtle. Default values of 0.
filename (optional): the name of the file to write g-code to.
printer (optional): the name of the 3D printer you are using.
Returns:
N/A
Example:
t = ExtruderTurtle()
t.setup(x=0, y=0, z=0, filename=filename, printer = "eazao")
|
Turtle Functions |
Basic 2D Functions |
forward |
Move the turtle forward a given distance.
Parameters:
distance: the distance to move
Returns:
N/A
Example:
t.forward(100)
|
backward |
Move the turtle backward a given distance.
Parameters:
distance: the distance to move
Returns:
N/A
Example:
t.backward(15.5)
|
right |
Turns the turtle right by the given angle.
Parameters:
angle: the angle, in degrees, to turn
Returns:
N/A
Example:
t.right(90)
|
left |
Turns the turtle left by the given angle.
Parameters:
angle: the angle, in degrees, to turn
Returns:
N/A
Example:
t.left(10)
|
penup |
Lifts the turtle's pen so that it stops drawing. In the context of 3D printing, this means the turtle will move, but stop extruding filament. Turtle movements made while the pen is up will not be shown in Rhino. The default state of the turtle's pen is down.
Parameters:
N/A
Returns:
N/A
Example:
t.penup()
|
pendown |
Sets the turtle's pen down so that it generates a drawing as it moves. In the context of 3D printing, this means the turtle will start extruding. Only Turtle movements made while the pen is down will be shown in Rhino. The default state of the turtle's pen is down.
Parameters:
N/A
Returns:
N/A
Example:
t.pendown()
|
3D Functions |
yaw |
Turns the turtle left by the given angle. "Left" is calculated based on the turtle's current heading and is a rotation around the turtle's z axis. The turtle's z axis comes up out of its shell. Equivalent to left.
Parameters:
angle: the angle, in degrees, to turn
Returns:
N/A
Example:
t.yaw(45)
|
pitch |
Pitches the turtle down by the given angle. "Down" is calculated based on the turtle's current heading and is a rotation around the turtle's y axis. The turtle's y axis crosses its body from its left to right paw.
Parameters:
angle: the angle, in degrees, to pitch
Returns:
N/A
Example:
t.pitch(45)
|
roll |
Rolls the turtle left by the given angle. "Left" is calculated based on the turtle's current heading and is a rotation around the turtle's x axis. The turtle's x axis runs through its body from its tail to head.
Parameters:
angle: the angle, in degrees, to roll
Returns:
N/A
Example:
t.roll(45)
|
set_heading |
Sets the turtle's current heading.
Parameters:
yaw, pitch, roll (optional): angles in degrees that define the desired turtle heading. Values are optional, but at least one value must be specified.
Returns:
N/A
Examples:
t.set_heading(yaw=90)
t.set_heading(yaw=90,pitch=0,roll=90)
|
get_yaw, get_pitch, get_roll |
Gets the turtle's current heading in any of its three directions.
Parameters:
N/A.
Returns:
The current yaw, pitch, and roll heading value respectively.
Example:
yaw = t.get_yaw()
pitch = t.get_pitch()
roll = t.get_roll()
|
lift |
Lifts the turtle up in the z direction by the given amount. "Up" is calculated based on the turtle's current heading and is a movement in the turtle's z direction. The turtle's z axis comes up out of its shell.
Parameters:
height: the distance, in mm, to lift
Returns:
N/A
Example:
t.lift(1.0)
|
forward_lift |
A movement forward and up, based on the turtle's current heading.
Parameters:
forward_distance: the distance, in mm, to move forward
height: the distance, in mm, to lift
Returns:
N/A
Example:
t.forward_lift(20,5.0)
|
Euclidean Functions |
set_position |
Sets the turtle's current position based on the given x, y, and z values.
Parameters:
x,y,z (optional): the x, y, and z values to move to. Values are optional, but at least one value must be specified. The turtle's heading will be changed by this function based on the vector from its current position to the new position.
Returns:
N/A
Examples:
t.set_position(x=1.0,y=0,z=10)
t.set_position(y=0)
|
set_position_point |
Sets the turtle's current position based on a Rhino point. The turtle's heading will changed by this function based on the vector from its current position to the new position.
Parameters:
point: A Rhino point object specifying the position to move to.
Returns:
N/A
Example:
point = rs.AddPoint(0,0,0)
t.set_position_point(point)
|
get_position |
Gets the turtle's current position as a Rhino point.
Parameters:
N/A.
Returns:
A Rhino point at the turtle's current position.
Example:
point = t.get_position()
|
getX, getY, getZ |
Gets the turtle's current X, Y, or Z coordinates.
Parameters:
N/A.
Returns:
The current X, Y, or Z coordinate value respectively.
Example:
x = t.getX()
y = t.getY()
z = t.getZ()
|
Printer and G-Code Functions |
set_speed |
Sets the speed of your printer, in mm per minute. This determines how fast your printer will travel as it prints. The default speed for all printers is 1000 mm/minute (16.6 mm/second).
Parameters:
speed: the speed for the printer in mm per minute.
Returns:
N/A
Example:
t.set_speed(1500)
|
get_speed |
Gets the current speed of your printer, in mm per minute.
Parameters:
N/A
Returns:
The current speed
Example:
speed = t.get_speed()
|
set_extrude_rate |
Sets the extrude rate for your printer, in mm (extruded) per mm (traveled).
Parameters:
extrude_rate: the extrude rate
Returns:
N/A
Example:
t.set_extrude_rate(1.25)
|
get_extrude_rate |
Gets the current extrude rate of your printer, in mm (extruded) per mm (traveled).
Parameters:
N/A
Returns:
The current extrude rate
Example:
t.get_extrude_rate()
|
set_layer_height |
Sets the layer height for your printer in mm.
Parameters:
layer_height: the layer height in mm
Returns:
N/A
Example:
t.set_layer_height(1.0)
|
get_layer_height |
Gets the current layer height.
Parameters:
N/A
Returns:
The current layer height
Example:
layer_height = t.get_layer_height()
|
set_extrude_width |
Sets the extrude width for your printer in mm. This is the width of a printed line of filament or clay.
Parameters:
extrude_width: the extrude width in mm
Returns:
N/A
Example:
t.set_extrude_width(1.75)
|
get_extrude_width |
Gets the current extrude width. This is the width of a printed line of filament or clay.
Parameters:
N/A
Returns:
The current extrude width.
Example:
extrude_width = t.get_extrude_width()
|
set_nozzle_size |
Sets the current nozzle diameter of your printer, in mm. Setting this value will change the extrude_rate, layer_height and extrude_width printer parameters in the following way:
extrude_rate = nozzle_size
layer_height = nozzle_size*0.8
extrude_width = nozzle_size*1.15
Parameters:
The size of the nozzle diameter in mm.
Returns:
N/A
Example:
t.set_nozzle_size(3.0)
|
get_nozzle_size |
Gets the current nozzle diameter of your printer, in mm.
Parameters:
N/A
Returns:
The size of the nozzle diameter in mm.
Example:
t.get_nozzle_size()
|
set_printer |
Sets the 3D printer you are using. This function will set the default nozzle size, layer height, extrude rate, extrude width, speed, and bed size based on the printer. It will also write the appropriate g-code initialization sequence to your g-code file. Note that a printer must be set either through the setup function or through this function for the rest of the printer based functions to work.
The library currently supports the following four printers:
Eazao Zero, "eazao"
3D Potter Super 10, "super"
3D Potter Micro, "micro"
Creatlity Ender 3, "ender"
Parameters:
printer: the name of the printer you are using
Returns:
N/A
Example:
t.set_printer("super")
|
get_printer |
Gets the current 3D printer.
Parameters:
printer: the name of the printer you are using
Returns:
A string identifying the current printer
Example:
printer = t.get_printer()
|
extrude |
Extrudes the given amount of filament in mm. Extrudes in place without moving.
Parameters:
amount: the amount of filament to extrude in mm
Returns:
N/A
Example:
t.extrude(10)
|
pause |
Pauses and waits for the given amount of time in ms. Note: a feature only available on some printers. Not available on the Eazao or PotterBot printers.
Parameters:
time: the amount of time in ms to wait
Returns:
N/A
Example:
t.pause(10)
|
pause_and_wait |
Pauses and waits for user interaction. Note: a feature only available on some printers. Not available on the Eazao or PotterBot printers.
Parameters:
N/A
Returns:
N/A
Example:
t.pause_and_wait()
|
write_gcode_comment |
Writes a comment to your g-code file. Note that a file must be specified, via the setup function, for this function to work.
Parameters:
comment: a string with the comment you wish to write
Returns:
N/A
Example:
diameter = 30
t.write_gcode_comment("diameter = " + str(diameter))
|
print_printer_information |
Prints out all of the important printer parameters: printer name, nozzle size, speed, layer height, extrude rate, and extrude width.
Parameters:
N/A
Returns:
N/A
Example:
t.print_printer_information()
|
finish |
Closes the g-code file and writes the appropriate ending g-code sequence to the g-code file. Must be called at the end of g-code generating scripts.
Parameters:
N/A
Returns:
N/A
Example:
t.finish()
|
Rhino/Grasshopper Visualization Functions |
get_points |
Returns a list of Rhino points that follow the path the turtle has taken so far. Use to visualize the path of the turtle (and the g-code it has generated) in Rhino.
Parameters:
N/A.
Returns:
A list of Rhino points that follow the path the turtle has taken so far.
Example:
path = t.get_points()
|
get_lines |
Returns a list of Rhino line segments that follow the path the turtle has taken so far. Use to visualize the path of the turtle (and the g-code it has generated) in Rhino.
Parameters:
N/A.
Returns:
A list of Rhino line segments that follow the path the turtle has taken so far.
Example:
path = t.get_lines()
|
draw_turtle |
Returns a triangular surface that shows the turtle's current location and orientation.
Parameters:
N/A.
Returns:
A Rhino surface that shows the turtle's current location and orientation.
Example:
turtle = t.draw_turtle()
|
draw_print_bed |
Returns a surface showing the print bed for the printer you are currently using. Use it to visualize where the turtle is on the print bed of your 3D printer.
Parameters:
N/A
Returns:
A Rhino surface showing the print bed for the printer you are currently using.
Example:
printer_surface = t.draw_print_bed()
|
Material and Print Related Functions |
set_density |
Sets the print material's density, in grams per millileter (g/ml)/grams per cubic centimeter.
Parameters:
density: the density of the material being printed in grams per millileter (g/ml).
Returns:
N/A
Example:
t.set_density(1.27)
|
get_density |
Returns the current material density.
Parameters:
N/A.
Returns:
A floating point number that corresponds to the material density in grams per millileter (g/ml).
Example:
density = t.get_density()
|
length_of_path |
Returns the length of the extruded path the turtle has traveled. Does not include distance traveled while not extruding.
Parameters:
N/A.
Returns:
A floating point number that corresponds to the length of the path the turtle has extruded.
Example:
path_length = t.length_of_path()
|
get_volume |
Returns the approximate volume of the extruded path the turtle has traveled in ml.
Parameters:
N/A.
Returns:
A floating point number that corresponds to the approximate volume of the path the turtle has extruded in ml.
Example:
volume = t.get_volume()
|
get_print_time |
Returns the approximate time in minutes that the print will take.
Parameters:
N/A
Returns:
An integer. The approximate time the print will take, in minutes.
Example:
time = t.get_print_time()
|