Exemplo n.º 1
0
    def __init__(self, trimShape, pathWidth, angleDegrees, shiftX=0, shiftY=0,
                 design=None, designType=c.PARTIAL_ROW):
        LG.__init__(self, None)
        self.shiftX = shiftX
        self.shiftY = shiftY
        self.designType = designType
        self.trimShape = s.Shape(trimShape)
        self.angleRad = (angleDegrees/360.0*2*np.pi)
        self.pathWidth = pathWidth
        lowerLeft = p.Point(self.trimShape.minX, self.trimShape.minY)
        upperRight = p.Point(self.trimShape.maxX, self.trimShape.maxY)
        
        self.trimDiagonal = (lowerLeft - upperRight)*1.1       
        self.operations = (self.extendDesign, self.createField,
                           self.centerAndRotateField, self.trimField)
        
        if(design is None):
#            point1 = p.Point(-self.trimDiagonal-10, 0)
#            point2 = p.Point(self.trimDiagonal+10, 0)
            self.design = ds.lineField(self.pathWidth, self.trimDiagonal, self.trimDiagonal)#lg.LineGroup([l.Line(point1, point2)])
            self.designType = c.FULL_FIELD
        else:
            self.design = lg.LineGroup(design)
        
        print('\nInFill times:')
        maxLength = max(len(f.__name__) for f in self.operations) + 2 
        for i in range(self.designType, c.TRIMMED_FIELD):
            startTime = time.time()
            self.operations[i]();
            print((self.operations[i].__name__ +
                    ''.ljust(maxLength - len(self.operations[i].__name__)) +
                    '%.2f sec' %(time.time()-startTime)))
Exemplo n.º 2
0
 def __init__(self, start, end, direction, center, numPoints=c.ARC_NUMPOINTS):
     LG.__init__(self, None)        
     self.start = start
     self.end = end
     self.direction = direction
     self.center = center
     self.numPoints = numPoints        
     self.arcToLines()