diff --git a/klippy/extras/auto_wcs.py b/klippy/extras/auto_wcs.py index ad516846f1e3..f306ec2834f7 100644 --- a/klippy/extras/auto_wcs.py +++ b/klippy/extras/auto_wcs.py @@ -180,17 +180,22 @@ def cmd_CALC_WCS_TOOL(self, gcmd): cmd_GET_RADIUS_TOOLING_help = "command for get the tooling radius from measuring points." def cmd_GET_RADIUS_TOOLING(self, gcmd): - advance = gcmd.get_int('ADVANCE', 0) - if not advance: + rough = gcmd.get_int('ROUGH', 0) + if not rough: self.tooling_radius = self.get_radius(gcmd) self.tooling_radius_1 = self.get_radius_1(gcmd) self.tooling_radius_2 = self.get_radius_2(gcmd) else: - # if needed calculate advance radius + # if needed calculate rough radius + mode = gcmd.get('MODE') gcode_move = self.printer.lookup_object('gcode_move') - y2 = self.point_coords[0][1] + self.probe_backlash_y - self.tooling_radius = gcode_move.wcs_offsets[1][1] - y2 - gcmd.respond_info('advance radius_tooling= %s' % self.tooling_radius) + if mode == 'full': + y = self.point_coords[0][1] + self.probe_backlash_y + self.tooling_radius = gcode_move.wcs_offsets[3][1] - y + elif mode == 'spiral': + z = self.point_coords[0][2] + self.tooling_radius = z - gcode_move.wcs_offsets[4][2] + gcmd.respond_info('rough radius_tooling= %s' % self.tooling_radius) return self.tooling_radius cmd_SAVE_WCS_CALC_POINT_help = "Save point for WCS calculation" diff --git a/klippy/extras/skew_correction.py b/klippy/extras/skew_correction.py index 0918c64731f1..5e89d193bc7f 100644 --- a/klippy/extras/skew_correction.py +++ b/klippy/extras/skew_correction.py @@ -43,12 +43,13 @@ def __init__(self, config): self.xy_factor = 0. self.xz_factor = 0. self.yz_factor = 0. + self.apply_skew = False self.current_profile = None self.skew_profiles = {} # Fetch stored profiles from Config self._load_storage(config) - self.printer.register_event_handler("klippy:connect", - self._handle_connect) + self.printer.register_event_handler("klippy:ready", + self._handle_ready) self.printer.register_event_handler("gcode_move:change_wcs_lists", self._change_wcs_lists) # self.printer.register_event_handler("gcode_move:change_current_wcs", @@ -69,6 +70,9 @@ def __init__(self, config): gcode.register_command('CALC_SKEW_COMPENSATION', self.cmd_CALC_SKEW_COMPENSATION, desc=self.cmd_CALC_SKEW_COMPENSATION_help) + gcode.register_command('CALC_SKEW_COMPENSATION_WCS', + self.cmd_CALC_SKEW_COMPENSATION_WCS, + desc=self.cmd_CALC_SKEW_COMPENSATION_WCS_help) self.point_coords = [ [0., 0., 0.], [0., 0., 0.], @@ -83,9 +87,9 @@ def __init__(self, config): [0., 0., 0.] ] self.next_transform = None - self.start_z_point = 0. - def _handle_connect(self): + + def _handle_ready(self): kin = self.printer.lookup_object('toolhead').get_kinematics() self.axes_min = kin.axes_min self.axes_max = kin.axes_max @@ -135,6 +139,7 @@ def cmd_CALC_SKEW_COMPENSATION(self, gcmd): """ factors = ['XY', 'XZ', 'YZ'] factor_name = gcmd.get('FACTOR').upper() + msg = gcmd.get('MSG', '') if factor_name in factors: if factor_name == factors[0]: # xy_factor @@ -144,6 +149,7 @@ def cmd_CALC_SKEW_COMPENSATION(self, gcmd): b_point = get_point(self.point_coords[0], self.point_coords[1]) c_point = list(b_point) c_point[0] = c_point[0] + 50. + diff_points = b_point[0] - a_point[0] bc = length_side(b_point[0], b_point[1], c_point[0], c_point[1]) bd = length_side(b_point[0], b_point[1], d_point[0], d_point[1]) ac = length_side(a_point[0], a_point[1], c_point[0], c_point[1]) @@ -155,6 +161,7 @@ def cmd_CALC_SKEW_COMPENSATION(self, gcmd): b_point = get_point(self.point_coords[0], self.point_coords[1]) c_point = list(b_point) c_point[0] = c_point[0] + 50 + diff_points = b_point[0] - a_point[0] bc = length_side(b_point[0], b_point[2], c_point[0], c_point[2]) bd = length_side(b_point[0], b_point[2], d_point[0], d_point[2]) ac = length_side(a_point[0], a_point[2], c_point[0], c_point[2]) @@ -166,20 +173,70 @@ def cmd_CALC_SKEW_COMPENSATION(self, gcmd): b_point = get_point(self.point_coords[1], self.point_coords[2]) c_point = list(b_point) c_point[1] = c_point[1] - 50 + diff_points = b_point[1] - a_point[1] bc = length_side(b_point[1], b_point[2], c_point[1], c_point[2]) bd = length_side(b_point[1], b_point[2], d_point[1], d_point[2]) ac = length_side(a_point[1], a_point[2], c_point[1], c_point[2]) factor_value = float("%.4f" % calc_skew_factor(ac, bd, bc)) factor_name = factor_name.lower() + '_factor' setattr(self, factor_name, factor_value) - out = "Calculated skew compensation %s: %.6f radians, %.2f degrees\n" % ( - factor_name, factor_value, math.degrees(factor_value)) + out = "Calculated %s skew compensation %s: %.6f radians, %.2f degrees, difference beetwen points=%f" % ( + msg, factor_name, factor_value, math.degrees(factor_value), diff_points) gcmd.respond_info(out) else: raise gcmd.error( "Error! Factor name %s not in list factors['XY', 'XZ', 'YZ']" % (factor_name)) cmd_CALC_SKEW_COMPENSATION_help = "Calculate skew compensation." + cmd_CALC_SKEW_COMPENSATION_WCS_help = "Calculate skew compensation by wcs." + def cmd_CALC_SKEW_COMPENSATION_WCS(self, gcmd): + factors = ['XY', 'XZ', 'YZ'] + factor_name = gcmd.get('FACTOR').upper() + factor_name = factor_name + wcs_list = self.gcode_move.wcs_offsets + if factor_name in factors: + if factor_name == factors[0]: + # xy_factor + a_point = wcs_list[2] + d_point = list(a_point) + d_point[0] = d_point[0] + 50 + b_point = wcs_list[4] + c_point = list(b_point) + c_point[0] = c_point[0] + 50 + # diff_points = b_point[0] - a_point[0] + bc = length_side(b_point[0], b_point[1], c_point[0], c_point[1]) + bd = length_side(b_point[0], b_point[1], d_point[0], d_point[1]) + ac = length_side(a_point[0], a_point[1], c_point[0], c_point[1]) + elif factor_name == factors[1]: + # xz_factor + a_point = wcs_list[3] + d_point = list(a_point) + d_point[0] = d_point[0] + 50. + b_point = wcs_list[1] + c_point = list(b_point) + c_point[0] = c_point[0] + 50. + # diff_points = b_point[0] - a_point[0] + bc = length_side(b_point[0], b_point[2], c_point[0], c_point[2]) + bd = length_side(b_point[0], b_point[2], d_point[0], d_point[2]) + ac = length_side(a_point[0], a_point[2], c_point[0], c_point[2]) + else: + # yz_factor + a_point = wcs_list[1] + d_point = list(a_point) + d_point[1] = d_point[1] + 50 + b_point = wcs_list[3] + c_point = list(b_point) + c_point[1] = c_point[1] + 50 + bc = length_side(b_point[1], b_point[2], c_point[1], c_point[2]) + bd = length_side(b_point[1], b_point[2], d_point[1], d_point[2]) + ac = length_side(a_point[1], a_point[2], c_point[1], c_point[2]) + factor_value = float("%.4f" % calc_skew_factor(ac, bd, bc)) + factor_name = factor_name.lower() + '_factor' + setattr(self, factor_name, factor_value) + out = "Calculated skew compensation %s: %.6f radians, %.2f degrees" % ( + factor_name, factor_value, math.degrees(factor_value)) + gcmd.respond_info(out) + def _load_storage(self, config): stored_profs = config.get_prefix_sections(self.name) # Remove primary skew_correction section, as it is not a stored profile @@ -195,30 +252,33 @@ def _load_storage(self, config): def calc_skew(self, pos): newpos = list(pos) - # pos_z = pos[2] - self.wcs_list[self.current_wcs + 2][2] - # used middle point, an alternative to getting the actual z coordinate in wcs. - pos_z = pos[2] - self.start_z_point - # newpos[0] = pos[0] - pos[1] * self.xy_factor \ - # - pos[2] * (self.xz_factor - (self.xy_factor * self.yz_factor)) - # removed self.xy_factor from the formula for a cleaner and easier compensation application. - newpos[0] = pos[0] - pos_z * self.xz_factor - newpos[1] = pos[1] - pos_z * (self.yz_factor * -1) - return newpos + if self.gcode_move.current_wcs == 2: + newpos[0] = pos[0] + ((self.wcs_list[2][1] - pos[1]) * (self.xy_factor * -1 )) + return newpos + elif self.gcode_move.current_wcs == 1: + newpos[0] = pos[0] + ((self.wcs_list[1][2] - pos[2]) * (self.xz_factor * -1 )) + newpos[1] = pos[1] + ((self.wcs_list[1][2] - pos[2]) * (self.yz_factor)) + return newpos + else: + return pos def calc_unskew(self, pos): newpos = list(pos) - # pos_z = pos[2] - self.wcs_list[self.current_wcs + 2][2] - pos_z = pos[2] - self.start_z_point - # newpos[0] = pos[0] + pos[1] * self.xy_factor \ - # + pos[2] * self.xz_factor - newpos[0] = pos[0] + pos_z * self.xz_factor - newpos[1] = pos[1] + pos_z * (self.yz_factor * -1) - return newpos + if self.gcode_move.current_wcs == 2: + newpos[0] = pos[0] - ((self.wcs_list[2][1] - pos[1]) * (self.xy_factor * -1 )) + return newpos + elif self.gcode_move.current_wcs == 1: + newpos[0] = pos[0] - ((self.wcs_list[1][2] - pos[2]) * (self.xz_factor * -1 )) + newpos[1] = pos[1] - ((self.wcs_list[1][2] - pos[2]) * (self.yz_factor)) + return newpos + else: + return pos def get_position(self): - if not self.enabled: + if self.apply_skew and self.enabled: + return self.calc_unskew(self.next_transform.get_position()) + else: return self.next_transform.get_position() - return self.calc_unskew(self.next_transform.get_position()) def move(self, newpos, speed): old_pos = self.next_transform.get_position() @@ -226,8 +286,10 @@ def move(self, newpos, speed): (0, 1, 2, 3, 4, 5)] move_d = math.sqrt(sum([d * d for d in axes_d[:5]])) if not self.enabled or move_d < .000000001: + self.apply_skew = False self.next_transform.move(newpos, speed) return + self.apply_skew = True corrected_pos = self.calc_skew(newpos) self.next_transform.move(corrected_pos, speed) @@ -299,16 +361,11 @@ def cmd_SKEW_PROFILE(self, gcmd): def load_profile(self, prof_name): """ - load profile and set neaded start point Z. + load profile """ - self.current_profile = prof_name - if prof_name == 'module_3d': - self.start_z_point = self.wcs_list[0] - else: - # get middle point, an alternative to getting the actual wcs index. - self.start_z_point = (self.wcs_list[3][2] + self.wcs_list[4][2]) / 2. profile = self.skew_profiles.get(prof_name) if profile is not None: + self.current_profile = prof_name self._update_skew(profile['xy_skew'], profile['xz_skew'], profile['yz_skew']) def save_profile(self, prof_name): @@ -331,14 +388,17 @@ def change_profile(self, prof_name, gcmd): """ change profile factors but don't change config """ - xy_factor = gcmd.get_float('XY', 0.) - xz_factor = gcmd.get_float('XZ', 0.) - yz_factor = gcmd.get_float('YZ', 0.) + xy_factor = gcmd.get_float('XY', self.skew_profiles[prof_name]['xy_skew']) + xz_factor = gcmd.get_float('XZ', self.skew_profiles[prof_name]['xz_skew']) + yz_factor = gcmd.get_float('YZ', self.skew_profiles[prof_name]['yz_skew']) self.skew_profiles[prof_name] = { 'xy_skew': xy_factor, 'xz_skew': xz_factor, 'yz_skew': yz_factor } + gcmd.respond_info( + "Changed skew_profile=%s: xy_skew=%s; xz_skew=%s; yz_skew=%s." % ( + prof_name, xy_factor, xz_factor, yz_factor)) def remove_profile(self, prof_name): configfile = self.printer.lookup_object('configfile') @@ -358,7 +418,7 @@ def get_status(self, eventtime=None): 'skew_profiles': self.skew_profiles, 'wcs_list': self.wcs_list, 'current_skew_profile': self.current_profile, - 'start_z_point': self.start_z_point + 'self.point_coords': self.point_coords } def load_config(config): diff --git a/stereotech_config/print_macros.cfg b/stereotech_config/print_macros.cfg index c43118504898..9f6ef5ab12ff 100644 --- a/stereotech_config/print_macros.cfg +++ b/stereotech_config/print_macros.cfg @@ -16,7 +16,7 @@ gcode: {% else %} {% set x = params.X|default(200) %} {% set y = params.Y|default(10) %} - {% endif %} + {% endif %} {% set z = params.Z|default(50)|float %} {% set e = params.E|default(3) %} {% set turn_off_extruders = params.TURN_OFF_EXTRUDERS|default(1)|int %} @@ -53,8 +53,8 @@ gcode: {% else %} ;FIVE AXIS COMPENSATION OFF ;B_AXIS_COMPENSATION_VARS ENABLE=0 - ;SET_SKEW ENABLE=0 - RADIAL_SPEED_COMPENSATION ENABLE=0 + SET_SKEW ENABLE=0 + RADIAL_SPEED_COMPENSATION ENABLE=0 {% endif %} {% endif %} G54 @@ -154,7 +154,7 @@ gcode: {% else %} ;FIVE AXIS COMPENSATION OFF ;B_AXIS_COMPENSATION_VARS ENABLE=0 - ;SET_SKEW ENABLE=0 + SET_SKEW ENABLE=0 RADIAL_SPEED_COMPENSATION ENABLE=0 {% endif %} {% endif %} @@ -257,7 +257,7 @@ gcode: ;SET_SKEW ENABLE=0 {% else %} ;FIVE AXIS COMPENSATION OFF - ;SET_SKEW ENABLE=0 + SET_SKEW ENABLE=0 ;B_AXIS_COMPENSATION_VARS ENABLE=0 RADIAL_SPEED_COMPENSATION ENABLE=0 {% endif %} diff --git a/stereotech_config/probe.cfg b/stereotech_config/probe.cfg index cdf0592508ea..ecdf091d1ef2 100644 --- a/stereotech_config/probe.cfg +++ b/stereotech_config/probe.cfg @@ -139,19 +139,19 @@ gcode: SET_A_OFFSET_POINT POINT=1 CALC_A_AXIS_OFFSET - ; PROBE_TEMPLATE_POINT POINT=CZ - ; SET_B_COMPENSATION_POINT POINT=0 - ; PROBE_TEMPLATE_POINT POINT=CZ1 - ; SET_B_COMPENSATION_POINT POINT=1 - ; PROBE_TEMPLATE_POINT POINT=AZ - ; SET_B_COMPENSATION_POINT POINT=2 - ; PROBE_TEMPLATE_POINT POINT=BZ - ; SET_B_COMPENSATION_POINT POINT=3 - ; PROBE_TEMPLATE_POINT POINT=AX - ; SET_B_COMPENSATION_POINT POINT=4 - ; PROBE_TEMPLATE_POINT POINT=BX - ; SET_B_COMPENSATION_POINT POINT=5 - ; CALC_B_AXIS_COMPENSATION ENABLE=0 + ;PROBE_TEMPLATE_POINT POINT=CZ + ;SET_B_COMPENSATION_POINT POINT=0 + ;PROBE_TEMPLATE_POINT POINT=CZ1 + ;SET_B_COMPENSATION_POINT POINT=1 + ;PROBE_TEMPLATE_POINT POINT=AZ + ;SET_B_COMPENSATION_POINT POINT=2 + ;PROBE_TEMPLATE_POINT POINT=BZ + ;SET_B_COMPENSATION_POINT POINT=3 + ;PROBE_TEMPLATE_POINT POINT=AX + ;SET_B_COMPENSATION_POINT POINT=4 + ;PROBE_TEMPLATE_POINT POINT=BX + ;SET_B_COMPENSATION_POINT POINT=5 + ;CALC_B_AXIS_COMPENSATION ENABLE=0 ; skew corection ; xy skew @@ -164,7 +164,7 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=XY2 ;SET_SKEW_COMPENSATION_POINT POINT=3 ;CALC_SKEW_COMPENSATION FACTOR=XY - ; xz skew + ;; xz skew ;PROBE_TEMPLATE_POINT POINT=BX ;SET_SKEW_COMPENSATION_POINT POINT=0 ;PROBE_TEMPLATE_POINT POINT=AX @@ -174,7 +174,7 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=XZ4 ;SET_SKEW_COMPENSATION_POINT POINT=3 ;CALC_SKEW_COMPENSATION FACTOR=XZ - ; yz skew + ;; yz skew ;PROBE_TEMPLATE_POINT POINT=YZ1 ;SET_SKEW_COMPENSATION_POINT POINT=0 ;PROBE_TEMPLATE_POINT POINT=YZ2 @@ -182,9 +182,8 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=YZ3 ;SET_SKEW_COMPENSATION_POINT POINT=2 ;CALC_SKEW_COMPENSATION FACTOR=YZ - ; save profile 5d - ;SKEW_PROFILE SAVE=module_5d - + ;; save profile 5d + ; SKEW_PROFILE SAVE=module_5d {% if probe_sensor_version > 0 %} AUTO_WCS_OFFSET_NEW_SENSOR @@ -393,7 +392,6 @@ gcode: {% endif %} {% endif %} - [gcode_macro ADJUST_PROBE_OFFSET_XY] gcode: {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} @@ -440,10 +438,12 @@ gcode: {% endif %} [gcode_macro AUTO_BASEMENT_WCS] +description: macro do main moves for get wcs for SPIRAL and FULL modes. gcode: {% set wcs = params.WCS|default(0)|int %} {% set probe_sensor_version = printer.save_variables.variables.probe_sensor_version|default(0)|int %} {% if wcs == 0 %} + ; meachuring for mode the FULL {% if probe_sensor_version %} ; move for measuring wcs_1_z PROBE_TOOL_POINT POINT=Z_1 WCS=3 @@ -452,8 +452,8 @@ gcode: ; get tool length GET_TOOL_LENGTH ; moving for measure radius the tool - TOOL_RADIUS - ; checking axis A + TOOL_RADIUS MODE=full + ; checking and apply offset for axis A CHECK_AXIS_A G0 Z150 F3600 ; move for measuring the wcs_1_x @@ -484,6 +484,10 @@ gcode: CALC_WCS_TOOL WCS=2 AXIS=0 ; set wcs_2_x ADJUST_BASEMENT_WCS WCS=6 + ; eccentricity correction + ;APPLY_ECCENTRICITY + ; check skew axis X + CHECK_SKEW_TOOL ; move for measuring the wcs_2_z PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 {% else %} @@ -493,8 +497,75 @@ gcode: G0 Z150 F3600 {% endif %} {% else %} - PROBE + ; meachuring for mode the SPIRAL + {% if probe_sensor_version %} + ; move for measuring wcs_2_y + PROBE + G0 Z150 F3600 + ; set wcs_2_y and wcs_1_z(row) + ADJUST_BASEMENT_WCS WCS=7 + ; calculate rough radius + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE=spiral + ; get tool length + GET_TOOL_LENGTH + ; move to calculate wcs by tool + MOVE_MEASHURING_SPIRAL + {% else %} + PROBE + G0 Z150 F3600 + {% endif %} + {% endif %} + +[gcode_macro CHECK_SKEW_TOOL] +description: This macro check skew axis X beetwen two X point. +gcode: + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + CALC_SKEW_COMPENSATION_WCS FACTOR=XY + CALC_SKEW_COMPENSATION_WCS FACTOR=XZ + CALC_SKEW_COMPENSATION_WCS FACTOR=YZ + SKEW_PROFILE SAVE=module_5d + {% if tool_length > 50.0 %} G0 Z150 F3600 + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=2 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=3 + PROBE_TOOL_POINT POINT=X_2_3 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=0 + PROBE_TOOL_POINT POINT=X_2_2 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=1 + CALC_SKEW_COMPENSATION FACTOR=XY MSG=skew_calculate_by_tool + SKEW_PROFILE SAVE=module_5d + {% else %} + {action_respond_info('Warning, tool length less 50mm for calculate skew for the axis X, where use only wcs_2 points!')} + {% endif %} + +[gcode_macro MOVE_MEASHURING_SPIRAL] +description: This macro do move and calculate wcs for SPIRAL mode. +gcode: + {% set wcs = params.WCS %} + {% set radius = printer.auto_wcs.tooling_radius %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + {% if radius < 5.0 and tool_length > 35.0 %} + ; checking and apply offset for axis A + CHECK_AXIS_A + ; moving for measure radius the tool + TOOL_RADIUS MODE=spiral + ; move for measuring the wcs_2_x + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=0 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_AUTO_WCS_POINT POINT=1 + CALC_WCS_TOOL WCS=2 AXIS=0 + ; set wcs_2_x + ADJUST_BASEMENT_WCS WCS=6 + ; check skew axes + CHECK_SKEW_TOOL + ; move for measuring the wcs_2_z + PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 + {% else %} + {action_respond_info("Radius greater than 5 mm or tool length less 35mm, movement to calculate wcs by tool is not available. Wcs will be calculated from the template.")} {% endif %} [gcode_macro AUTO_BASEMENT_WCS_MOVE] @@ -524,28 +595,38 @@ gcode: [gcode_macro GET_TOOL_LENGTH] description: This macro calculate length tool. -variable_length_is_enough: 0 +variable_tool_length: 0.0 gcode: {% set old_y = printer.gcode_move.wcs_offsets[4][1] %} - {% set template_thickness = printer.save_variables.variables.template_thickness|default(10.0)|float %} + {% set template_thickness = 10.0 %} {% set wcs_2_y = printer.gcode_move.wcs_offsets[2][1] %} {% set tool_length = old_y + template_thickness - wcs_2_y %} - {% if tool_length > 35.0 %} - SET_GCODE_VARIABLE MACRO=GET_TOOL_LENGTH VARIABLE=length_is_enough VALUE=1 - {action_respond_info('tool length=%s' % tool_length)} - {% endif %} + SET_GCODE_VARIABLE MACRO=GET_TOOL_LENGTH VARIABLE=tool_length VALUE={tool_length} + {action_respond_info('tool length=%s' % tool_length)} [gcode_macro TOOL_RADIUS] description: moved to measure tool radius and calculate it. gcode: - PROBE_TOOL_POINT POINT=Y_1 WCS=1 - SET_AUTO_WCS_POINT POINT=0 - GET_RADIUS_TOOLING ADVANCE=1 - PROBE_TOOL_POINT POINT=X_1_0 WCS=1 - SET_AUTO_WCS_POINT POINT=1 - PROBE_TOOL_POINT POINT=X_1_1 WCS=1 - SET_AUTO_WCS_POINT POINT=2 - GET_RADIUS_TOOLING + {% set mode = params.MODE %} + {% if mode == 'full' %} + PROBE_TOOL_POINT POINT=Y_1 WCS=1 + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE={mode} + PROBE_TOOL_POINT POINT=X_1_0 WCS=1 + SET_AUTO_WCS_POINT POINT=1 + PROBE_TOOL_POINT POINT=X_1_1 WCS=1 + SET_AUTO_WCS_POINT POINT=2 + GET_RADIUS_TOOLING + {% elif mode == 'spiral' %} + PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE={mode} + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=1 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_AUTO_WCS_POINT POINT=2 + GET_RADIUS_TOOLING + {% endif %} [gcode_macro ADJUST_BASEMENT_WCS] gcode: @@ -561,13 +642,13 @@ gcode: {% set old_y = wcs_1[1] %} {% set probe_sensor_version = printer.save_variables.variables.probe_sensor_version|default(0)|int %} {% set probe_backlash_y = printer.auto_wcs.probe_backlash_y|default(0.0)|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].length_is_enough|int %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + {% set radius = printer.auto_wcs.tooling_radius %} {% if wcs == 0 %} ; Mode SPIRAL-FULL {% if probe_sensor_version %} ; apply measuring for the set wcs_2_z radius. - {% if tool_length > 0 %} - {% set radius = printer.auto_wcs.tooling_radius %} + {% if tool_length > 35.0 %} G10 L2 P3 Z{z - radius} {% else %} {action_raise_error('%s' % 'Error, tool length not enough for calculate wcs_2_y!')} @@ -579,9 +660,13 @@ gcode: {% endif %} {% elif wcs == 1 %} ; Mode SPIRAL - ; apply measuring for the set wcs_2_y and wcs_1_z(raw). - G10 L2 P3 Y{y} - G10 L2 P2 Z{old_z - (y - old_y)} + {% if probe_sensor_version and radius < 5.0 and tool_length > 35.0 %} + G10 L2 P3 Z{z - radius} + {% else %} + ; apply measuring for the set wcs_2_y and wcs_1_z(raw). + G10 L2 P3 Y{y} + G10 L2 P2 Z{old_z - (y - old_y)} + {% endif %} {% elif wcs == 2 %} ; set wcs_1_z and wcs_2_y(raw). G10 L2 P2 Z{z} @@ -601,8 +686,39 @@ gcode: {% set x = printer.auto_wcs.wcs[1][0]|float %} ; set the wcs_2_x G10 L2 P3 X{x} + {% elif wcs == 7 %} + ; apply measuring for the set wcs_2_y and wcs_1_z(raw). + G10 L2 P3 Y{y} + G10 L2 P2 Z{old_z - (y - old_y)} {% endif %} +[gcode_macro SET_ECCENTRICITY] +Description: This macro save eccentricity for wcs_1. +gcode: + {% set x1 = params.X1|default(0.0)|float %} + {% set x2 = params.X2|default(0.0)|float %} + {% set y1 = params.Y1|default(0.0)|float %} + {% set y2 = params.Y2|default(0.0)|float %} + {% set offset_x = (x2 - x1) / 2 %} + {% set offset_y = (y1 - y2) / 2 %} + SAVE_VARIABLE VARIABLE=eccentricity_offset_x VALUE={offset_x} + SAVE_VARIABLE VARIABLE=eccentricity_offset_y VALUE={offset_y} + {action_respond_info('offset_x=%.3f; offset_y=%.3f for correcting ECCENTRICITY saved! Please use calibrate mode "auto calibrate the start point" for apply this params.' % (offset_x, offset_y))} + +[gcode_macro APPLY_ECCENTRICITY] +Description: This macro apply eccentricity correction for wcs_1. +gcode: + {% set svv = printer.save_variables.variables %} + {% set offset_x = svv.eccentricity_offset_x|default(0.0)|float %} + {% set offset_y = svv.eccentricity_offset_y|default(0.0)|float %} + {% set old_x = printer.gcode_move.wcs_offsets[1][0] %} + {% set old_y = printer.gcode_move.wcs_offsets[1][1] %} + {% set new_x = old_x + offset_x %} + {% set new_y = old_y + offset_y %} + G10 L2 P2 R1 X{offset_x} + G10 L2 P2 R1 Y{offset_y} + {action_respond_info('Applied offset for corrective eccentricity.\noffset_x=%.3f; offset_y=%.3f. Old wcs_1_x=%.3f, wcs_1_y=%.3f. New wcs_1_x=%.3f, wcs_1_y=%.3f' % (offset_x, offset_y, old_x, old_y, new_x, new_y))} + [gcode_macro PROBE_TOOL_POINT] Description: This macro does movement and measurement relative to the tool. gcode: @@ -615,7 +731,7 @@ gcode: {% set y = wcs_offsets[1] - offsets[1] %} {% set z = wcs_offsets[2] + offsets[2] %} {% set radius = printer.auto_wcs.tooling_radius|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].length_is_enough|int %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} {% set a = '0' if wcs == 1 else '90' %} {% set checking = 'true' %} {% if point == 'X_1_0' %} @@ -655,35 +771,50 @@ gcode: {% set axis_name = 'X' %} {% set positiv_dir = 1 %} {% set x = x - 15 %} - {% set y = y + 3 %} + {% set y = y + 1 %} {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} - {% set msg = 'Error, tool length or radius not enough!' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} + {% set msg = 'Error, tool length not enough!' %} {% elif point == 'X_2_1' %} {% set axis_name = 'X' %} {% set x = x + 15 %} - {% set y = y + 3 %} + {% set y = y + 1 %} + {% set z = z + (radius - 5) %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} + {% set msg = 'Error, tool length not enough!' %} + {% elif point == 'X_2_2' %} + {% set axis_name = 'X' %} + {% set positiv_dir = 1 %} + {% set x = x - 15 %} + {% set y = y + 16 %} + {% set z = z + (radius - 5) %} + {% set checking = 'true' if tool_length > 50.0 else 'false' %} + {% set msg = 'Error, tool length lees 50mm!' %} + {% elif point == 'X_2_3' %} + {% set axis_name = 'X' %} + {% set x = x + 15 %} + {% set y = y + 16 %} {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} - {% set msg = 'Error, tool length or radius not enough!' %} + {% set checking = 'true' if tool_length > 50.0 else 'false' %} + {% set msg = 'Error, tool length lees 50mm!' %} {% elif point == 'Y_2' %} {% set axis_name = 'Y' %} {% set positiv_dir = 1 %} {% set y = y - 20 %} {% set z = z + (radius - 4) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough for calculate wcs_2_y!' %} {% elif point == 'Z_2_0' %} {% set axis_name = 'Z' %} - {% set y = y + 3 %} + {% set y = y + 1 %} {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough!' %} {% elif point == 'Z_2_1' %} {% set axis_name = 'Z' %} {% set y = y + 25 %} {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough!' %} {% endif %} {% if checking == 'true' %} diff --git a/stereotech_config/probe_2.cfg b/stereotech_config/probe_2.cfg index bed7910f8daf..b6209ee36907 100644 --- a/stereotech_config/probe_2.cfg +++ b/stereotech_config/probe_2.cfg @@ -118,22 +118,22 @@ gcode: SET_A_OFFSET_POINT POINT=1 CALC_A_AXIS_OFFSET - ; PROBE_TEMPLATE_POINT POINT=CZ - ; SET_B_COMPENSATION_POINT POINT=0 - ; PROBE_TEMPLATE_POINT POINT=CZ1 - ; SET_B_COMPENSATION_POINT POINT=1 - ; PROBE_TEMPLATE_POINT POINT=AZ - ; SET_B_COMPENSATION_POINT POINT=2 - ; PROBE_TEMPLATE_POINT POINT=BZ - ; SET_B_COMPENSATION_POINT POINT=3 - ; PROBE_TEMPLATE_POINT POINT=AX - ; SET_B_COMPENSATION_POINT POINT=4 - ; PROBE_TEMPLATE_POINT POINT=BX - ; SET_B_COMPENSATION_POINT POINT=5 - ; CALC_B_AXIS_COMPENSATION ENABLE=0 - - ; skew corection - ; xy skew + ;PROBE_TEMPLATE_POINT POINT=CZ + ;SET_B_COMPENSATION_POINT POINT=0 + ;PROBE_TEMPLATE_POINT POINT=CZ1 + ;SET_B_COMPENSATION_POINT POINT=1 + ;PROBE_TEMPLATE_POINT POINT=AZ + ;SET_B_COMPENSATION_POINT POINT=2 + ;PROBE_TEMPLATE_POINT POINT=BZ + ;SET_B_COMPENSATION_POINT POINT=3 + ;PROBE_TEMPLATE_POINT POINT=AX + ;SET_B_COMPENSATION_POINT POINT=4 + ;PROBE_TEMPLATE_POINT POINT=BX + ;SET_B_COMPENSATION_POINT POINT=5 + ;CALC_B_AXIS_COMPENSATION ENABLE=0 + + ;; skew corection + ;; xy skew ;PROBE_TEMPLATE_POINT POINT=AX ;SET_SKEW_COMPENSATION_POINT POINT=0 ;PROBE_TEMPLATE_POINT POINT=BX @@ -143,7 +143,7 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=XY2 ;SET_SKEW_COMPENSATION_POINT POINT=3 ;CALC_SKEW_COMPENSATION FACTOR=XY - ; xz skew + ;; xz skew ;PROBE_TEMPLATE_POINT POINT=BX ;SET_SKEW_COMPENSATION_POINT POINT=0 ;PROBE_TEMPLATE_POINT POINT=AX @@ -153,7 +153,7 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=XZ4 ;SET_SKEW_COMPENSATION_POINT POINT=3 ;CALC_SKEW_COMPENSATION FACTOR=XZ - ; yz skew + ;; yz skew ;PROBE_TEMPLATE_POINT POINT=YZ1 ;SET_SKEW_COMPENSATION_POINT POINT=0 ;PROBE_TEMPLATE_POINT POINT=YZ2 @@ -161,7 +161,7 @@ gcode: ;PROBE_TEMPLATE_POINT POINT=YZ3 ;SET_SKEW_COMPENSATION_POINT POINT=2 ;CALC_SKEW_COMPENSATION FACTOR=YZ - ; save profile 5d + ;; save profile 5d ;SKEW_PROFILE SAVE=module_5d @@ -328,7 +328,6 @@ gcode: {% endif %} {% endif %} - [gcode_macro ADJUST_PROBE_OFFSET_XY] gcode: {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} @@ -375,9 +374,11 @@ gcode: {% endif %} [gcode_macro AUTO_BASEMENT_WCS] +description: macro do main moves for get wcs for SPIRAL and FULL modes. gcode: {% set wcs = params.WCS|default(0)|int %} {% if wcs == 0 %} + ; meachuring for mode the FULL ; move for measuring wcs_1_z PROBE_TOOL_POINT POINT=Z_1 WCS=3 ; set wcs_1_z, wcs_2_y(raw) @@ -385,7 +386,7 @@ gcode: ; get tool length GET_TOOL_LENGTH ; moving for measure radius the tool - TOOL_RADIUS + TOOL_RADIUS MODE=full ; checking axis A CHECK_AXIS_A G0 Z150 F3600 @@ -417,13 +418,80 @@ gcode: CALC_WCS_TOOL WCS=2 AXIS=0 ; set wcs_2_x ADJUST_BASEMENT_WCS WCS=6 + ; eccentricity correction + ;APPLY_ECCENTRICITY + ; check skew axis X + CHECK_SKEW_TOOL ; move for measuring the wcs_2_z PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 {% else %} + ; meachuring for mode the SPIRAL + ; move for measuring wcs_2_y PROBE G0 Z150 F3600 + ; set wcs_2_y and wcs_1_z(row) + ADJUST_BASEMENT_WCS WCS=7 + ; calculate rough radius + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE=spiral + ; get tool length + GET_TOOL_LENGTH + ; move to calculate wcs by tool + MOVE_MEASHURING_SPIRAL {% endif %} +[gcode_macro CHECK_SKEW_TOOL] +description: This macro check skew axis X beetwen two X point. +gcode: + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + CALC_SKEW_COMPENSATION_WCS FACTOR=XY + CALC_SKEW_COMPENSATION_WCS FACTOR=XZ + CALC_SKEW_COMPENSATION_WCS FACTOR=YZ + SKEW_PROFILE SAVE=module_5d + {% if tool_length > 50.0 %} + G0 Z150 F3600 + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=2 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=3 + PROBE_TOOL_POINT POINT=X_2_3 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=0 + PROBE_TOOL_POINT POINT=X_2_2 WCS=2 + SET_SKEW_COMPENSATION_POINT POINT=1 + CALC_SKEW_COMPENSATION FACTOR=XY MSG=skew_calculate_by_tool + SKEW_PROFILE SAVE=module_5d + {% else %} + {action_respond_info('Warning, tool length less 50mm for calculate skew for the axis X, where use only wcs_2 points!')} + {% endif %} + +[gcode_macro MOVE_MEASHURING_SPIRAL] +description: This macro do move and calculate wcs for SPIRAL mode. +gcode: + {% set wcs = params.WCS %} + {% set radius = printer.auto_wcs.tooling_radius %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + {% if radius < 5.0 and tool_length > 35.0 %} + ; checking and apply offset for axis A + CHECK_AXIS_A + ; moving for measure radius the tool + TOOL_RADIUS MODE=spiral + ; move for measuring the wcs_2_x + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=0 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_AUTO_WCS_POINT POINT=1 + CALC_WCS_TOOL WCS=2 AXIS=0 + ; set wcs_2_x + ADJUST_BASEMENT_WCS WCS=6 + ; check skew axes + CHECK_SKEW_TOOL + ; move for measuring the wcs_2_z + PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 + {% else %} + {action_respond_info("Radius greater than 5 mm or tool length less 35mm, movement to calculate wcs by tool is not available. Wcs will be calculated from the template.")} + {% endif %} + + [gcode_macro AUTO_BASEMENT_WCS_MOVE] description: This macro does a move for measuring wcs_2_y and wcs_1_z-raw mode SPIRAL. gcode: @@ -451,28 +519,38 @@ gcode: [gcode_macro GET_TOOL_LENGTH] description: This macro calculate length tool. -variable_length_is_enough: 0 +variable_tool_length: 0.0 gcode: {% set old_y = printer.gcode_move.wcs_offsets[4][1] %} - {% set template_thickness = printer.save_variables.variables.template_thickness|default(10.0)|float %} + {% set template_thickness = 10.0 %} {% set wcs_2_y = printer.gcode_move.wcs_offsets[2][1] %} {% set tool_length = old_y + template_thickness - wcs_2_y %} - {% if tool_length > 35.0 %} - SET_GCODE_VARIABLE MACRO=GET_TOOL_LENGTH VARIABLE=length_is_enough VALUE=1 - {action_respond_info('tool length=%s' % tool_length)} - {% endif %} + SET_GCODE_VARIABLE MACRO=GET_TOOL_LENGTH VARIABLE=tool_length VALUE={tool_length} + {action_respond_info('tool length=%s' % tool_length)} [gcode_macro TOOL_RADIUS] description: moved to measure tool radius and calculate it. gcode: - PROBE_TOOL_POINT POINT=Y_1 WCS=1 - SET_AUTO_WCS_POINT POINT=0 - GET_RADIUS_TOOLING ADVANCE=1 - PROBE_TOOL_POINT POINT=X_1_0 WCS=1 - SET_AUTO_WCS_POINT POINT=1 - PROBE_TOOL_POINT POINT=X_1_1 WCS=1 - SET_AUTO_WCS_POINT POINT=2 - GET_RADIUS_TOOLING + {% set mode = params.MODE %} + {% if mode == 'full' %} + PROBE_TOOL_POINT POINT=Y_1 WCS=1 + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE={mode} + PROBE_TOOL_POINT POINT=X_1_0 WCS=1 + SET_AUTO_WCS_POINT POINT=1 + PROBE_TOOL_POINT POINT=X_1_1 WCS=1 + SET_AUTO_WCS_POINT POINT=2 + GET_RADIUS_TOOLING + {% elif mode == 'spiral' %} + PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=0 + GET_RADIUS_TOOLING ROUGH=1 MODE={mode} + PROBE_TOOL_POINT POINT=X_2_0 WCS=2 + SET_AUTO_WCS_POINT POINT=1 + PROBE_TOOL_POINT POINT=X_2_1 WCS=2 + SET_AUTO_WCS_POINT POINT=2 + GET_RADIUS_TOOLING + {% endif %} [gcode_macro ADJUST_BASEMENT_WCS] gcode: @@ -487,21 +565,25 @@ gcode: {% set old_z = wcs_0[2] %} {% set old_y = wcs_1[1] %} {% set probe_backlash_y = printer.auto_wcs.probe_backlash_y|default(0.0)|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].length_is_enough|int %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} + {% set radius = printer.auto_wcs.tooling_radius %} {% if wcs == 0 %} ; Mode SPIRAL-FULL ; apply measuring for the set wcs_2_z radius. - {% if tool_length > 0 %} - {% set radius = printer.auto_wcs.tooling_radius %} + {% if tool_length > 35.0 %} G10 L2 P3 Z{z - radius} {% else %} {action_raise_error('Error, tool length not enough for calculate wcs_2_y!')} {% endif %} {% elif wcs == 1 %} ; Mode SPIRAL - ; apply measuring for the set wcs_2_y and wcs_1_z(raw). - G10 L2 P3 Y{y} - G10 L2 P2 Z{old_z - (y - old_y)} + {% if radius < 5.0 and tool_length > 35.0 %} + G10 L2 P3 Z{z - radius} + {% else %} + ; apply measuring for the set wcs_2_y and wcs_1_z(raw). + G10 L2 P3 Y{y} + G10 L2 P2 Z{old_z - (y - old_y)} + {% endif %} {% elif wcs == 2 %} ; set wcs_1_z and wcs_2_y(raw). G10 L2 P2 Z{z} @@ -521,8 +603,39 @@ gcode: {% set x = printer.auto_wcs.wcs[1][0]|float %} ; set the wcs_2_x G10 L2 P3 X{x} + {% elif wcs == 7 %} + ; apply measuring for the set wcs_2_y and wcs_1_z(raw). + G10 L2 P3 Y{y} + G10 L2 P2 Z{old_z - (y - old_y)} {% endif %} +[gcode_macro SET_ECCENTRICITY] +Description: This macro save eccentricity for wcs_1. +gcode: + {% set x1 = params.X1|default(0.0)|float %} + {% set x2 = params.X2|default(0.0)|float %} + {% set y1 = params.Y1|default(0.0)|float %} + {% set y2 = params.Y2|default(0.0)|float %} + {% set offset_x = (x2 - x1) / 2 %} + {% set offset_y = (y1 - y2) / 2 %} + SAVE_VARIABLE VARIABLE=eccentricity_offset_x VALUE={offset_x} + SAVE_VARIABLE VARIABLE=eccentricity_offset_y VALUE={offset_y} + {action_respond_info('offset_x=%.3f; offset_y=%.3f for correcting ECCENTRICITY saved! Please use calibrate mode "auto calibrate the start point" for apply this params.' % (offset_x, offset_y))} + +[gcode_macro APPLY_ECCENTRICITY] +Description: This macro apply eccentricity correction for wcs_1. +gcode: + {% set svv = printer.save_variables.variables %} + {% set offset_x = svv.eccentricity_offset_x|default(0.0)|float %} + {% set offset_y = svv.eccentricity_offset_y|default(0.0)|float %} + {% set old_x = printer.gcode_move.wcs_offsets[1][0] %} + {% set old_y = printer.gcode_move.wcs_offsets[1][1] %} + {% set new_x = old_x + offset_x %} + {% set new_y = old_y + offset_y %} + G10 L2 P2 R1 X{offset_x} + G10 L2 P2 R1 Y{offset_y} + {action_respond_info('Applied offset for corrective eccentricity.\noffset_x=%.3f; offset_y=%.3f. Old wcs_1_x=%.3f, wcs_1_y=%.3f. New wcs_1_x=%.3f, wcs_1_y=%.3f' % (offset_x, offset_y, old_x, old_y, new_x, new_y))} + [gcode_macro PROBE_TOOL_POINT] Description: This macro does movement and measurement relative to the tool. gcode: @@ -535,7 +648,7 @@ gcode: {% set y = wcs_offsets[1] - offsets[1] %} {% set z = wcs_offsets[2] + offsets[2] %} {% set radius = printer.auto_wcs.tooling_radius|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].length_is_enough|int %} + {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} {% set a = '0' if wcs == 1 else '90' %} {% set checking = 'true' %} {% if point == 'X_1_0' %} @@ -575,35 +688,50 @@ gcode: {% set axis_name = 'X' %} {% set positiv_dir = 1 %} {% set x = x - 15 %} - {% set y = y + 3 %} + {% set y = y + 1 %} {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} - {% set msg = 'Error, tool length or radius not enough!' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} + {% set msg = 'Error, tool length not enough!' %} {% elif point == 'X_2_1' %} {% set axis_name = 'X' %} {% set x = x + 15 %} - {% set y = y + 3 %} + {% set y = y + 1 %} + {% set z = z + (radius - 5) %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} + {% set msg = 'Error, tool length not enough!' %} + {% elif point == 'X_2_2' %} + {% set axis_name = 'X' %} + {% set positiv_dir = 1 %} + {% set x = x - 15 %} + {% set y = y + 16 %} + {% set z = z + (radius - 5) %} + {% set checking = 'true' if tool_length > 50.0 else 'false' %} + {% set msg = 'Error, tool length lees 50mm!' %} + {% elif point == 'X_2_3' %} + {% set axis_name = 'X' %} + {% set x = x + 15 %} + {% set y = y + 16 %} {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} - {% set msg = 'Error, tool length or radius not enough!' %} + {% set checking = 'true' if tool_length > 50.0 else 'false' %} + {% set msg = 'Error, tool length lees 50mm!' %} {% elif point == 'Y_2' %} {% set axis_name = 'Y' %} {% set positiv_dir = 1 %} {% set y = y - 20 %} {% set z = z + (radius - 4) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough for calculate wcs_2_y!' %} {% elif point == 'Z_2_0' %} {% set axis_name = 'Z' %} - {% set y = y + 3 %} + {% set y = y + 1 %} {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough!' %} {% elif point == 'Z_2_1' %} {% set axis_name = 'Z' %} {% set y = y + 25 %} {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 0 else 'false' %} + {% set checking = 'true' if tool_length > 35.0 else 'false' %} {% set msg = 'Error, tool length not enough!' %} {% endif %} {% if checking == 'true' %}