Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Vincent Coffey edited this pageJun 18, 2019 ·10 revisions

The Tool Change function is only available for CNCjs 1.9.11 or later versions

Getting Started

The manual tool change operation is initiated by a M6 command:

M6 ; Tool Change

It will pause program execution and prompt user to change the tool. You can run a tool change macro to perform a manual tool change, and click ▶ (Resume) to continue.

image

Read the following paragraphs to learn how to create a tool change macro to facilitate the process.

Initial Setup

1. Determine the tool change and the tool probe location

The tool change macro requires you to specify the tool change and the tool probe location in absolute coordinates. You can jog to the desire location and specify the position in your tool change macro with macro variables. It's recommended that you use upper case letters in variable names or prefix variable names with "_" or "$" to avoid conflict with reserved variables. The expression must be prefixed with "%" at the beginning of each line. For example:

%CLEARANCE_HEIGHT = 100%TOOL_CHANGE_X = -300%TOOL_CHANGE_Y = -300%TOOL_CHANGE_Z = CLEARANCE_HEIGHT%TOOL_PROBE_X = 0%TOOL_PROBE_Y = 0%TOOL_PROBE_Z = 20

2. Create a tool change macro

image

The tool change macro will perform the following operations:

  • Set user-defined variables

    %CLEARANCE_HEIGHT = 100%TOOL_CHANGE_X = -300%TOOL_CHANGE_Y = -300%TOOL_CHANGE_Z = CLEARANCE_HEIGHT%TOOL_PROBE_X = 0%TOOL_PROBE_Y = 0%TOOL_PROBE_Z = 20%PROBE_DISTANCE = 15%PROBE_FEEDRATE = 20%TOUCH_PLATE_HEIGHT = 10%RETRACTION_DISTANCE = 10
  • Keep a backup of current work position

    %X0 = posx, Y0 = posy, Z0 = posz
  • Save modal state

    ; Work Coordinate System: G54, G55, G56, G57, G58, G59%WCS = modal.wcs; Plane: G17, G18, G19%PLANE = modal.plane; Units: G20, G21%UNITS = modal.units; Distance Mode: G90, G91%DISTANCE = modal.distance; Feed Rate Mode: G93, G94%FEEDRATE = modal.feedrate; Spindle State: M3, M4, M5%SPINDLE = modal.spindle; Coolant State: M7, M8, M9%COOLANT = modal.coolant
  • Stop spindle

  • Raise to tool change Z (clearance height)

  • Go to tool change X,Y

  • Pause the program withM0 (pause w/ hold) for a manual tool change

  • ClickContinue to resume

    image

  • Go to tool probe X,Y

  • Lower to tool probe Z

  • Pause the program withM1 (pause w/o hold) before probing

  • ClickContinue to resume

    image

  • Perform a probe toward workpiece with a maximum probe distance

  • Set Z0 for the active work coordinate system

  • Raise to tool change Z

  • Go to tool change X,Y

  • Pause the program withM0 for cleanup (e.g. remove touch plate, wires, etc)

  • ClickContinue to resume

    image

  • Go to previous work position

    G0 X[X0] Y[Y0]G0 Z[Z0]
  • Restore modal state

    [WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]
  • Continue program execution

2.1. Tool Change Macro (WCS)

Below is a tool change macro that adjusts the current WCS, you can customize the macro for your needs:

; Wait until the planner queue is empty%wait; Set user-defined variables%CLEARANCE_HEIGHT = 100%TOOL_CHANGE_X = -300%TOOL_CHANGE_Y = -300%TOOL_CHANGE_Z = CLEARANCE_HEIGHT%TOOL_PROBE_X = 0%TOOL_PROBE_Y = 0%TOOL_PROBE_Z = 20%PROBE_DISTANCE = 15%PROBE_FEEDRATE = 20%TOUCH_PLATE_HEIGHT = 10%RETRACTION_DISTANCE = 10; Keep a backup of current work position%X0=posx, Y0=posy, Z0=posz; Save modal state; * Work Coordinate System: G54, G55, G56, G57, G58, G59; * Plane: G17, G18, G19; * Units: G20, G21; * Distance Mode: G90, G91; * Feed Rate Mode: G93, G94; * Spindle State: M3, M4, M5; * Coolant State: M7, M8, M9%WCS = modal.wcs%PLANE = modal.plane%UNITS = modal.units%DISTANCE = modal.distance%FEEDRATE = modal.feedrate%SPINDLE = modal.spindle%COOLANT = modal.coolant; Stop spindleM5; Absolute positioningG90; Raise to tool change ZG0 Z[TOOL_CHANGE_Z]; Go to tool change X,YG0 X[TOOL_CHANGE_X] Y[TOOL_CHANGE_Y]; Wait until the planner queue is empty%wait; Pause the program for a manual tool changeM0; Go to tool probe X,YG0 X[TOOL_PROBE_X] Y[TOOL_PROBE_Y]; Lower to tool probe ZG0 Z[TOOL_PROBE_Z]; Wait until the planner queue is empty%wait; Pause the program before probingM1; Probe toward workpiece with a maximum probe distanceG91 ; Relative positioningG38.2 Z-[PROBE_DISTANCE] F[PROBE_FEEDRATE]G90 ; Absolute positioning; Set Z0 for the active work coordinate systemG10 L20 P0 Z[TOUCH_PLATE_HEIGHT]; Retract from the touch plateG91 ; Relative positioningG0 Z[RETRACTION_DISTANCE]G90 ; Absolute positioning; Raise to tool change ZG53 Z[TOOL_CHANGE_Z]; Go to tool change X,YG53 X[TOOL_CHANGE_X] Y[TOOL_CHANGE_Y]; Wait until the planner queue is empty%wait; Pause the program for cleanup (e.g. remove touch plate, wires, etc)M0; Go to previous work positionG0 X[X0] Y[Y0]G0 Z[Z0]; Restore modal state[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

2.2. Tool Change Macro (TLO)

Use the following codes if you want to update the tool length offset (TLO) instead of adjusting the current WCS:

; Wait until the planner queue is empty%wait; Set user-defined variables%CLEARANCE_HEIGHT = 100%TOOL_CHANGE_X = -300%TOOL_CHANGE_Y = -300%TOOL_CHANGE_Z = CLEARANCE_HEIGHT%TOOL_PROBE_X = 0%TOOL_PROBE_Y = 0%TOOL_PROBE_Z = 20%PROBE_DISTANCE = 15%PROBE_FEEDRATE = 20%TOUCH_PLATE_HEIGHT = 10%RETRACTION_DISTANCE = 10; Keep a backup of current work position%X0=posx, Y0=posy, Z0=posz; Save modal state; * Work Coordinate System: G54, G55, G56, G57, G58, G59; * Plane: G17, G18, G19; * Units: G20, G21; * Distance Mode: G90, G91; * Feed Rate Mode: G93, G94; * Spindle State: M3, M4, M5; * Coolant State: M7, M8, M9%WCS = modal.wcs%PLANE = modal.plane%UNITS = modal.units%DISTANCE = modal.distance%FEEDRATE = modal.feedrate%SPINDLE = modal.spindle%COOLANT = modal.coolant; Stop spindleM5; Absolute positioningG90; Raise to tool change ZG53 Z[TOOL_CHANGE_Z]; Go to tool change X,YG53 X[TOOL_CHANGE_X] Y[TOOL_CHANGE_Y]; Wait until the planner queue is empty%wait; Pause the program for a manual tool changeM0; Go to Clearance HeightG53 Z[CLEARANCE_HEIGHT]; Go to tool probe X,YG53 X[TOOL_PROBE_X] Y[TOOL_PROBE_Y]; Go to tool probe ZG53 Z[TOOL_PROBE_Z]; Wait until the planner queue is empty%wait; Pause the program before probingM1; Cancel tool length offsetG49; Probe toward workpiece with a maximum probe distanceG91 ; Relative positioningG38.2 Z-[PROBE_DISTANCE] F[PROBE_FEEDRATE]G90 ; Absolute positioning; A dwell time of one second to make sure the planner queue is emptyG4 P1; Update the tool length offsetG43.1 Z[posz - TOUCH_PLATE_HEIGHT]; Retract from the touch plateG91 ; Relative positioningG0 Z[RETRACTION_DISTANCE]G90 ; Absolute positioning; Raise to tool change ZG53 Z[TOOL_CHANGE_Z]; Go to tool change X,YG53 X[TOOL_CHANGE_X] Y[TOOL_CHANGE_Y]; Wait until the planner queue is empty%wait; Pause the program for cleanup (e.g. remove touch plate, wires, etc)M0; Go to previous work positionG0 X[X0] Y[Y0]G0 Z[Z0]; Restore modal state[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

JoinCNCjs Users Group on Facebook to share your experiences with other people.

Site:https://cnc.js.org

Documentation

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp