def CallMoveWpZero(self): """ This function is called when the Option=>Move WP Zero Menu is clicked. """ title = self.tr('Workpiece zero offset') label = ((self.tr("Offset %s axis by mm:") % g.config.vars.Axis_letters['ax1_letter']), \ (self.tr("Offset %s axis by mm:") % g.config.vars.Axis_letters['ax2_letter'])) value = (self.cont_dx, self.cont_dy) MoveWpzDialog = myDialog(title, label, value, True) if MoveWpzDialog.result == None: return if MoveWpzDialog.result == 'Auto': minx = sys.float_info.max maxy = - sys.float_info.max for shape in self.shapes: if not(shape.isDisabled()): r = shape.boundingRect() if r.left() < minx: minx = r.left() if r.bottom() > maxy: maxy = r.bottom() self.cont_dx = self.EntitiesRoot.p0.x - minx self.cont_dy = self.EntitiesRoot.p0.y + maxy else: self.cont_dx = float(MoveWpzDialog.result[0]) self.cont_dy = float(MoveWpzDialog.result[1]) self.EntitiesRoot.p0.x = self.cont_dx self.EntitiesRoot.p0.y = self.cont_dy self.reloadFile()
def setTolerances(self): """ This function is called when the Option=>Tolerances Menu is clicked. """ title = self.tr('Contour tolerances') if g.config.metric == 0: label = (self.tr("Tolerance for common points [in]:"), \ self.tr("Tolerance for curve fitting [in]:")) else: label = (self.tr("Tolerance for common points [mm]:"), \ self.tr("Tolerance for curve fitting [mm]:")) value = (g.config.point_tolerance, g.config.fitting_tolerance) logger.debug(self.tr("set Tolerances")) SetTolDialog = myDialog(title, label, value) if SetTolDialog.result == None: return g.config.point_tolerance = float(SetTolDialog.result[0]) g.config.fitting_tolerance = float(SetTolDialog.result[1]) self.reloadFile()
def CallRotateAll(self): """ This function is called when the Option=>Rotate All Menu is clicked. """ title = self.tr('Rotate Contour') label = [self.tr("Rotate Contour by deg:")] value = [degrees(self.rotate)] RotEntDialog = myDialog(title, label, value) if RotEntDialog.result == None: return self.rotate = radians(float(RotEntDialog.result[0])) self.EntitiesRoot.rot = self.rotate self.reloadFile()
def CallScaleAll(self): """ This function is called when the Option=>Scale All Menu is clicked. """ title = self.tr('Scale Contour') label = [self.tr("Scale Contour by factor:")] value = [self.cont_scale] ScaEntDialog = myDialog(title, label, value) if ScaEntDialog.result == None: return self.cont_scale = float(ScaEntDialog.result[0]) self.EntitiesRoot.sca = self.cont_scale self.reloadFile()