Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- o<tool_change> sub
- M73 (auto-restore modal settings on return)
- (MSG, Tool change: loaded tool = [#<_current_tool>])
- (MSG, Tool change: selected tool = [#<_selected_tool>])
- (print, Tool_change: loaded tool = #<_current_tool>)
- (print, Tool_change: selected tool = #<_selected_tool>)
- ; unload previous tool - if next tool is also in spindle 1, then have to actually unload it first, so second parameter for tool_put_move is 0;
- o100 if [#<_current_tool> GT 0]
- o101 if [#<_current_tool> LE 7 AND #<_selected_tool> GE 51 AND #<_selected_tool> LE 84]
- ; #4000 = #<_current_tool> (save the number of tool currently in spindle)
- ; (MSG, Tool change: current tool remains in spindle)
- o<tool_put_move> call [#<_current_tool>] [1]
- o101 else
- (MSG, Tool change: tool put move started)
- o<tool_put_move> call [#<_current_tool>] [0]
- o101 endif
- o100 endif
- ; go to new tool
- o200 if [#<_selected_tool> EQ 0]
- G04 P0.2
- o200 elseif [#<_selected_tool> EQ #4000]
- M66 P05 L3 Q1 (check if carousel is out and does not interfere with spindle)
- o201 if [#5399 NE 1]
- (MSG, Carousel is not out, will try to do that, main 1)
- M64 P06 (move carousel out)
- G04 P0.2
- M65 P06
- M66 P05 L3 Q4 (check if carousel is out and does not interfere with spindle)
- o2011 if [#5399 EQ -1]
- (MSG, Carousel is not out, cycle paused)
- M0
- o2011 endif
- o201 else
- G04 P0.1
- o201 endif
- M66 P01 L0 (check if spindle is down)
- o202 if [#5399 NE 1]
- (MSG, Spindle is not down, will try to do that, main 1)
- M64 P01 (lower the spindle)
- M64 P04 (lower the spindle)
- G04 P0.2
- M65 P01
- M65 P04
- M66 P01 L3 Q10 (make sure that spindle is down)
- o2021 if [#5399 EQ -1]
- (MSG, Spindle is not down, cycle paused)
- M0
- o2021 endif
- o202 else
- G04 P0.1
- o202 endif
- o200 else
- (MSG, Tool change: tool get move started)
- #4000 = 0
- o<tool_get_move> call [#<_selected_tool>]
- o200 endif
- ; just to be sure - check if carousel is out and chip guard is down
- M66 P05 L0 (check if carousel is out and does not interfere with spindle)
- o301 if [#5399 NE 1]
- (MSG, Carousel is not out, will try to do that, main 2)
- M64 P06 (move carousel out)
- G04 P0.2
- M65 P06
- M66 P05 L3 Q4 (check if carousel is out and does not interfere with spindle)
- o3011 if [#5399 EQ -1]
- (MSG, Carousel is not out, cycle paused)
- M0
- o3011 endif
- o301 else
- G04 P0.1
- o301 endif
- ;M66 P03 L0 (check if chip guard is down)
- ;o302 if [#5399 NE 0]
- ; (MSG, Chip guard not down, will try to lower)
- ; M64 P08
- ; G04 P0.2
- ; M65 P08
- ; G04 P1
- ; M66 P03 L0 (make sure that chip guard is down)
- ;o3021 if [#5399 NE 0]
- ; (MSG, chip guard is not down, cycle paused)
- ; M0
- ;o3021 endif
- ;o302 endif
- ; succeed by returning a positive value
- o<tool_change> endsub [1]
- m2
Advertisement
Add Comment
Please, Sign In to add comment