t = ExtruderTurtle() t.name("alien-tree.gcode") t.setup(x=100, y=100) t.set_density(0.07) # 0.05 t.rate(500) while radius > 0: t.forward(dx) t.right(dtheta) radius += dr dx = radius * dtheta for l in range(50): t.extrude(0.1) t.dwell(100) t.lift(0.05) # 0.1 for x in range(60): for l in range(10): t.extrude(0.1) t.dwell(100) t.lift(0.1) for n in range(5): t.forward(x / 4) t.left(math.pi / 6) t.forward(x / 4) t.left(5 * math.pi / 6) t.forward(x / 4) t.left(math.pi / 6) t.forward(x / 4)
NUM_SIDES = 5 LAYERS = 200 dtheta = 2 * math.pi / NUM_HAIRS dx = DIAMETER * math.sin(dtheta / 2) t = ExtruderTurtle() ## Set up the turtle t.name("flex-circle.gcode") t.setup(x=100, y=100) t.rate(FEEDRATE) t.set_density(EXT_DENSITY) for l in range(LAYERS): for k in range(NUM_HAIRS): t.right(dtheta) t.forward(dx) t.left(HAIR_ANGLE) t.forward(HAIRLENGTH) t.dwell(50) t.forward(-2 * HAIRLENGTH) t.dwell(50) t.forward(HAIRLENGTH) t.right(HAIR_ANGLE) ## Move to the next layer t.lift(LAYER_HEIGHT) ## Save to a GCODE file t.finish()
t.name("hair-pillar.gcode") t.setup(x=150, y=150) t.set_density(0.07) # 0.05 t.rate(500) radius = RADIUS while radius>0: t.forward(dx) t.right(dtheta) radius += dr dx = radius * dtheta for l in range(200): t.extrude(0.1) t.dwell(200) t.lift(0.1) # 0.1 t.penup() t.forward(80) t.right(math.pi/2) t.forward(80) t.right(math.pi) t.lift(-20) t.pendown() radius = RADIUS dx = RADIUS * dtheta while radius>0: t.forward(dx) t.right(dtheta)
while length < (HAIR_ROWS + 1) * HAIR_SPACE: length += 0.7 t.backward(length) t.right(math.pi / 2) t.backward(length) t.right(math.pi / 2) t.lift(0.2) t.lift(LIFT_DIST + 0.2) t.set_density(0.01) t.penup() hairs = HAIR_ROWS t.forward(-HAIR_SPACE / 2) t.left(math.pi / 2) t.forward(HAIR_SPACE / 2) while hairs > 0: for i in range(2): for r in range(hairs): t.forward(HAIR_SPACE) t.lift(-LIFT_DIST) t.extrude(EXTRUDE_AMT) # 0.5 t.penup() t.lift(2) t.extrude(-0.1) t.lift(LIFT_DIST - 2) ## t.pendown() t.dwell(100) # 100 t.left(math.pi / 2) hairs += -1 t.finish()