From dd5e99cf159d4f19beb05d8e202063a96854aefe Mon Sep 17 00:00:00 2001 From: buliabyak Date: Thu, 23 Nov 2006 20:42:36 +0000 Subject: [PATCH] retire fretboard designer --- share/extensions/Makefile.am | 8 -- share/extensions/ffgeom.py | 138 ------------------------- share/extensions/ffmet.inx | 26 ----- share/extensions/ffms.inx | 26 ----- share/extensions/ffproc.py | 194 ----------------------------------- share/extensions/ffscale.py | 73 ------------- share/extensions/ffset.inx | 24 ----- share/extensions/ffss.inx | 24 ----- share/extensions/fretfind.py | 186 --------------------------------- 9 files changed, 699 deletions(-) delete mode 100755 share/extensions/ffgeom.py delete mode 100644 share/extensions/ffmet.inx delete mode 100644 share/extensions/ffms.inx delete mode 100755 share/extensions/ffproc.py delete mode 100755 share/extensions/ffscale.py delete mode 100644 share/extensions/ffset.inx delete mode 100644 share/extensions/ffss.inx delete mode 100755 share/extensions/fretfind.py diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 8a6ad980d..8015d8792 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -22,10 +22,6 @@ extensions = \ cubicsuperpath.py \ dots.py \ export_gimp_palette.py \ - ffgeom.py \ - ffproc.py \ - ffscale.py \ - fretfind.py \ funcplot.py \ handles.py \ inkex.py \ @@ -107,10 +103,6 @@ modules = \ pdf_output_via_gs_on_win32.inx.txt \ txt2svg.inx \ dots.inx \ - ffmet.inx \ - ffms.inx \ - ffss.inx \ - ffset.inx \ funcplot.inx \ handles.inx \ interp.inx \ diff --git a/share/extensions/ffgeom.py b/share/extensions/ffgeom.py deleted file mode 100755 index 24d80a175..000000000 --- a/share/extensions/ffgeom.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -""" - ffgeom.py - Copyright (C) 2005 Aaron Cyril Spike, aaron@ekips.org - - This file is part of FretFind 2-D. - - FretFind 2-D is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - FretFind 2-D is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FretFind 2-D; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -""" -import math -try: - NaN = float('NaN') -except ValueError: - PosInf = 1e300000 - NaN = PosInf/PosInf - -class Point: - precision = 5 - def __init__(self, x, y): - self.__coordinates = {'x' : float(x), 'y' : float(y)} - def __getitem__(self, key): - return self.__coordinates[key] - def __setitem__(self, key, value): - self.__coordinates[key] = float(value) - def __repr__(self): - return '(%s, %s)' % (round(self['x'],self.precision),round(self['y'],self.precision)) - def copy(self): - return Point(self['x'],self['y']) - def translate(self, x, y): - self['x'] += x - self['y'] += y - def move(self, x, y): - self['x'] = float(x) - self['y'] = float(y) - -class Segment: - def __init__(self, e0, e1): - self.__endpoints = [e0, e1] - def __getitem__(self, key): - return self.__endpoints[key] - def __setitem__(self, key, value): - self.__endpoints[key] = value - def __repr__(self): - return repr(self.__endpoints) - def copy(self): - return Segment(self[0],self[1]) - def translate(self, x, y): - self[0].translate(x,y) - self[1].translate(x,y) - def move(self,e0,e1): - self[0] = e0 - self[1] = e1 - def delta_x(self): - return self[1]['x'] - self[0]['x'] - def delta_y(self): - return self[1]['y'] - self[0]['y'] - #alias functions - run = delta_x - rise = delta_y - def slope(self): - if self.delta_x() != 0: - return self.delta_x() / self.delta_y() - return NaN - def intercept(self): - if self.delta_x() != 0: - return self[1]['y'] - (self[0]['x'] * self.slope()) - return NaN - def distanceToPoint(self, p): - s2 = Segment(self[0],p) - c1 = dot(s2,self) - if c1 <= 0: - return Segment(p,self[0]).length() - c2 = dot(self,self) - if c2 <= c1: - return Segment(p,self[1]).length() - return self.perpDistanceToPoint(p) - def perpDistanceToPoint(self, p): - len = self.length() - if len == 0: return NaN - return math.fabs(((self[1]['x'] - self[0]['x']) * (self[0]['y'] - p['y'])) - \ - ((self[0]['x'] - p['x']) * (self[1]['y'] - self[0]['y']))) / len - def angle(self): - return math.pi * (math.atan2(self.delta_y(), self.delta_x())) / 180 - def length(self): - return math.sqrt((self.delta_x() ** 2) + (self.delta_y() ** 2)) - def pointAtLength(self, len): - if self.length() == 0: return Point(NaN, NaN) - ratio = len / self.length() - x = self[0]['x'] + (ratio * self.delta_x()) - y = self[0]['y'] + (ratio * self.delta_y()) - return Point(x, y) - def pointAtRatio(self, ratio): - if self.length() == 0: return Point(NaN, NaN) - x = self[0]['x'] + (ratio * self.delta_x()) - y = self[0]['y'] + (ratio * self.delta_y()) - return Point(x, y) - def createParallel(self, p): - return Segment(Point(p['x'] + self.delta_x(), p['y'] + self.delta_y()), p) - def intersect(self, s): - return intersectSegments(self, s) - -def intersectSegments(s1, s2): - x1 = s1[0]['x'] - x2 = s1[1]['x'] - x3 = s2[0]['x'] - x4 = s2[1]['x'] - - y1 = s1[0]['y'] - y2 = s1[1]['y'] - y3 = s2[0]['y'] - y4 = s2[1]['y'] - - denom = ((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1)) - num1 = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3)) - num2 = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3)) - - num = num1 - - if denom != 0: - x = x1 + ((num / denom) * (x2 - x1)) - y = y1 + ((num / denom) * (y2 - y1)) - return Point(x, y) - return Point(NaN, NaN) - -def dot(s1, s2): - return s1.delta_x() * s2.delta_x() + s1.delta_y() * s2.delta_y() diff --git a/share/extensions/ffmet.inx b/share/extensions/ffmet.inx deleted file mode 100644 index 5476621f4..000000000 --- a/share/extensions/ffmet.inx +++ /dev/null @@ -1,26 +0,0 @@ - - <_name>Multi Length Equal Temperament - org.ekips.filter.fretfind.multi.et - fretfind.py - inkex.py - 25 - 26 - 0.5 - 2 - 2.5 - 2 - 12 - 24 - 6 - 0.0975 - 90 - - all - - - - - - diff --git a/share/extensions/ffms.inx b/share/extensions/ffms.inx deleted file mode 100644 index 7405b42b2..000000000 --- a/share/extensions/ffms.inx +++ /dev/null @@ -1,26 +0,0 @@ - - <_name>Multi Length Scala - org.ekips.filter.fretfind.multi.scala - fretfind.py - inkex.py - 25 - 26 - 0.5 - 2 - 2.5 - none - 0;0;0;0;0;0 - 24 - 6 - 0.0975 - 90 - - all - - - - - - diff --git a/share/extensions/ffproc.py b/share/extensions/ffproc.py deleted file mode 100755 index b288d250d..000000000 --- a/share/extensions/ffproc.py +++ /dev/null @@ -1,194 +0,0 @@ -#!/usr/bin/env python -''' - Copyright (C) 2004 Aaron Cyril Spike - - This file is part of FretFind 2-D. - - FretFind 2-D is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - FretFind 2-D is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FretFind 2-D; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -''' -import sys -from ffgeom import * -threshold=0.0000000001 - -def FindFrets(strings, meta, scale, tuning, numfrets): - scale = scale['steps'] - - #if the string ends don't fall on the nut and bridge - #don't look for partial frets. - numStrings = len(strings) - doPartials = True - parallelFrets = True - - nut = Segment(strings[0][0],strings[-1][0]) - bridge = Segment(strings[0][1],strings[-1][1]) - midline = Segment( - Point((nut[1]['x']+nut[0]['x'])/2.0,(nut[1]['y']+nut[0]['y'])/2.0), - Point((bridge[1]['x']+bridge[0]['x'])/2.0,(bridge[1]['y']+bridge[0]['y'])/2.0)) - for s in strings: - if nut.perpDistanceToPoint(s[0])>=threshold or bridge.perpDistanceToPoint(s[1])>=threshold: - doPartials = False - break - - denom = ((bridge[1]['y']-bridge[0]['y'])*(nut[1]['x']-nut[0]['x']))-((bridge[1]['x']-bridge[0]['x'])*(nut[1]['y']-nut[0]['y'])) - if denom != 0: - parallelFrets = False - - fretboard = [] - tones = len(scale)-1 - for i in range(len(strings)): - base = tuning[i] - frets = [] - if doPartials: - frets.append(Segment(meta[i][0],meta[i+1][0])) - else: - frets.append(Segment(strings[i][0],strings[i][0])) - last = strings[i][0] - - for j in range(numfrets): - step=((base+j-1)%(tones))+1 - ratio=1.0-((scale[step][1]*scale[step-1][0])/(scale[step][0]*scale[step-1][1])) - x = last['x']+(ratio*(strings[i][1]['x']-last['x'])) - y = last['y']+(ratio*(strings[i][1]['y']-last['y'])) - current = Point(x,y) - temp = Segment(strings[i][0],current) - totalRatio = temp.length()/strings[i].length() - - if doPartials: - #partials depending on outer strings (questionable) - if parallelFrets: - temp = nut.createParallel(current) - else: - temp = Segment(strings[0].pointAtLength(strings[0].length()*totalRatio), - strings[-1].pointAtLength(strings[-1].length()*totalRatio)) - frets.append(Segment(intersectSegments(temp,meta[i]),intersectSegments(temp,meta[i+1]))) - else: - frets.append(Segment(current,current)) - last = current - fretboard.append(frets) - return fretboard - -def FindStringsSingleScale(numStrings,scaleLength,nutWidth,bridgeWidth,oNF,oBF,oNL,oBL): - strings = [] - meta = [] - nutHalf = nutWidth/2 - bridgeHalf = bridgeWidth/2 - nutCandidateCenter = (nutHalf) + oNL - bridgeCandidateCenter = (bridgeHalf) + oBL - if bridgeCandidateCenter >= nutCandidateCenter: - center = bridgeCandidateCenter - else: - center = nutCandidateCenter - nutStringSpacing = nutWidth/(numStrings-1) - bridgeStringSpacing = bridgeWidth/(numStrings-1) - - for i in range(numStrings): - strings.append(Segment(Point(center+nutHalf-(i*nutStringSpacing),0), - Point(center+bridgeHalf-(i*bridgeStringSpacing),scaleLength))) - - meta.append(Segment(Point(center+nutHalf+oNF,0),Point(center+bridgeHalf+oBF,scaleLength))) - for i in range(1,numStrings): - meta.append(Segment( - Point((strings[i-1][0]['x']+strings[i][0]['x'])/2.0, - (strings[i-1][0]['y']+strings[i][0]['y'])/2.0), - Point((strings[i-1][1]['x']+strings[i][1]['x'])/2.0, - (strings[i-1][1]['y']+strings[i][1]['y'])/2.0))) - meta.append(Segment(Point(center-(nutHalf+oNL),0),Point(center-(bridgeHalf+oBL),scaleLength))) - - return strings, meta - -def FindStringsMultiScale(numStrings,scaleLengthF,scaleLengthL,nutWidth,bridgeWidth,perp,oNF,oBF,oNL,oBL): - strings = [] - meta = [] - nutHalf = nutWidth/2 - bridgeHalf = bridgeWidth/2 - nutCandidateCenter = (nutHalf)+oNL - bridgeCandidateCenter = (bridgeHalf)+oBL - if bridgeCandidateCenter >= nutCandidateCenter: - xcenter = bridgeCandidateCenter - else: - nutCandidateCenter - - fbnxf = xcenter+nutHalf+oNF - fbbxf = xcenter+bridgeHalf+oBF - fbnxl = xcenter-(nutHalf+oNL) - fbbxl = xcenter-(bridgeHalf+oBL) - - snxf = xcenter+nutHalf - sbxf = xcenter+bridgeHalf - snxl = xcenter-nutHalf - sbxl = xcenter-bridgeHalf - - fdeltax = sbxf-snxf - ldeltax = sbxl-snxl - fdeltay = math.sqrt((scaleLengthF*scaleLengthF)-(fdeltax*fdeltax)) - ldeltay = math.sqrt((scaleLengthL*scaleLengthL)-(ldeltax*ldeltax)) - - fperp = perp*fdeltay - lperp = perp*ldeltay - - #temporarily place first and last strings - first = Segment(Point(snxf,0),Point(sbxf,fdeltay)) - last = Segment(Point(snxl,0),Point(sbxl,ldeltay)) - - if fdeltay<=ldeltay: - first.translate(0,(lperp-fperp)) - else: - last.translate(0,(fperp-lperp)) - - nut = Segment(first[0].copy(),last[0].copy()) - bridge = Segment(first[1].copy(),last[1].copy()) - #overhang measurements are now converted from delta x to along line lengths - oNF = (oNF*nut.length())/nutWidth - oNL = (oNL*nut.length())/nutWidth - oBF = (oBF*bridge.length())/bridgeWidth - oBL = (oBL*bridge.length())/bridgeWidth - #place fretboard edges - fbf = Segment(nut.pointAtLength(-oNF),bridge.pointAtLength(-oBF)) - fbl = Segment(nut.pointAtLength(nut.length()+oNL),bridge.pointAtLength(bridge.length()+oBL)) - #normalize values into the first quadrant via translate - if fbf[0]['y']<0 or fbl[0]['y']<0: - if fbf[0]['y']<=fbl[0]['y']: - move = -fbf[0]['y'] - else: - move = -fbl[0]['y'] - - first.translate(0,move) - last.translate(0,move) - nut.translate(0,move) - bridge.translate(0,move) - fbf.translate(0,move) - fbl.translate(0,move) - - #output values - nutStringSpacing = nut.length()/(numStrings-1) - bridgeStringSpacing = bridge.length()/(numStrings-1) - strings.append(first) - for i in range(1,numStrings-1): - n = nut.pointAtLength(i*nutStringSpacing) - b = bridge.pointAtLength(i*bridgeStringSpacing) - strings.append(Segment(Point(n['x'],n['y']),Point(b['x'],b['y']))) - strings.append(last) - - meta.append(fbf) - for i in range(1,numStrings): - meta.append(Segment( - Point((strings[i-1][0]['x']+strings[i][0]['x'])/2.0, - (strings[i-1][0]['y']+strings[i][0]['y'])/2.0), - Point((strings[i-1][1]['x']+strings[i][1]['x'])/2.0, - (strings[i-1][1]['y']+strings[i][1]['y'])/2.0))) - - meta.append(fbl) - - return strings, meta diff --git a/share/extensions/ffscale.py b/share/extensions/ffscale.py deleted file mode 100755 index 74bc6b989..000000000 --- a/share/extensions/ffscale.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -''' - Copyright (C) 2004 Aaron Cyril Spike - - This file is part of FretFind 2-D. - - FretFind 2-D is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - FretFind 2-D is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FretFind 2-D; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -''' -import math - -def ETScale(tones, octave=2.0): - octave, tones = float(octave), float(tones) - scale = {'steps':[[1.0,1.0]], 'title':'', 'errors':0, 'errorstring':''} - if not tones: - scale['errors'] += 1 - scale['errorstring'] = 'Error: Number of tones must be non zero!' - else: - ratio = octave**(1/tones) - scale['title'] = '%s root of %s Equal Temperament' % (tones, octave) - scale['steps'].append([ratio,1]) - return scale - -def ScalaScale(scala): - #initial step 0 or 1/1 is implicit - scale = {'steps':[[1.0,1.0]], 'title':'', 'errors':0, 'errorstring':''} - - #split scale discarding commments - lines = [l.strip() for l in scala.strip().splitlines() if not l.strip().startswith('!')] - - #first line may be blank and contains the title - scale['title'] = lines.pop(0) - - #second line indicates the number of note lines that should follow - expected = int(lines.pop(0)) - - #discard blank lines and anything following whitespace - lines = [l.split()[0] for l in lines if l != ''] - - if len(lines) != expected: - scale['errors'] += 1 - scale['errorstring'] = 'Error: expected %s more tones but found %s!' % (expected,len(lines)) - else: - for l in lines: - #interpret anyline containing a dot as cents - if l.find('.') >= 0: - num = 2**(float(l)/1200) - denom = 1 - #everything else is a ratio - elif l.find('/') >=0: - l = l.split('/') - num = float(int(l[0])) - denom = float(int(l[1])) - else: - num = float(int(l)) - denom = 1.0 - scale['steps'].append([num,denom]) - - if (num < 0) ^ (denom <= 0): - scale['errors'] += 1 - scale['errorstring'] += 'Error at "'+l+'": Negative and undefined ratios are not allowed!\n' - return scale diff --git a/share/extensions/ffset.inx b/share/extensions/ffset.inx deleted file mode 100644 index c99a6f732..000000000 --- a/share/extensions/ffset.inx +++ /dev/null @@ -1,24 +0,0 @@ - - <_name>Single Length Equal Temperament - org.ekips.filter.fretfind.single.et - fretfind.py - inkex.py - 25 - 2 - 2.5 - 2 - 12 - 24 - 6 - 0.0975 - 90 - - all - - - - - - diff --git a/share/extensions/ffss.inx b/share/extensions/ffss.inx deleted file mode 100644 index f7f30ac2b..000000000 --- a/share/extensions/ffss.inx +++ /dev/null @@ -1,24 +0,0 @@ - - <_name>Single Length Scala - org.ekips.filter.fretfind.single.scala - fretfind.py - inkex.py - 25 - 2 - 2.5 - none - 0;0;0;0;0;0 - 24 - 6 - 0.0975 - 90 - - all - - - - - - diff --git a/share/extensions/fretfind.py b/share/extensions/fretfind.py deleted file mode 100755 index 14da7819d..000000000 --- a/share/extensions/fretfind.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python -''' -Copyright (C) 2005 Aaron Spike, aaron@ekips.org - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -''' -import sys -import inkex, simplestyle, simplepath -import ffscale, ffproc - -def seg2path(seg): - return "M%s,%sL%s,%s" % (seg[0]['x'],seg[0]['y'],seg[1]['x'],seg[1]['y']) - -class FretFind(inkex.Effect): - def __init__(self): - inkex.Effect.__init__(self) - self.doScala = False - self.doMultiScale = False - self.OptionParser.add_option("--scalafile", - action="store", type="string", - dest="scalafile", default=None, - help="") - self.OptionParser.add_option("--scalascale", - action="store", type="string", - dest="scalascale", default=None, - help="") - self.OptionParser.add_option("--etbase", - action="store", type="float", - dest="etbase", default=2.0, - help="") - self.OptionParser.add_option("--etroot", - action="store", type="float", - dest="etroot", default=12.0, - help="") - self.OptionParser.add_option("--tuning", - action="store", type="string", - dest="tuning", default="0;0;0;0;0;0", - help="") - self.OptionParser.add_option("--perpdist", - action="store", type="float", - dest="perpdist", default=0.5, - help="") - self.OptionParser.add_option("--offset", - action="store", type="float", - dest="offset", default=0.0, - help="") - self.OptionParser.add_option("--scalelength", - action="store", type="float", - dest="scalelength", default=25.0, - help="") - self.OptionParser.add_option("--firstscalelength", - action="store", type="float", - dest="firstscalelength", default=None, - help="") - self.OptionParser.add_option("--lastscalelength", - action="store", type="float", - dest="lastscalelength", default=None, - help="") - self.OptionParser.add_option("--nutwidth", - action="store", type="float", - dest="nutwidth", default=1.5, - help="") - self.OptionParser.add_option("--bridgewidth", - action="store", type="float", - dest="bridgewidth", default=2.5, - help="") - self.OptionParser.add_option("--frets", - action="store", type="int", - dest="frets", default=24, - help="") - self.OptionParser.add_option("--strings", - action="store", type="int", - dest="strings", default=6, - help="") - self.OptionParser.add_option("--fbedges", - action="store", type="float", - dest="fbedges", default=0.0975, - help="") - self.OptionParser.add_option("--pxperunit", - action="store", type="float", - dest="pxperunit", default=90, - help="") - def checkopts(self): - #scale type - if self.options.scalascale is not None: - self.doScala = True - if self.options.scalafile is not None: - if self.doScala: - sys.stderr.write('Mutually exclusive options: if found scalafile will override scalascale.') - else: - self.options.scalascale = "" - self.doScala = True - try: - f = open(self.options.scalafile,'r') - self.options.scalascale = f.read() - except: - sys.exit('Scala scale description file expected.') - #scale - if self.doScala: - self.scale = ffscale.ScalaScale(self.options.scalascale) - else: - self.scale = ffscale.ETScale(self.options.etroot,self.options.etbase) - - #string length - first = self.options.firstscalelength is not None - last = self.options.lastscalelength is not None - if first and last: - self.doMultiScale = True - elif first: - sys.stderr.write('Missing lastscalelength: overriding scalelength with firstscalelength.') - self.options.scalelength = self.options.firstscalelength - elif last: - sys.stderr.write('Missing firstscalelength: overriding scalelength with lastscalelength.') - self.options.scalelength = self.options.lastscalelength - - #tuning - self.tuning = [int(t.strip()) for t in self.options.tuning.split(";")] - self.tuning.extend([0 for i in range(self.options.strings - len(self.tuning))]) - - def effect(self): - self.checkopts() - - o = self.options.fbedges - oNF,oBF,oNL,oBL = o,o,o,o - - if self.doMultiScale: - strings, meta = ffproc.FindStringsMultiScale(self.options.strings,self.options.firstscalelength, - self.options.lastscalelength,self.options.nutwidth,self.options.bridgewidth, - self.options.perpdist,oNF,oBF,oNL,oBL) - else: - strings, meta = ffproc.FindStringsSingleScale(self.options.strings,self.options.scalelength, - self.options.nutwidth,self.options.bridgewidth, - oNF,oBF,oNL,oBL) - - frets = ffproc.FindFrets(strings, meta, self.scale, self.tuning, self.options.frets) - - edgepath = seg2path(meta[0]) + seg2path(meta[-1]) - stringpath = "".join([seg2path(s) for s in strings]) - fretpath = "".join(["".join([seg2path(f) for f in s]) for s in frets]) - - group = self.document.createElement('svg:g') - group.setAttribute('transform',"scale(%s,%s)" % (self.options.pxperunit,self.options.pxperunit)) - self.current_layer.appendChild(group) - - edge = self.document.createElement('svg:path') - s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', - 'stroke-opacity': '1.0', 'fill-opacity': '1.0', - 'stroke': '#0000FF', 'stroke-linecap': 'butt', - 'fill': 'none'} - edge.setAttribute('style', simplestyle.formatStyle(s)) - edge.setAttribute('d', edgepath) - - string = self.document.createElement('svg:path') - s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', - 'stroke-opacity': '1.0', 'fill-opacity': '1.0', - 'stroke': '#FF0000', 'stroke-linecap': 'butt', - 'fill': 'none'} - string.setAttribute('style', simplestyle.formatStyle(s)) - string.setAttribute('d', stringpath) - - fret = self.document.createElement('svg:path') - s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', - 'stroke-opacity': '1.0', 'fill-opacity': '1.0', - 'stroke': '#000000', 'stroke-linecap': 'butt', - 'fill': 'none'} - fret.setAttribute('style', simplestyle.formatStyle(s)) - fret.setAttribute('d', fretpath) - - group.appendChild(edge) - group.appendChild(string) - group.appendChild(fret) - -e = FretFind() -e.affect() \ No newline at end of file -- 2.30.2