-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged third commit of pull request #25 from Alexander Wenger.
Comment from the author: In GUI and plot code an option is implemented to chose the end position of the blade after cutting. This can be useful for some jobs. There was already some code which seemed to be intended for this purpose but was left unfinished. Frankly, I had some difficulties understanding the logic and implemented my own approach.
- Loading branch information
Showing
3 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# (c) 2013,2014 [email protected] | ||
# (c) 2016 [email protected] | ||
# (c) 2016 Alexander Wenger | ||
# (c) 2017 Johann Gail | ||
# | ||
# Distribute under GPLv2 or ask. | ||
# | ||
|
@@ -719,7 +721,7 @@ def plot_cmds(s, plist, bbox, x_off_mm, y_off_mm): | |
|
||
def plot(s, mediawidth=210.0, mediaheight=297.0, margintop=None, | ||
marginleft=None, pathlist=None, offset=None, bboxonly=False, | ||
end_paper_offset=0, regmark=False, regsearch=False, | ||
end_paper_offset=0, endposition='below', regmark=False, regsearch=False, | ||
regwidth=180, reglength=230): | ||
"""plot sends the pathlist to the device (real or dummy) and computes the | ||
bounding box of the pathlist, which is returned. | ||
|
@@ -735,10 +737,13 @@ def plot(s, mediawidth=210.0, mediaheight=297.0, margintop=None, | |
bboxonly: True for drawing the bounding instead of the actual cut design; | ||
None for not moving at all (just return the bounding box). | ||
Default: False for normal cutting or drawing. | ||
end_paper_offset: [mm] adds to the final move, if return_home was False in setup. | ||
end_paper_offset: [mm] adds to the final move, if endposition is 'below'. | ||
If the end_paper_offset is negative, the end position is within the drawing | ||
(reverse movmeents are clipped at the home position) | ||
It reverse over the last home position. | ||
endpostiton: Default 'below': The media is moved to a position below the actual cut (so another | ||
can be started without additional steps, also good for using the cross-cutter). | ||
'start': The media is returned to the positon where the cut started. | ||
Example: The letter Y (20mm tall, 9mm wide) can be generated with | ||
pathlist=[[(0,0),(4.5,10),(4.5,20)],[(9,0),(4.5,10)]] | ||
""" | ||
|
@@ -830,26 +835,26 @@ def plot(s, mediawidth=210.0, mediaheight=297.0, margintop=None, | |
p += "\x03D%d,%d" % (int(0.5+bbox['lly']), int(0.5+bbox['llx'])) | ||
p += "\x03D%d,%d" % (int(0.5+bbox['ury']), int(0.5+bbox['llx'])) | ||
p += "\x03" # Properly terminate string of plot commands. | ||
|
||
trailer = [] | ||
# potentially long command string needs extra care | ||
s.safe_write(p) | ||
|
||
# Silhouette Cameo2 does not start new job if not properly parked on left side | ||
# Attention: This needs the media to not extend beyond the left stop | ||
if not 'llx' in bbox: bbox['llx'] = 0 # survive empty pathlist | ||
if not 'lly' in bbox: bbox['lly'] = 0 | ||
if not 'urx' in bbox: bbox['urx'] = 0 | ||
if not 'ury' in bbox: bbox['ury'] = 0 | ||
new_home = "M%d,%d\x03SO0\x03" % (int(0.5+bbox['lly']+end_paper_offset*20.), 0) | ||
|
||
# potentially long command string needs extra care | ||
s.safe_write(p) | ||
|
||
if endposition == 'start': | ||
new_home = "H\x03" | ||
else: #includes 'below' | ||
new_home = "M%d,%d\x03SO0\x03" % (int(0.5+bbox['lly']+end_paper_offset*20.), 0) #! axis swapped when using Cameo-system | ||
#new_home += "FN0\x03TB50,0\x03" | ||
s.write(new_home) | ||
|
||
return { | ||
'bbox': bbox, | ||
'unit' : 1/20., | ||
'trailer': trailer | ||
'trailer': new_home | ||
} | ||
|
||
|
||
|