ATC Tool Rack implementation gesucht

More
13 Mar 2025 13:02 #323828 by tsaG
Moin!

Hat jemand ein M6 Remap für Basicprobe für ein ATC Toolrack (in Y Orientierung) welches ich als Basis nutzen könnte?

Zudem bin ich gerade dabei einen kleinen Kettenwechsler zu bauen (dazu brauche ich erst einmal das normale Toolrack). Hat hier jemand erfahrungen?

Grüße

Please Log in or Create an account to join the conversation.

More
13 Mar 2025 18:04 #323854 by Benb
Replied by Benb on topic ATC Tool Rack implementation gesucht
use an internet search engine such as Google Chrome Type:
linuxcnc : m6 remap for atc
you get few answers to your questions.

Please Log in or Create an account to join the conversation.

More
13 Mar 2025 18:37 #323857 by tommylight
Replied by tommylight on topic ATC Tool Rack implementation gesucht
m6 remap atc site:linuxcnc.org
This returns only results from our web and forum containing those words.

Please Log in or Create an account to join the conversation.

More
13 Mar 2025 22:34 #323874 by tsaG
Replied by tsaG on topic ATC Tool Rack implementation gesucht
Thanks! Unfortunately, most of it is just people having problems with their code without posting the working code. Okay, It seems I am on my own. Ill post my code once I am making progress or even get it working

Please Log in or Create an account to join the conversation.

More
13 Mar 2025 22:55 #323876 by tommylight
Replied by tommylight on topic ATC Tool Rack implementation gesucht
LinuxCNC config picker from the main menu, then Sample configurations>sim>axis>remap>rack toolchange as shown in picture.
That will also copy the files to your LinuxCNC configs folder so you can edit and test as much as you like. :)
Attachments:

Please Log in or Create an account to join the conversation.

More
13 Mar 2025 23:22 #323877 by tsaG
Replied by tsaG on topic ATC Tool Rack implementation gesucht
Thanks! That is already a great place to start! I will have a look at it. In the meantime, I came up with my own code (thanks Chatgpt). However, when executing it I get the error "Unknown word starting with f" in the GUI. However, without any hint to any line in the code. It seems I have to open linuxcnc via console and active the debug mode to see it?

This is my code for now. More work tomorrow.
%
(MSG, --- Start of toolchange.ngc ---)

o<toolchange> sub

    (MSG, --- Toolchange Subroutine Entry ---)

    ; ------------------------------------------------------------------
    ; A) Named parameters (populated by stdglue.py / M6 prolog):
    ;    #<selected_tool>, #<tool_in_spindle>,
    ;    #<selected_pocket>, #<current_pocket>,
    ;    #<atc_z_tool_change_height>, #<atc_z_tool_clearance_height>, etc.
    ; ------------------------------------------------------------------

    (MSG, Selected tool = #<selected_tool>)
    (MSG, Tool in spindle = #<tool_in_spindle>)
    (MSG, Selected pocket = #<selected_pocket>)
    (MSG, Current pocket = #<current_pocket>)

    ; ------------------------------------------------------------------
    ; B) Check if a tool change is actually needed
    ; ------------------------------------------------------------------
    IF [#<selected_tool> EQ #<tool_in_spindle>] THEN
        (MSG, Tool #<tool_in_spindle> is already loaded. No change needed.)
        M99
    END-IF

    ; ------------------------------------------------------------------
    ; C) Stop the spindle
    ; ------------------------------------------------------------------
    M5  ; no spindle orientation (M19) requested

    ; ------------------------------------------------------------------
    ; D) Rack coordinates (adjust as needed for your machine)
    ; ------------------------------------------------------------------
    #<rack_x>      = 1123
    #<rack_y_base> = 164
    #<rack_y_pitch> = 50

    ; We comment these out so they are NOT overwritten (assuming INI defines them):
    ; #<atc_z_tool_change_height>    = -80
    ; #<atc_z_tool_clearance_height> = 0

    ; Move Z to clearance
    G53 G0 Z[#<atc_z_tool_clearance_height>]

    ; ------------------------------------------------------------------
    ; E) Drop off the old tool (#<tool_in_spindle>) in #<current_pocket>
    ; ------------------------------------------------------------------
    IF [#<tool_in_spindle> GT 0] THEN

        ; 1) Y coordinate for the current pocket
        #<old_pocket_y> = [#<rack_y_base> + ([#<current_pocket>] - 1) * #<rack_y_pitch>]

        ; 2) Move to that pocket in machine coords (G53)
        G53 G0 X[#<rack_x>] Y[#<old_pocket_y>]

        ; 3) Lower Z to the tool-change height
        G53 G0 Z[#<atc_z_tool_change_height>]

        ; 4) Unclamp (M64 P2) to release old tool
        (MSG, Unclamping old tool with M64 P2)
        M64 P2
        G4 P1  ; dwell 1 second, adjust as needed

        ; 5) Move back up to clearance
        G53 G0 Z[#<atc_z_tool_clearance_height>]

        ; 6) Update the pocket table (#4001..#4024)
        #<pocket_index> = [4000 + #<current_pocket>]
        #[#<pocket_index>] = #<tool_in_spindle>
    END-IF

    ; ------------------------------------------------------------------
    ; F) Pick up the new tool (#<selected_tool>) from #<selected_pocket>
    ; ------------------------------------------------------------------
    IF [#<selected_tool> GT 0] THEN

        ; 1) Optional check: does pocket #<selected_pocket> hold #<selected_tool>?
        #<pocket_index> = [4000 + #<selected_pocket>]
        IF [#[#<pocket_index>] NE #<selected_tool>] THEN
            (MSG, *** WARNING: Pocket #<selected_pocket> does not match tool #<selected_tool>!)
        END-IF

        ; 2) Compute Y coordinate for the selected pocket
        #<new_pocket_y> = [#<rack_y_base> + ([#<selected_pocket>] - 1) * #<rack_y_pitch>]

        ; 3) Move to that pocket
        G53 G0 X[#<rack_x>] Y[#<new_pocket_y>]

        ; 4) Lower Z to the tool-change height
        G53 G0 Z[#<atc_z_tool_change_height>]

        ; 5) Clamp (M65 P2) to pick up the new tool
        (MSG, Clamping new tool with M65 P2)
        M65 P2
        G4 P1  ; dwell 1 second, adjust as needed

        ; 6) Return to clearance
        G53 G0 Z[#<atc_z_tool_clearance_height>]

        ; 7) This pocket is now empty
        #[#<pocket_index>] = 0
    END-IF

    ; ------------------------------------------------------------------
    ; G) The spindle now has the new tool
    ; ------------------------------------------------------------------
    #<tool_in_spindle> = #<selected_tool>

    ; ------------------------------------------------------------------
    ; H) Tell LinuxCNC the new tool is active & load offset
    ; ------------------------------------------------------------------
    M61 Q[#<selected_tool>]     ; set active tool to #<selected_tool>
    G43 H[#<selected_tool>]     ; load that tool's offset from table

    ; ------------------------------------------------------------------
    ; I) Return to caller
    ; ------------------------------------------------------------------
    M99

o<toolchange> endsub

M2

(MSG, --- End of toolchange.ngc ---)
%

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum