Example #1
0
    def makeFrontPart(self, base_pt):
        # Begin pattern piece
        part = PatternPiece('pattern',
                            'front',
                            letter='A',
                            fabric=1,
                            interfacing=0,
                            lining=0)
        path_cut = path()
        part.add(
            Path('pattern', 'path_cut', 'Cut path for front', path_cut,
                 'cuttingline_style'))
        path_front = path()
        part.add(
            Path('pattern', 'path', 'Path for front', path_front,
                 'seamline_style'))
        hem_pt = pPoint(base_pt.x, base_pt.y + self.length)
        sweep_pt = pPoint(base_pt.x + self.quarter_sweep, hem_pt.y)

        # Draw length
        moveP(path_cut, pPoint(base_pt.x, base_pt.y - self.seam_allowance))
        lineP(path_cut, pPoint(hem_pt.x, hem_pt.y + self.hem_allowance))

        # Draw waist
        waist_pt = pPoint(base_pt.x + self.quarter_waist + 0.5 * IN_TO_PX,
                          base_pt.y)
        hip_pt = pPoint(base_pt.x + self.quarter_hip,
                        base_pt.y + self.cd.front_hip_length)
        adjust_waist_pt = pPoint(base_pt.x + self.quarter_waist * 2 / 3,
                                 base_pt.y)
        adjust_hem_pt = pPoint(base_pt.x + self.quarter_sweep * 2 / 3,
                               hem_pt.y)
        # Draw waist dart
        dart_pt = pPoint(base_pt.x + self.quarter_waist / 2, waist_pt.y)
        drawCenteredDart(path_front, dart_pt, 0.5 * IN_TO_PX, 3 * IN_TO_PX)
        # Figure out how to square the waist
        new_waist_pt = squareLine(waist_pt, hip_pt, adjust_waist_pt)
        curveThroughPoints('Waist', path_front,
                           [base_pt, adjust_waist_pt, new_waist_pt])

        cut_waist_pt = pntOffLineP(new_waist_pt, hip_pt, self.seam_allowance)
        # Not a perfect continuation of the curve, but close enough
        cut_waist_pt.x += self.seam_allowance
        cut_waist_pt.y += self.seam_allowance * slopeOfLineP(
            adjust_waist_pt, new_waist_pt)
        curveThroughPoints('Waist Cut', path_cut, [
            pPoint(base_pt.x, base_pt.y - self.seam_allowance),
            pPoint(adjust_waist_pt.x, adjust_waist_pt.y - self.seam_allowance),
            cut_waist_pt
        ])

        # Draw hip
        new_hem_pt = squareLine(hip_pt, sweep_pt, adjust_hem_pt)
        moveP(path_front, pPoint(base_pt.x, hip_pt.y))
        lineP(path_front, hip_pt)
        # Draw hem
        curveThroughPoints('Hem', path_front,
                           [hem_pt, adjust_hem_pt, new_hem_pt])
        cut_hem_pt = pntOffLineP(new_hem_pt, adjust_hem_pt,
                                 self.seam_allowance)
        cut_hem_pt.y += self.hem_allowance
        curveThroughPoints('Hem Cut', path_cut, [
            pPoint(hem_pt.x, hem_pt.y + self.hem_allowance),
            pPoint(adjust_hem_pt.x, adjust_hem_pt.y + self.hem_allowance),
            cut_hem_pt
        ])

        # Draw the side curve that passes through the hip point
        curveThroughPoints('Side', path_front,
                           [new_waist_pt, hip_pt, new_hem_pt])
        curveThroughPoints('Side Cut', path_cut, [
            cut_waist_pt,
            pPoint(hip_pt.x + self.seam_allowance, hip_pt.y), cut_hem_pt
        ])

        # set the label location. Somday this should be automatic
        part.label_x = base_pt.x + self.quarter_sweep / 2
        part.label_y = base_pt.y + (self.length + 2 * IN_TO_PX) / 2
        # end of pattern piece
        return part
Example #2
0
    def makeFrontPart(self, base_pt):
        # Begin pattern piece
        part = PatternPiece('pattern', 'front', letter = 'A', fabric = 1, interfacing = 0, lining = 0)
        path_cut = path()
        part.add(Path('pattern', 'path_cut', 'Cut path for front', path_cut, 'cuttingline_style'))
        path_front = path()
        part.add(Path('pattern', 'path', 'Path for front', path_front, 'seamline_style'))
        hem_pt = pPoint(base_pt.x, base_pt.y + self.length)
        sweep_pt = pPoint(base_pt.x + self.quarter_sweep, hem_pt.y)
        
        # Draw length
        moveP(path_cut, pPoint(base_pt.x, base_pt.y - self.seam_allowance))
        lineP(path_cut, pPoint(hem_pt.x, hem_pt.y + self.hem_allowance))

        # Draw waist
        waist_pt = pPoint(base_pt.x + self.quarter_waist + 0.5 * IN_TO_PX, base_pt.y)
        hip_pt = pPoint(base_pt.x + self.quarter_hip, base_pt.y + self.cd.front_hip_length)
        adjust_waist_pt = pPoint(base_pt.x + self.quarter_waist * 2 / 3, base_pt.y)
        adjust_hem_pt = pPoint(base_pt.x + self.quarter_sweep * 2 / 3, hem_pt.y)
        # Draw waist dart
        dart_pt = pPoint(base_pt.x + self.quarter_waist / 2, waist_pt.y)
        drawCenteredDart(path_front, dart_pt, 0.5 * IN_TO_PX, 3 * IN_TO_PX)
        # Figure out how to square the waist
        new_waist_pt = squareLine(waist_pt, hip_pt, adjust_waist_pt)
        curveThroughPoints('Waist', path_front, [base_pt, adjust_waist_pt, new_waist_pt])

        cut_waist_pt = pntOffLineP(new_waist_pt, hip_pt, self.seam_allowance)
        # Not a perfect continuation of the curve, but close enough
        cut_waist_pt.x += self.seam_allowance
        cut_waist_pt.y += self.seam_allowance * slopeOfLineP(adjust_waist_pt, new_waist_pt)
        curveThroughPoints('Waist Cut', path_cut,
                           [pPoint(base_pt.x, base_pt.y - self.seam_allowance),
                            pPoint(adjust_waist_pt.x, adjust_waist_pt.y - self.seam_allowance),
                            cut_waist_pt])
        
        # Draw hip
        new_hem_pt = squareLine(hip_pt, sweep_pt, adjust_hem_pt)
        moveP(path_front, pPoint(base_pt.x, hip_pt.y))
        lineP(path_front, hip_pt)
        # Draw hem
        curveThroughPoints('Hem', path_front, [hem_pt, adjust_hem_pt, new_hem_pt])
        cut_hem_pt = pntOffLineP(new_hem_pt, adjust_hem_pt, self.seam_allowance)
        cut_hem_pt.y += self.hem_allowance
        curveThroughPoints('Hem Cut', path_cut,
                           [pPoint(hem_pt.x, hem_pt.y + self.hem_allowance),
                            pPoint(adjust_hem_pt.x, adjust_hem_pt.y + self.hem_allowance),
                            cut_hem_pt])
        
        # Draw the side curve that passes through the hip point
        curveThroughPoints('Side', path_front, [new_waist_pt, hip_pt, new_hem_pt])
        curveThroughPoints('Side Cut', path_cut,
                           [cut_waist_pt,
                            pPoint(hip_pt.x + self.seam_allowance, hip_pt.y),
                            cut_hem_pt])
        
        # set the label location. Somday this should be automatic
        part.label_x = base_pt.x + self.quarter_sweep / 2
        part.label_y = base_pt.y + (self.length + 2 * IN_TO_PX) / 2
        # end of pattern piece
        return part
Example #3
0
    def makeFrontPart(self, base_pt):
        # Begin pattern piece
        part = PatternPiece('pattern',
                            'front',
                            letter='A',
                            fabric=1,
                            interfacing=0,
                            lining=0)
        #        path_cut = path()
        #        part.add(Path('pattern', 'path_cut', 'Cut path for front', path_cut, 'cuttingline_style'))
        path_svg = path()
        part.add(
            Path('pattern', 'path', 'Path for front', path_svg,
                 'seamline_style'))

        placket_width = 1 * IN_TO_PX
        placket_allowance = 1.5 * placket_width + self.seam_allowance
        placket_pt = offsetPoint(base_pt, placket_allowance, 2 * IN_TO_PX)
        hem_pt = offsetPoint(placket_pt, 0, self.length)

        # Plot the shoulder
        shoulder_pt = offsetPoint(placket_pt, self.half_shoulder, 0)

        # Plot the hip and waist
        waist_pt = offsetPoint(placket_pt, self.quarter_waist,
                               self.cd.front_shoulder_height)
        hip_pt = offsetPoint(hem_pt, self.quarter_hip, 0)
        adjust_hip_pt = offsetPoint(hem_pt, self.quarter_hip * 2 / 3, 0)
        new_hip_pt = squareLine(waist_pt, hip_pt, adjust_hip_pt)
        curveThroughPoints('Hem', path_svg,
                           [hem_pt, adjust_hip_pt, new_hip_pt])

        # Plot the waist
        moveP(path_svg,
              offsetPoint(placket_pt, 0, self.cd.front_shoulder_height))
        lineP(path_svg, waist_pt)

        # Plot the bust line
        armscye_pt = offsetPoint(shoulder_pt, 0, self.cd.armscye_depth)
        bust_pt = offsetPoint(placket_pt, self.quarter_bust,
                              self.cd.armscye_depth)
        moveP(path_svg, shoulder_pt)
        armscye_top_pt = offsetPoint(shoulder_pt, 0, 2 * IN_TO_PX)
        armscye_bottom_pt = offsetPoint(bust_pt, -0.5 * IN_TO_PX, 0)

        lineP(path_svg, armscye_top_pt)
        rPoint(part, 'Armscye top', armscye_top_pt.x, armscye_top_pt.y)
        control1 = offsetPoint(armscye_top_pt, 0, 2 * IN_TO_PX)
        control2 = offsetPoint(armscye_bottom_pt, -1 * IN_TO_PX, 0)
        cubicCurveP(path_svg, control1, control2, armscye_bottom_pt)
        self.front_armscye_length = (
            lineLengthP(shoulder_pt, armscye_top_pt) + curveLength(
                [armscye_top_pt, control1, control2, armscye_bottom_pt]) +
            lineLengthP(armscye_bottom_pt, bust_pt))

        moveP(path_svg, armscye_pt)
        lineP(path_svg, armscye_bottom_pt)
        moveP(path_svg, offsetPoint(placket_pt, 0, self.cd.armscye_depth))
        rPoint(part, 'Armscye bottom', armscye_bottom_pt.x,
               armscye_bottom_pt.y)
        moveP(path_svg, offsetPoint(placket_pt, 0, self.cd.armscye_depth))
        lineP(path_svg, bust_pt)

        # Plot the neck points
        high_neck_pt = offsetPoint(placket_pt, self.half_neck,
                                   -0.25 * IN_TO_PX)
        moveP(path_svg, high_neck_pt)
        lineP(path_svg, shoulder_pt)
        neck_pt = offsetPoint(placket_pt, 0,
                              self.front_neck_drop - 0.5 * IN_TO_PX)
        rPoint(part, 'Neck point', neck_pt.x, neck_pt.y)
        moveP(path_svg, neck_pt)
        lineP(path_svg, hem_pt)
        # Draw the curve for the neck points

        # Connect the dots
        curveThroughPoints('Side', path_svg, [bust_pt, waist_pt, new_hip_pt])

        # Plot the neckline
        new_neck_pt = pntOffLineP(high_neck_pt, shoulder_pt, 0.5 * IN_TO_PX)
        rPointP(part, 'Neck', new_neck_pt)
        # TODO: Un-fudge these numbers
        moveP(path_svg, high_neck_pt)
        lineP(path_svg, new_neck_pt)
        control1 = offsetPoint(new_neck_pt, 0, 2 * IN_TO_PX)
        control2 = offsetPoint(neck_pt, 2 * IN_TO_PX, 0)
        cubicCurveP(path_svg, control1, control2, neck_pt)
        print "curveLength for front neck: "
        self.front_neck_length = curveLength(
            [new_neck_pt, control1, control2, neck_pt])

        # Plot the placket
        moveP(path_svg, offsetPoint(neck_pt, -0.5 * IN_TO_PX, 0))
        lineP(path_svg, offsetPoint(hem_pt, -0.5 * IN_TO_PX, 0))
        moveP(path_svg, pPoint(base_pt.x, neck_pt.y))
        lineP(path_svg, neck_pt)
        moveP(path_svg, pPoint(base_pt.x, neck_pt.y))
        lineP(path_svg, pPoint(base_pt.x, hem_pt.y))
        lineP(path_svg, hem_pt)

        # set the label location. Somday this should be automatic
        part.label_x = base_pt.x
        part.label_y = base_pt.y + (self.length + 2 * IN_TO_PX) / 2
        # end of pattern piece
        return part
Example #4
0
    def makeFrontPart(self, base_pt):
        # Begin pattern piece
        part = PatternPiece('pattern', 'front', letter = 'A', fabric = 1, interfacing = 0, lining = 0)
#        path_cut = path()
#        part.add(Path('pattern', 'path_cut', 'Cut path for front', path_cut, 'cuttingline_style'))
        path_svg = path()
        part.add(Path('pattern', 'path', 'Path for front', path_svg, 'seamline_style'))

        placket_width = 1 * IN_TO_PX
        placket_allowance = 1.5 * placket_width + self.seam_allowance
        placket_pt = offsetPoint(base_pt, placket_allowance, 2 * IN_TO_PX)
        hem_pt = offsetPoint(placket_pt, 0, self.length)
        
        # Plot the shoulder
        shoulder_pt = offsetPoint(placket_pt, self.half_shoulder, 0)
        
        # Plot the hip and waist
        waist_pt = offsetPoint(placket_pt, self.quarter_waist, self.cd.front_shoulder_height)
        hip_pt = offsetPoint(hem_pt, self.quarter_hip, 0)
        adjust_hip_pt = offsetPoint(hem_pt, self.quarter_hip * 2 / 3, 0)
        new_hip_pt = squareLine(waist_pt, hip_pt, adjust_hip_pt)
        curveThroughPoints('Hem', path_svg, [hem_pt, adjust_hip_pt, new_hip_pt])

        # Plot the waist
        moveP(path_svg, offsetPoint(placket_pt, 0, self.cd.front_shoulder_height))
        lineP(path_svg, waist_pt)

        # Plot the bust line
        armscye_pt = offsetPoint(shoulder_pt, 0, self.cd.armscye_depth)
        bust_pt = offsetPoint(placket_pt, self.quarter_bust, self.cd.armscye_depth)
        moveP(path_svg, shoulder_pt)
        armscye_top_pt = offsetPoint(shoulder_pt, 0, 2 * IN_TO_PX)
        armscye_bottom_pt = offsetPoint(bust_pt, -0.5 * IN_TO_PX, 0)
        
        lineP(path_svg, armscye_top_pt)
        rPoint(part, 'Armscye top', armscye_top_pt.x, armscye_top_pt.y)
        control1 = offsetPoint(armscye_top_pt, 0, 2 * IN_TO_PX)
        control2 = offsetPoint(armscye_bottom_pt, -1 * IN_TO_PX, 0)
        cubicCurveP(path_svg, control1, control2, armscye_bottom_pt)
        self.front_armscye_length = (lineLengthP(shoulder_pt, armscye_top_pt)
                                    + curveLength([armscye_top_pt, control1, control2, armscye_bottom_pt])
                                    + lineLengthP(armscye_bottom_pt, bust_pt))

        moveP(path_svg, armscye_pt)
        lineP(path_svg, armscye_bottom_pt)
        moveP(path_svg, offsetPoint(placket_pt, 0, self.cd.armscye_depth))
        rPoint(part, 'Armscye bottom', armscye_bottom_pt.x, armscye_bottom_pt.y)
        moveP(path_svg, offsetPoint(placket_pt, 0, self.cd.armscye_depth))
        lineP(path_svg, bust_pt)
        
        # Plot the neck points
        high_neck_pt = offsetPoint(placket_pt, self.half_neck, -0.25 * IN_TO_PX)
        moveP(path_svg, high_neck_pt)
        lineP(path_svg, shoulder_pt)
        neck_pt = offsetPoint(placket_pt, 0, self.front_neck_drop - 0.5 * IN_TO_PX)
        rPoint(part, 'Neck point', neck_pt.x, neck_pt.y)
        moveP(path_svg, neck_pt)
        lineP(path_svg, hem_pt)
        # Draw the curve for the neck points

        # Connect the dots
        curveThroughPoints('Side', path_svg, [bust_pt, waist_pt, new_hip_pt])
        
        # Plot the neckline
        new_neck_pt = pntOffLineP(high_neck_pt, shoulder_pt, 0.5 * IN_TO_PX)
        rPointP(part, 'Neck', new_neck_pt)
        # TODO: Un-fudge these numbers
        moveP(path_svg, high_neck_pt)
        lineP(path_svg, new_neck_pt)
        control1 = offsetPoint(new_neck_pt, 0, 2 * IN_TO_PX)
        control2 = offsetPoint(neck_pt, 2 * IN_TO_PX, 0)
        cubicCurveP(path_svg, control1, control2, neck_pt)
        print "curveLength for front neck: "
        self.front_neck_length = curveLength([new_neck_pt, control1, control2, neck_pt])

        # Plot the placket
        moveP(path_svg, offsetPoint(neck_pt, -0.5 * IN_TO_PX, 0))
        lineP(path_svg, offsetPoint(hem_pt, -0.5 * IN_TO_PX, 0))
        moveP(path_svg, pPoint(base_pt.x, neck_pt.y))
        lineP(path_svg, neck_pt)
        moveP(path_svg, pPoint(base_pt.x, neck_pt.y))
        lineP(path_svg, pPoint(base_pt.x, hem_pt.y))
        lineP(path_svg, hem_pt)
        
        # set the label location. Somday this should be automatic
        part.label_x = base_pt.x
        part.label_y = base_pt.y + (self.length + 2 * IN_TO_PX) / 2
        # end of pattern piece
        return part