From 59e6ccbe31011ef69ae829009e5976ed169889f9 Mon Sep 17 00:00:00 2001 From: Peter Mora Date: Sat, 9 Jun 2018 15:53:50 +0200 Subject: [PATCH 01/11] Changing 90 to 96 dpi to follow Inskapce's behavior --- sendto_silhouette.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sendto_silhouette.py b/sendto_silhouette.py index f498f7d4..bdb33101 100644 --- a/sendto_silhouette.py +++ b/sendto_silhouette.py @@ -136,9 +136,9 @@ def px2mm(px): ''' Convert inkscape pixels to mm. - The default inkscape unit, called 'px' is 90dpi + The default inkscape unit, called 'px' is 96dpi ''' - return px*25.4/90 + return px*25.4/96 # Lifted with impunity from eggbot.py # Added all known inkscape units. https://github.com/fablabnbg/inkscape-silhouette/issues/19 @@ -904,11 +904,11 @@ def getLength( self, name, default ): elif ( u == '' ) or ( u == 'px' ): return v elif u == 'mm': - return v*90./25.4 # inverse of px2mm + return v*96./25.4 # inverse of px2mm elif u == 'in': - return v*90. + return v*96. elif u == 'cm': - return v*90./2.54 # inverse of 10*px2mm + return v*96./2.54 # inverse of 10*px2mm elif u == '%': return float( default ) * v / 100.0 else: From 995b3ff17741e9c74595fc2a3d1df8d6b404bac5 Mon Sep 17 00:00:00 2001 From: neocogent Date: Sat, 7 Jul 2018 15:15:39 +1000 Subject: [PATCH 02/11] Move some options to new page to reduce dialog size --- sendto_silhouette.inx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sendto_silhouette.inx b/sendto_silhouette.inx index caa5a98e..a6fee54d 100644 --- a/sendto_silhouette.inx +++ b/sendto_silhouette.inx @@ -47,6 +47,8 @@ 0 0 + + Use speed=0, pressure=0 to take the media defaults. Pressure values of 19 or more could trigger the trackenhancing feature, which means a movement along the full media height before start. Beware. false Convert paths with dashed strokes to separate subpaths for perforated cuts. false Shift to the top lefthand corner, then do offsets. From 6a8456847760157697bb1980e0e3d21816551c10 Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Wed, 20 Jun 2018 22:04:01 +0200 Subject: [PATCH 03/11] Code cleanup: Instead of doing the mm scaling conditional after applying strategy, do it always beforehand. --- sendto_silhouette.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sendto_silhouette.py b/sendto_silhouette.py index bdb33101..51bee303 100644 --- a/sendto_silhouette.py +++ b/sendto_silhouette.py @@ -1000,8 +1000,13 @@ def write_progress(done, total, msg): if self.options.tool == 'pen': self.pen=True if self.options.tool == 'cut': self.pen=False + # scale all points to unit mm + for path in self.paths: + for i,pt in enumerate(path): + path[i] = (px2mm(pt[0]), px2mm(pt[1])) + if self.options.strategy == 'matfree': - mf = MatFree('default', scale=px2mm(1.0), pen=self.pen) + mf = MatFree('default', scale=1.0, pen=self.pen) mf.verbose = 0 # inkscape crashes whenever something appears in stdout. self.paths = mf.apply(self.paths) elif self.options.strategy == 'mintravel': @@ -1013,14 +1018,8 @@ def write_progress(done, total, msg): # print >>self.tty, self.paths cut = [] pointcount = 0 - for px_path in self.paths: - mm_path = [] - for pt in px_path: - if self.options.strategy == 'matfree': - mm_path.append((pt[0], pt[1])) # MatFree.load() did the scaling already. - else: - mm_path.append((px2mm(pt[0]), px2mm(pt[1]))) - pointcount += 1 + for mm_path in self.paths: + pointcount += len(mm_path) multipath = [] multipath.extend(mm_path) From b67c8fd0114d94d2f06e2817addf8fe2bb81b12d Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Tue, 27 Nov 2018 14:30:22 +0100 Subject: [PATCH 04/11] Removed duplicated comments --- silhouette/Graphtec.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index 664253a1..24308af7 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -132,12 +132,8 @@ # margin_left_mm is a physical limit, but is relative to width_mm! 'width_mm': 304, 'length_mm': 3000, 'margin_left_mm':9.0, 'margin_top_mm':1.0, 'regmark': True }, { 'vendor_id': 0x0b4d, 'product_id': 0x112b, 'name': 'Silhouette Cameo2', - # margin_top_mm is just for safety when moving backwards with thin media - # margin_left_mm is a physical limit, but is relative to width_mm! 'width_mm': 304, 'length_mm': 3000, 'margin_left_mm':9.0, 'margin_top_mm':1.0, 'regmark': True }, { 'vendor_id': 0x0b4d, 'product_id': 0x112f, 'name': 'Silhouette Cameo3', - # margin_top_mm is just for safety when moving backwards with thin media - # margin_left_mm is a physical limit, but is relative to width_mm! 'width_mm': 304, 'length_mm': 3000, 'margin_left_mm':5, 'margin_top_mm':15.5, 'regmark': True }, { 'vendor_id': 0x0b4d, 'product_id': 0x110a, 'name': 'Craft Robo CC200-20', 'width_mm': 200, 'length_mm': 1000, 'regmark': True }, From 494dd36437c9c2088c3aace5795fad7dea7e8b3e Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Tue, 27 Nov 2018 14:51:02 +0100 Subject: [PATCH 05/11] Extended some comments --- silhouette/Graphtec.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index 24308af7..7c9c4cbe 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -479,7 +479,7 @@ def initialize(s): #try: # resp = s.read(timeout=1000) # if len(resp) > 1: - # print("U: '%s'" % (resp[:-1]), file=s.log) # response '20320,4120' max. print range? + # print("U: '%s'" % (resp[:-1]), file=s.log) # response '20320,4120' max. usable print range? #except: # pass @@ -499,7 +499,7 @@ def initialize(s): #except: # pass - #s.write("TB71\x03") # Unknown: 2 five digit numbers + #s.write("TB71\x03") # Get machine calibration of regmark sensor (y, x) in machine units #try: # resp = s.read(timeout=1000) # if len(resp) > 1: @@ -507,7 +507,7 @@ def initialize(s): #except: # pass - #s.write("FA\x03") # Unknown: 2 five digit numbers + #s.write("FA\x03") # Get machine calibration (x, y) (carriage, roller) unit is 0.01% i.e. 0.0001 #try: # resp = s.read(timeout=1000) # if len(resp) > 1: @@ -871,7 +871,8 @@ def plot(s, mediawidth=210.0, mediaheight=297.0, margintop=None, #FEx,0 , x = 0 cutting of distinct paths in one go, x = 1 head is lifted at sharp angles #\xmin, ymin Zxmax,ymax, designate cutting area - # needed at least for the trackenhancing feature, defines the usable length, + # needed only for the trackenhancing feature, defines the usable length, rollers three times forward and back. + # needs a pressure of 19 or more, else nothing will happen #p = "FU%d\x03" % (height) #p = "FU%d,%d\x03" % (height,width) # optional #s.write(p) From 794b51968a2ae65ea7960d52e4653e8230378f6a Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Tue, 27 Nov 2018 18:15:20 +0100 Subject: [PATCH 06/11] Set the correct device limit for Silhouette Portrait. My device has a hardware limit at 206, not at 203. Won additional 3 mm. --- silhouette/Graphtec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index 7c9c4cbe..99e534e9 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -124,7 +124,7 @@ DEVICE = [ { 'vendor_id': 0x0b4d, 'product_id': 0x1123, 'name': 'Silhouette Portrait', - 'width_mm': 203, 'length_mm': 3000, 'regmark': True }, + 'width_mm': 206, 'length_mm': 3000, 'regmark': True }, { 'vendor_id': 0x0b4d, 'product_id': 0x1132, 'name': 'Silhouette Portrait2', 'width_mm': 203, 'length_mm': 3000, 'regmark': True }, { 'vendor_id': 0x0b4d, 'product_id': 0x1121, 'name': 'Silhouette Cameo', From d58bf7c22bf56291d1d2a922dc108e2f1d167a50 Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Tue, 27 Nov 2018 21:56:21 +0100 Subject: [PATCH 07/11] Corrected a comment --- silhouette/Graphtec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index 99e534e9..e21bee16 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -621,7 +621,7 @@ def find_bbox(s, cut): return bb def flip_cut(s, cut): - """this returns a flipped copy of the cut about the x-axis, + """this returns a flipped copy of the cut about the y-axis, keeping min and max values as they are.""" bb = s.find_bbox(cut) new_cut = [] From ebbb99494a79bda933797f38230dcd9187ad0d67 Mon Sep 17 00:00:00 2001 From: Johann Gail Date: Sun, 27 Jan 2019 18:32:02 +0100 Subject: [PATCH 08/11] Added the units 'pt' and 'pc' Just a hotfix. The whole conversion should be refactored to function unittouu() from baseclass --- sendto_silhouette.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sendto_silhouette.py b/sendto_silhouette.py index 51bee303..b6ec655a 100644 --- a/sendto_silhouette.py +++ b/sendto_silhouette.py @@ -909,6 +909,10 @@ def getLength( self, name, default ): return v*96. elif u == 'cm': return v*96./2.54 # inverse of 10*px2mm + elif u == 'pt': + return v*96./72. + elif u == 'pc': + return v*96./16. elif u == '%': return float( default ) * v / 100.0 else: From 7cb74d4f58ad859272d5f4a916091e7a2738f1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Sun, 2 Jun 2019 10:42:53 +0200 Subject: [PATCH 09/11] 1.20 trivial fixes to make it compile again. --- sendto_silhouette.inx | 4 ++-- sendto_silhouette.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sendto_silhouette.inx b/sendto_silhouette.inx index d5b7bdd4..d41063d5 100644 --- a/sendto_silhouette.inx +++ b/sendto_silhouette.inx @@ -113,9 +113,9 @@ Always use the least amount of blade possible. Correct value for the silhouette blade is 0.9mm - inkscape-silhouette extension from https://github.com/jnweiger/inkscape-silhouette by Jürgen Weigert [juewei@fabmail.org] and contributors + inkscape-silhouette extension from https://github.com/jnweiger/inkscape-silhouette by Jürgen Weigert [juergen@fabmail.org] and contributors - Version 1.19 + Version 1.20 diff --git a/sendto_silhouette.py b/sendto_silhouette.py index b6ec655a..4d339e25 100644 --- a/sendto_silhouette.py +++ b/sendto_silhouette.py @@ -82,11 +82,12 @@ # https://github.com/fablabnbg/inkscape-silhouette/pull/33 # Added new cutting strategy "Minimized Traveling" # Added parameter for blade diameter +# 2018-06-01, jw, v1.20-- Make it compile again. Hmm. -__version__ = '1.19' # Keep in sync with sendto_silhouette.inx ca line 79 -__author__ = 'Juergen Weigert and contributors' +__version__ = '1.20' # Keep in sync with sendto_silhouette.inx ca line 79 +__author__ = 'Juergen Weigert and contributors' -import sys, os, shutil, time, logging, tempfile +import sys, os, shutil, time, logging, tempfile, math, re # we sys.path.append() the directory where this From eb837c50c52d6187c1223363191d5e198cc5ffab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Thu, 11 Jul 2019 14:27:06 +0200 Subject: [PATCH 10/11] Added a new registration-marks-cameo-silhouette-a4.svg contributed by Javier Arraiza. Thanks! This one is made with 96 dpi and fit for inkscape-0.92 and later. --- ...tration-marks-cameo-silhouette-a4-maxi.svg | 0 .../registration-marks-cameo-silhouette.svg | 0 .../registration-marks-robo-landscape.svg | 0 .../registration-marks-robo-portrait.svg | 0 ...registration-marks-cameo-silhouette-a4.svg | 232 ++++++++++++++++++ 5 files changed, 232 insertions(+) rename examples/{ => inkscape-0.91}/registration-marks-cameo-silhouette-a4-maxi.svg (100%) rename examples/{ => inkscape-0.91}/registration-marks-cameo-silhouette.svg (100%) rename examples/{ => inkscape-0.91}/registration-marks-robo-landscape.svg (100%) rename examples/{ => inkscape-0.91}/registration-marks-robo-portrait.svg (100%) create mode 100644 examples/registration-marks-cameo-silhouette-a4.svg diff --git a/examples/registration-marks-cameo-silhouette-a4-maxi.svg b/examples/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg similarity index 100% rename from examples/registration-marks-cameo-silhouette-a4-maxi.svg rename to examples/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg diff --git a/examples/registration-marks-cameo-silhouette.svg b/examples/inkscape-0.91/registration-marks-cameo-silhouette.svg similarity index 100% rename from examples/registration-marks-cameo-silhouette.svg rename to examples/inkscape-0.91/registration-marks-cameo-silhouette.svg diff --git a/examples/registration-marks-robo-landscape.svg b/examples/inkscape-0.91/registration-marks-robo-landscape.svg similarity index 100% rename from examples/registration-marks-robo-landscape.svg rename to examples/inkscape-0.91/registration-marks-robo-landscape.svg diff --git a/examples/registration-marks-robo-portrait.svg b/examples/inkscape-0.91/registration-marks-robo-portrait.svg similarity index 100% rename from examples/registration-marks-robo-portrait.svg rename to examples/inkscape-0.91/registration-marks-robo-portrait.svg diff --git a/examples/registration-marks-cameo-silhouette-a4.svg b/examples/registration-marks-cameo-silhouette-a4.svg new file mode 100644 index 00000000..818b08d6 --- /dev/null +++ b/examples/registration-marks-cameo-silhouette-a4.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + 277mm + 190mm + 10mm + 10mm + + + + From 8b38e2e948f4c1f18876bdfc93d72443e2cae98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Thu, 11 Jul 2019 21:57:05 +0200 Subject: [PATCH 11/11] moved all registration marks templates into a registration-marks folder. --- .../inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg | 0 .../inkscape-0.91/registration-marks-cameo-silhouette.svg | 0 .../inkscape-0.91/registration-marks-robo-landscape.svg | 0 .../inkscape-0.91/registration-marks-robo-portrait.svg | 0 .../registration-marks-cameo-silhouette-a4.svg | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename examples/{ => registration-marks}/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg (100%) rename examples/{ => registration-marks}/inkscape-0.91/registration-marks-cameo-silhouette.svg (100%) rename examples/{ => registration-marks}/inkscape-0.91/registration-marks-robo-landscape.svg (100%) rename examples/{ => registration-marks}/inkscape-0.91/registration-marks-robo-portrait.svg (100%) rename examples/{ => registration-marks}/registration-marks-cameo-silhouette-a4.svg (100%) diff --git a/examples/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg b/examples/registration-marks/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg similarity index 100% rename from examples/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg rename to examples/registration-marks/inkscape-0.91/registration-marks-cameo-silhouette-a4-maxi.svg diff --git a/examples/inkscape-0.91/registration-marks-cameo-silhouette.svg b/examples/registration-marks/inkscape-0.91/registration-marks-cameo-silhouette.svg similarity index 100% rename from examples/inkscape-0.91/registration-marks-cameo-silhouette.svg rename to examples/registration-marks/inkscape-0.91/registration-marks-cameo-silhouette.svg diff --git a/examples/inkscape-0.91/registration-marks-robo-landscape.svg b/examples/registration-marks/inkscape-0.91/registration-marks-robo-landscape.svg similarity index 100% rename from examples/inkscape-0.91/registration-marks-robo-landscape.svg rename to examples/registration-marks/inkscape-0.91/registration-marks-robo-landscape.svg diff --git a/examples/inkscape-0.91/registration-marks-robo-portrait.svg b/examples/registration-marks/inkscape-0.91/registration-marks-robo-portrait.svg similarity index 100% rename from examples/inkscape-0.91/registration-marks-robo-portrait.svg rename to examples/registration-marks/inkscape-0.91/registration-marks-robo-portrait.svg diff --git a/examples/registration-marks-cameo-silhouette-a4.svg b/examples/registration-marks/registration-marks-cameo-silhouette-a4.svg similarity index 100% rename from examples/registration-marks-cameo-silhouette-a4.svg rename to examples/registration-marks/registration-marks-cameo-silhouette-a4.svg