PLOT YOUR DRAWING

This is about how you could plot your drawings via https://1milliondrawings.com
From the artwork → drawings

If you have a AxiDrawer-Machine you could plot your drawings from terminal using a python script.
Why should you use it?

Well, because this empowers you to draw online picture you could remote plot out. I'm sure you figure out how to change the script to automatic plot your ideas =)
If you need help just write me.
And on the other hand just because its possible and a really cool way to interact with your axibot.

  1. save the code in a .py script (and yeah install axi / json and requests)
  2. now go and draw some lines @ https://1milliondrawings.com/drawing
  3. after you saved your drawing, remember or write down your DRAWING-ID
  4. now open a terminal and load your script
    1. you will be asked for a drawing-ID
    2. confirm your plot
  5. fun

This is the code you need to connect to 1 million drawings:

from axi import Device, Drawing
import json
import requests

################################################
###        by 1milliondrawings.com           ###
###                                          ###
### 1. go to 1milliondrawings.com/drawing    ###
### 2. save your drawing                     ###
### 3. plot your DRAWING-ID                  ###
###                                          ###
################################################

def printer(PATH):
    drawing = Drawing(PATH)
    d = Device()
    d.enable_motors()
    d.run_drawing(drawing)
    d.disable_motors()

def bildprinter(image):
    try:
        url = "https://1milliondrawings.com/axipath?nr="+str(image)
        result = requests.get(url).json()
        resultat = []
        for pfad in result["CORD"]:
            resu = [(piece['x'], piece['y']) for piece in pfad]
            resultat.append(resu)
        print resultat
        plot = raw_input("PLOT IMAGE ID: "+  str(image) +" OR NOT(y/n)")
        if(plot == "y"):
            printer(resultat)
        else:
            Anfang()
    except TypeError:
        print 'PROBLEM: PLEASE TRY AGAIN OR USE OTHER ID'
        Anfang()

def Anfang():
    bildnummer = raw_input("DRAWING NUMBER (#/n): ")
    if(bildnummer == "n"):
        exit()
    else:
        try:
            bildprinter(bildnummer)
        except IOError:
            print 'oops!'

Anfang()

Warning: Trying to access array offset on value of type bool in /home/httpd/vhosts/ibulla.com/httpdocs/wiki/lib/tpl/bootstrap3/Template.php on line 588
  • art/axidraw.txt
  • Zuletzt geändert: 2018/04/24 12:08
  • von 127.0.0.1