wip
This commit is contained in:
parent
c3ca0b65bc
commit
6a3ab49cbe
|
@ -20,6 +20,13 @@ from .planner import Planner
|
|||
from .turtle import Turtle
|
||||
from .util import draw, reset
|
||||
|
||||
from .drawing import (
|
||||
V3_SIZE,
|
||||
V3_BOUNDS,
|
||||
A3_SIZE,
|
||||
A3_BOUNDS,
|
||||
)
|
||||
|
||||
from .hershey import text, justify_text
|
||||
from .hershey_fonts import (
|
||||
ASTROLOGY,
|
||||
|
|
|
@ -10,7 +10,7 @@ from .paths import path_length
|
|||
from .planner import Planner
|
||||
from .progress import Bar
|
||||
|
||||
TIMESLICE_MS = 20
|
||||
TIMESLICE_MS = 10
|
||||
|
||||
MICROSTEPPING_MODE = 2
|
||||
STEP_DIVIDER = 2 ** (MICROSTEPPING_MODE - 1)
|
||||
|
@ -22,16 +22,16 @@ PEN_UP_POSITION = 60
|
|||
PEN_UP_SPEED = 150
|
||||
PEN_UP_DELAY = 0
|
||||
|
||||
PEN_DOWN_POSITION = 45
|
||||
PEN_DOWN_POSITION = 40
|
||||
PEN_DOWN_SPEED = 150
|
||||
PEN_DOWN_DELAY = 0
|
||||
|
||||
ACCELERATION = 6
|
||||
MAX_VELOCITY = 1
|
||||
CORNER_FACTOR = 0.005*3
|
||||
ACCELERATION = 8
|
||||
MAX_VELOCITY = 3
|
||||
CORNER_FACTOR = 0.005
|
||||
|
||||
JOG_ACCELERATION = 8
|
||||
JOG_MAX_VELOCITY = 5
|
||||
JOG_ACCELERATION = 16
|
||||
JOG_MAX_VELOCITY = 8
|
||||
|
||||
VID_PID = '04D8:FD92'
|
||||
|
||||
|
@ -105,7 +105,7 @@ class Device(object):
|
|||
def move(self, dx, dy):
|
||||
self.run_path([(0, 0), (dx, dy)])
|
||||
|
||||
def goto(self, x, y, jog=False):
|
||||
def goto(self, x, y, jog=True):
|
||||
# TODO: jog if pen up
|
||||
px, py = self.read_position()
|
||||
self.run_path([(px, py), (x, y)], jog)
|
||||
|
|
|
@ -11,6 +11,12 @@ try:
|
|||
except ImportError:
|
||||
cairo = None
|
||||
|
||||
V3_SIZE = (12, 8.5)
|
||||
V3_BOUNDS = (0, 0, 12, 8.5)
|
||||
|
||||
A3_SIZE = (16.93, 11.69)
|
||||
A3_BOUNDS = (0, 0, 16.93, 11.69)
|
||||
|
||||
class Drawing(object):
|
||||
def __init__(self, paths=None):
|
||||
self.paths = paths or []
|
||||
|
@ -125,6 +131,10 @@ class Drawing(object):
|
|||
x1, y1, x2, y2 = self.bounds
|
||||
return y2 - y1
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
return (self.width, self.height)
|
||||
|
||||
@property
|
||||
def all_paths(self):
|
||||
result = []
|
||||
|
@ -234,10 +244,12 @@ class Drawing(object):
|
|||
return Drawing(paths)
|
||||
|
||||
def render(self, scale=109, margin=1, line_width=0.5/25.4,
|
||||
use_axi_bounds=True, show_axi_bounds=True):
|
||||
bounds=None, show_bounds=True,
|
||||
use_axi_bounds=False, show_axi_bounds=False):
|
||||
if cairo is None:
|
||||
raise Exception('Drawing.render() requires cairo')
|
||||
x1, y1, x2, y2 = self.bounds
|
||||
bounds = bounds or self.bounds
|
||||
x1, y1, x2, y2 = bounds
|
||||
if use_axi_bounds:
|
||||
x1, y1, x2, y2 = (0, 0, 12, 8.5)
|
||||
w = x2 - x1
|
||||
|
@ -259,6 +271,11 @@ class Drawing(object):
|
|||
dc.set_line_width(1 / scale)
|
||||
dc.rectangle(0, 0, 12, 8.5)
|
||||
dc.stroke()
|
||||
if show_bounds:
|
||||
dc.set_source_rgb(0.5, 0.5, 0.5)
|
||||
dc.set_line_width(1 / scale)
|
||||
dc.rectangle(*bounds)
|
||||
dc.stroke()
|
||||
dc.set_source_rgb(0, 0, 0)
|
||||
dc.set_line_width(line_width)
|
||||
for path in self.paths:
|
||||
|
|
Loading…
Reference in New Issue