Exemple #1
0
 def addCenterLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     newpth = Path('pattern', 'centerline', self.name + ' CenterLine', pth,
                   'centerline_style')
     self.add(newpth)
     return newpth
Exemple #2
0
 def addDartLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     newpth = Path('pattern', 'dartline', self.name + ' Dartline', pth,
                   'dartline_style')
     self.add(newpth)
     return newpth
Exemple #3
0
 def addFoldLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     newpth = Path('pattern', 'foldline', self.name + ' Foldline', pth,
                   'foldline_style')
     self.add(newpth)
     return newpth
Exemple #4
0
 def addMarkingLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     newpth = Path('pattern', 'markingline', self.name + ' Markingline',
                   pth, 'markingline_style')
     self.add(newpth)
     return newpth
Exemple #5
0
 def addGridLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     newpth = Path('reference', 'gridline', self.name + ' Gridline', pth,
                   'gridline_style')
     self.add(newpth)
     return newpth
Exemple #6
0
 def addOutsetLine(self, pathList):
     pth = PYB.path()
     pth.extend(pathList)
     #addToPath(pth, pathList)
     newpth = Path('pattern', 'outsetline', self.name + ' OutsetLine', pth,
                   'cuttingline_style')
     self.add(newpth)
     return newpth
Exemple #7
0
    def pattern(self):
        """
        Method defining a pattern design. This is where the designer places
        all elements of the design definition
        """

        CD = self.CD  #client data is prefaced with CD
        printer = '36" wide carriage plotter'
        patternData = {
            'companyName': 'Seamly Patterns',  #mandatory
            'designerName': 'Spencer',  #mandatory
            'patternmakerName': 'Susan Spencer',
            'patternName': 'Bodice Fitted 2',  #mandatory
            'patternNumber': 'Sp_BF2'  #mandatory
        }
        #create document
        doc = setupPattern(self, CD, printer, patternData)
        #create the 'bodice' pattern object in the document
        #TODO: reduce the next 4 standements to: doc.add(Pattern('bodice'))
        bodice = Pattern('bodice')
        bodice.styledefs.update(self.styledefs)
        bodice.markerdefs.update(self.markerdefs)
        doc.add(bodice)
        #create 'front' & 'back' pattern piece objects in the svg 'pattern' group, a19sign a14 id letter
        #TODO: add to svg 'pattern' group within the PatternPiece class definition
        bodice.add(
            PatternPiece('pattern',
                         'front',
                         'A',
                         fabric=2,
                         interfacing=0,
                         lining=0))
        bodice.add(
            PatternPiece('pattern',
                         'back',
                         'B',
                         fabric=2,
                         interfacing=0,
                         lining=0))
        #create var to refer to ea3h pattern piece using its id letter
        A = bodice.front
        B = bodice.back

        #run the BB block pattern,pull in its vars & add to this program's glob112 vars
        new_vars = BB.pattern(doc, A, B, CD)

        #globals().update(new_vars)
        globals().update(new_vars)

        #build the pattern pieces

        #Bodice Front A
        #label
        #TODO: addLabelXY(parent,x,y)  and addLabel(parent,P)
        pnt1 = rightPoint(a5, distance(a5, a6) / 2.0)
        A.label_x, A.label_y = pnt1.x, pnt1.y
        #letter
        pnt2 = upPoint(pnt1, distance(a1, a5) / 5.0)
        A.setLetter(x=pnt2.x, y=pnt2.y, scaleby=10.0)
        #grainline
        aG1 = pPoint(A, 'aG1', rightPoint(a5, distance(a5, a6) / 5.0))
        aG2 = pPoint(
            A, 'aG2',
            polarPoint(aG1,
                       distance(a1, a2) / 2.0, angleOfLine(a1, a2)))
        addGrainLine(A, aG1, aG2)
        #gridline
        gridLine = path()
        addToPath(gridLine, 'M', a7, 'L', a2, 'L', a8, 'M', a5, 'L', a6, 'M',
                  a3, 'L', a4, 'M', a10, 'L', a_apex, 'L', a11, 'M', a6, 'L',
                  a9)
        addGridLine(A, gridLine)
        #dartline
        dartLine = path()
        addToPath(dartLine, 'M', aD1.oc, 'L', aD1, 'L', aD1.ic)
        addDartLine(A, dartLine)
        #seamline & cuttingline
        seamLine = path()
        cuttingLine = path()
        for P in seamLine, cuttingLine:
            addToPath(P, 'M', a1, 'C', a7.c1, a7.c2, a7, 'L', a8, 'C', a6.c1,
                      a6.c2, a6, 'C', a4.c1, a4.c2, a4, 'L', a12)
            addToPath(P, 'C', aD1.o.c1, aD1.o.c2, aD1.o, 'C', aD1.m.c1,
                      aD1.m.c2, aD1.m, 'C', aD1.i.c1, aD1.i.c2, aD1.i, 'C',
                      a2.c1, a2.c2, a2, 'L', a1)
        addSeamLine(A, seamLine)
        addCuttingLine(A, cuttingLine)

        #build Bodice Back B
        #label
        pnt1 = leftPoint(b5, distance(b5, b6) / 2.0)
        B.label_x, B.label_y = pnt1.x, pnt1.y
        #letter
        pnt2 = upPoint(pnt1, distance(b1, b5) / 5.0)
        B.setLetter(x=pnt2.x, y=pnt2.y, scaleby=10.0)
        #grainline
        bG1 = pPoint(B, 'bG1', leftPoint(b5, distance(b3, b4) / 5.0))
        bG2 = pPoint(
            B, 'bG2',
            polarPoint(bG1,
                       distance(b1, b2) / 2.0, angleOfLine(b1, b2)))
        #gridline
        gridLine = path()
        addToPath(gridLine, 'M', b7, 'L', b2, 'L', b8, 'M', b5, 'L', b6, 'M',
                  b3, 'L', b4, 'M', b10, 'L', b11, 'M', b6, 'L', b9)
        #dartline
        dartLine = path()
        addToPath(dartLine, 'M', bD1.oc, 'L', bD1, 'L', bD1.ic)
        #seamline & cuttingline
        seamLine = path()
        cuttingLine = path()
        for P in seamLine, cuttingLine:
            addToPath(P, 'M', b1, 'C', b7.c1, b7.c2, b7, 'L', b8, 'C', b6.c1,
                      b6.c2, b6, 'C', b4.c1, b4.c2, b4, 'L', b12)
            addToPath(P, 'C', bD1.o.c1, bD1.o.c2, bD1.o, 'C', bD1.m.c1,
                      bD1.m.c2, bD1.m, 'C', bD1.i.c1, bD1.i.c2, bD1.i, 'C',
                      b2.c1, b2.c2, b2, 'L', b1)
        #add grid,grainline,seamline & cuttingline paths to pattern
        addGrainLine(B, bG1, bG2)
        addGridLine(B, gridLine)
        addDartLine(B, dartLine)
        addSeamLine(B, seamLine)
        addCuttingLine(B, cuttingLine)

        #call draw once for the entire pattern
        doc.draw()
        return
Exemple #8
0
    def getsvg(self):
        if self.debug:
            print 'getsvg() called for TestGrid ID ', self.id

        # an empty dict to hold our svg elements
        svg_dict = self.mkgroupdict()

        # TODO make the text parts configurable
        svg_gridgroup = PYB.g()
        svg_gridgroup.set_id(self.id)
        """
        Creates two TestGrids at top of pattern --> 20cm & 8in
        """

        CMW = self.centimeters * CM_TO_PX
        INW = self.inches * IN_TO_PX
        svg_gridpath = PYB.path()

        gstyle = PYB.StyleBuilder(self.styledefs[self.stylename])
        svg_gridpath.set_style(gstyle.getStyle())
        svg_gridpath.set_id(self.name)
        #t.setAttribute('transform', trans)

        svg_gridgroup.addElement(svg_gridpath)

        #Points
        start_x, start_y = self.x, self.y
        startcm_x, startcm_y = start_x, start_y
        startin_x, startin_y = start_x + CMW + 5 * CM_TO_PX, start_y
        #self.attrs['transform']='translate(' + str(-x)+', '+ str(-y) + ')'

        # centimeter grid
        i = 0
        while (i <= self.centimeters):  # vertical lines
            x = startcm_x + i * CM
            svg_gridpath.appendMoveToPath(x, startcm_y, relative=False)
            svg_gridpath.appendLineToPath(x, startcm_y + CMW, relative=False)
            i = i + 1
        i = 0
        while (i <= self.centimeters):  # horizontal lines
            y = startcm_y + i * CM
            svg_gridpath.appendMoveToPath(startcm_x, y, relative=False)
            svg_gridpath.appendLineToPath(startcm_x + CMW, y, relative=False)
            i = i + 1

        # inch grid
        i = 0
        while (i <= self.inches):  #vertical
            x = startin_x + i * IN
            svg_gridpath.appendMoveToPath(x, startin_y, relative=False)
            svg_gridpath.appendLineToPath(x, startin_y + INW, relative=False)
            i = i + 1
        i = 0
        while (i <= self.inches):  #horizontal
            y = startin_y + i * IN
            svg_gridpath.appendMoveToPath(startin_x, y, relative=False)
            svg_gridpath.appendLineToPath(startin_x + INW, y, relative=False)
            i = i + 1

        svg_dict[self.groupname].append(svg_gridgroup)
        return svg_dict
Exemple #9
0
 def addSeamLine(self, pathList):
     pth = PYB.path()
     addToPath(pth, pathList)
     self.add(
         Path('pattern', 'seamline', self.name + ' Seamline', pth,
              'seamline_style'))