Dies ist eine alte Version des Dokuments!
PLOT YOUR DRAWING
This is about how you could plot your drawings via https://1milliondrawings.com
- save the code in a .py script (and yeah install axi / json and requests)
- now go and draw some lines @ https://1milliondrawings.com/drawing
- after you saved your drawing, remember or write down your DRAWING-ID
- now open a terminal and load your script
1. you will be asked for a drawing-ID
2. confirm your plot - fun
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()
MY (OLD) PROBLEM
STOP READING
STOP READING - from here down its old news (-31.12.2017)
Here I try to put some research I made together. Main problem: how to print with your axidrawer from within terminal via python scripts…
BEST SNIPPET I CAME UP WITH AFTER HOURS
json_encode($yourCordinateArray);
Q:axi for terminal use
Q: how to install Inkscape
Q: how to start axidraw from terminal
sed "s/XYZwrzlprmftXYZ/useful text/g" dummy.svg > useful.svg

