diff options
| author | Franklin Wei <franklin@rockbox.org> | 2019-12-02 17:34:32 -0500 |
|---|---|---|
| committer | Franklin Wei <franklin@rockbox.org> | 2019-12-02 17:34:32 -0500 |
| commit | cfd3a04e68504c59ab3b1ac7bfb1418fa115045c (patch) | |
| tree | 3d1b43a58bfe745cc0c6a97e4ddbf260897badb5 /src | |
| parent | a8aef8e58ff7e3abb38cf3fdcaf2673e87dbe0ab (diff) | |
| download | rastercarve-cfd3a04e68504c59ab3b1ac7bfb1418fa115045c.zip rastercarve-cfd3a04e68504c59ab3b1ac7bfb1418fa115045c.tar.gz rastercarve-cfd3a04e68504c59ab3b1ac7bfb1418fa115045c.tar.bz2 rastercarve-cfd3a04e68504c59ab3b1ac7bfb1418fa115045c.tar.xz | |
Fix a literal "corner case." Add spindle start/stop.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/rastercarve.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/rastercarve.py b/src/rastercarve.py index fc7ef17..a07c5d8 100755 --- a/src/rastercarve.py +++ b/src/rastercarve.py @@ -28,26 +28,26 @@ import numpy as np import sys #### Machine configuration -FEEDRATE = 100 # in / min -PLUNGE_RATE = 10 # in / min -SAFE_Z = .2 # tool will start/end this high from material +FEEDRATE = 140 # in / min +PLUNGE_RATE = 60 # in / min +SAFE_Z = .1 # tool will start/end this high from material TRAVERSE_Z = 1 MAX_DEPTH = .080 # full black is this many inches deep TOOL_ANGLE = 60 # included angle of tool (we assume a V-bit). change if needed #### Image size -DESIRED_WIDTH = 10 # desired width in inches (change this to scale image) +DESIRED_WIDTH = 6 # desired width in inches (change this to scale image) #### Cutting Parameters -LINE_SPACING_FACTOR = 1.1 # Vectric recommends 10-20% for wood -LINE_ANGLE = 22.5 # angle of lines across image, [0-90) degrees -LINEAR_RESOLUTION = .01 # spacing between image samples along a line (inches) +LINE_SPACING_FACTOR = 1.2 # Vectric recommends 10-20% for wood +LINE_ANGLE = 45 # angle of lines across image, [0-90) degrees +LINEAR_RESOLUTION = .1 # spacing between image samples along a line (inches) #### Image interpolation SUPERSAMPLE = 5 # interpolate the image by this factor (caution: this scales the image by the square of its value) #### G-Code options -LINE_NOS = True # Generate line "N"umbers +LINE_NOS = True # Generate line "N"umbers (required for ShopBot) #### Internal stuff - don't mess with this DEG2RAD = math.pi / 180 @@ -189,6 +189,7 @@ def doEngrave(filename): print("( Generated by rastercarve: github.com/built1n/rastercarve )") print("( Image name: %s )" % (filename)) gcode("G00 G90 G80 G28 G17 G20 G40 G49\n") + gcode("M03") # start spindle d = np.array([math.cos(LINE_ANGLE * DEG2RAD), -math.sin(LINE_ANGLE * DEG2RAD)]) @@ -218,16 +219,26 @@ def doEngrave(filename): # we just need to flip d and move start over # see which side of the image the last line ran out on (either top or right side) - if (start + LINEAR_RESOLUTION * d)[1] < 0: + last = start + LINEAR_RESOLUTION * d + + if last[1] < 0: start[0] += xspace else: start[1] += yspace + # check if we ran out the top-right corner (this needs special treatment) + if start[0] >= img_w: + eprint("Special case TRIGGERED") + c = (start[0] - img_w) / d[0] + start -= (c + LINEAR_RESOLUTION * .01) * d + end = engraveLine(img_interp, img_size, interp_ppi, start, -d) moveSlow(end[0], end[1], TRAVERSE_Z) moveRapid(0, 0, TRAVERSE_Z) + gcode("M05") # stop spindle + ### Dump stats eprint("=== Statistics ===") eprint("Image dimensions: %.2f\" wide by %.2f\" tall = %.1f in^2 (%.1f PPI)" % (img_w, img_h, img_w * img_h, img_ppi)) |