Skip to content

Instantly share code, notes, and snippets.

@abey79
Created April 30, 2020 16:56
Show Gist options
  • Save abey79/9b4953c1263ab88896b166a21d3f8fe1 to your computer and use it in GitHub Desktop.
Save abey79/9b4953c1263ab88896b166a21d3f8fe1 to your computer and use it in GitHub Desktop.
Quick and (very!) dirty script to make stop motion from multi-layer files
import time
from pyaxidraw import axidraw
from gpiozero import LED
trigger = LED(26)
ad = axidraw.AxiDraw()
def take_photo():
ad.options.mode = "manual"
ad.options.manual_cmd = "walk_x"
ad.options.walk_dist = 8.
ad.plot_run()
trigger.on()
time.sleep(0.1)
trigger.off()
ad.options.walk_dist = -8.
ad.plot_run()
def plot_layer(i):
ad.options.mode = "layers"
ad.options.layer = i
ad.plot_run()
def plot_all(count):
for i in range(count):
take_photo()
plot_layer(i + 1)
take_photo()
def shutdown():
ad.options.mode = "manual"
ad.options.manual_cmd = "disable_xy"
ad.plot_run()
if __name__ == "__main__":
file_name = "/home/pi/stopmotion/stopmotion_circle.svg"
layer_count = 153
ad.plot_setup(file_name)
ad.options.model = 2
ad.options.pen_pos_down = 40
ad.options.pen_pos_up = 60
ad.options.auto_rotate = False
plot_all(153)
shutdown()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment