예제 #1
0
 def simplifyPath(self, st):
     #print "st=",len(st)
     l = douglas(st,
                 plane=plane,
                 tolerance=point_tolerance,
                 length_tolerance=length_tolerance,
                 extrudeRelative=extrudeRelative)
     #print l
     #print len(l)
     for i, (g, p, c) in enumerate(l):
         self.output_line_count = self.output_line_count + 1
         #print "i, g,p,c=", i, g,p,c
         s = g + " "
         if p[5] & 1 == 0:
             s = s + "X{0:g}".format(p[0]) + " "
         if p[5] & 2 == 0:
             s = s + "Y{0:g}".format(p[1]) + " "
         if p[5] & 4 == 0:
             s = s + "Z{0:g}".format(p[2]) + " "
         if p[5] & 8 == 0:
             s = s + extruderLetter + "{0:g}".format(p[3]) + " "
         if p[5] & 16 == 0:
             s = s + "F{0:g}".format(p[4]) + " "
         if c is not None:
             s = s + c
         s = s.rstrip()
         output_line(s)
예제 #2
0
 def simplifyPath(self, st):
     #print "st=",len(st)
     l = douglas(st,
                 plane=plane,
                 tolerance=point_tolerance,
                 length_tolerance=length_tolerance)
     #print l
     #print len(l)
     for i, (g, p, c) in enumerate(l):
         self.output_line_count = self.output_line_count + 1
         #print "i, g,p,c=", i, g,p,c
         s = g + " "
         if p[0] is not None:
             s = s + "X{0:f}".format(p[0]) + " "
         if p[1] is not None:
             s = s + "Y{0:f}".format(p[1]) + " "
         if p[2] is not None:
             s = s + "Z{0:f}".format(p[2]) + " "
         if p[3] is not None:
             s = s + "A{0:f}".format(p[3]) + " "
         if p[4] is not None:
             s = s + "F{0:f}".format(p[4]) + " "
         if c is not None:
             s = s + c
         s = s.rstrip()
         output_line(s)
예제 #3
0
 def simplifyPath(self, st):
     #print "st=",len(st)
     l = douglas(st, plane=plane, tolerance=tolerance)
     for i, (g, p, c) in enumerate(l):
         #print "i, g,p,c=", i, g,p,c
         s = g + " "
         if p[0] is not None:
             s = s + "X{0:f}".format(p[0]) + " "
         if p[1] is not None:
             s = s + "Y{0:f}".format(p[1]) + " "
         if p[2] is not None:
             s = s + "Z{0:f}".format(p[2]) + " "
         if p[3] is not None:
             s = s + "A{0:f}".format(p[3]) + " "
         if p[4] is not None:
             s = s + "F{0:f}".format(p[4]) + " "
         if c is not None:
             s = s + c
         s = s.rstrip()
         print s
예제 #4
0
    def simplify_path(self, st):
        # print("st= %i" % len(st))

        l = douglas(st,
                    plane=self.plane,
                    tolerance=self.point_tolerance,
                    length_tolerance=self.length_tolerance)
        for i, (g, p, c) in enumerate(l):
            self.output_line_count = self.output_line_count + 1
            s = g + " "
            if p[0] is not None:
                if p[0] is not self.prevx:
                    s = s + "X{0:.3f}".format(p[0]) + " "
                    self.prevx = p[0]
            if p[1] is not None:
                if p[1] is not self.prevy:
                    s = s + "Y{0:.3f}".format(p[1]) + " "
                    self.prevy = p[1]
            if p[2] is not None:
                if p[2] != self.prevz:
                    s = s + "Z{0:.3f}".format(p[2]) + " "
                    self.prevz = p[2]
            if p[3] is not None:
                if p[3] is not self.preva:
                    s = s + "A{0:.3f}".format(p[3]) + " "
                    self.preva = p[3]
            if p[5] is not None:
                if p[5] is not self.preve:
                    s = s + "E{0:.5f}".format(p[5]) + " "
                    self.preve = p[5]
            if p[4] is not None:
                if p[4] is not self.prevf:
                    s = s + "F{0:.3f}".format(p[4]) + " "
                    self.prevf = p[4]
            if c is not None:
                s = s + c
            s = s.rstrip()
            self.output_line(s)