git.haldean.org plotter / d758db0
allow disabling centering Haldean Brown 2 years ago
1 changed file(s) with 12 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1212 (defparameter *width* 0)
1313 ; height of the work area, in stepper steps
1414 (defparameter *height* 0)
15
16 (defparameter *steps-per-mm* 46)
15 ; if true, centers the stuff on the plotter in width
16 (defparameter *do-centering* nil)
17
18 (defparameter *steps-per-mm* 92)
1719
1820 ; these are the states that cncserver recognizes
1921 (defparameter *pen-states* '("up" "draw"))
205207
206208 (defun find-gcode-translate (terms)
207209 (when (null *width*) (init))
208 (let* ((bounds (gcode-bounds terms))
209 (width-mm (/ *width* *steps-per-mm*))
210 (xdiff (- width-mm (- (third bounds) (first bounds)))))
211 (cons (- (/ xdiff 2) (first bounds)) 0)))
210 (if *do-centering*
211 (let* ((bounds (gcode-bounds terms))
212 (width-mm (/ *width* *steps-per-mm*))
213 (xdiff (- width-mm (- (third bounds) (first bounds)))))
214 (cons (- (/ xdiff 2) (first bounds)) 0))
215 (cons 0 0)
216 ))
217
212218
213219 (defun run-gcode-file-on-gvm (g fname)
214220 (with-open-file (stream fname :direction :input)