def put(self, cut = None, safeHeight = None, offset = None, tool = None, inside = None): """offset and tool optional""" if cut != None: self.cut = cut if safeHeight != None: self.safeHeight = safeHeight if offset != None: self.offset = Offset(offsetType = offset, tool = tool.id) if cut.type == "straightFeed": dist = getDist(self.cut.startPt, self.cut.endPt) self.offsetVector = -1 * numpy.array([(self.cut.endPt[0] - self.cut.startPt[0]) / dist, (self.cut.endPt[1] - self.cut.startPt[1]) / dist, 0]) if cut.type == "arc": dist = getDist(self.cut.startPt, self.cut.endPt) self.offsetVector = -1 * numpy.array([(self.cut.endPt[0] - self.cut.startPt[0]) / dist, (self.cut.endPt[1] - self.cut.startPt[1]) / dist, 0]) if tool != None: self.tool = tool if self.tool != None: self.toolDiaOffset = [tool.diameter, tool.diameter, 0] else: self.toolDiaOffset = [0, 0, 0]
def put(self, endPt = None, offset = None, startPt = None, centerPt =None, direction = None): if endPt != None: self.endPt = self.flat_to3D(endPt) if startPt != None: self.startPt = self.flat_to3D(startPt) if offset: self.offset = self.flat_to3D(offset) if (centerPt != None) and (startPt != None): self.offset = numpy.array(self.flat_to3D(centerPt)) - numpy.array(self.flat_to3D(startPt)) self.centerPt = numpy.array(self.startPt) + numpy.array(self.offset) self.radius = getDist(self.startPt, self.centerPt) if direction: self.direction = direction