Dynamische Werkzeuglängenmessung

More
21 Feb 2021 12:24 #199598 by paul303
Ich habe mir mit einigen Code-Schnipseln aus dem Web ein Werkzeugwechsel-Macro gebastelt. Über die Variable <ToolDidFirst> wird gesteuert, ob der Antastvorgang mit dem Referenzwerkzeug erfolgt oder ob die Werkzeuglänge angepasst werden soll. Ich nutze dies mit gmoccapy. Hierbei verschiebe ich jeweils das G54 Koordinatensystem, da ich mit G43.1 nur Probleme unter gmoccapy hatte.
Das tool-job-begin.ngc macro wird hierbei durch m600 aufgerufen, tool-change.ngc ist mit m6 verknüpft. das funktioniert soweit ganz gut innerhalb meiner ersten Tests. Sporadisch tritt folgender Fehler auf: "es ist derzeit nicht möglich in den Auto Modus zu wechseln" "unbekannte O-Wort-Nummer"

Hier sind die Makros:

O<tool-change> sub
( see: www.linuxcnc.org/index.php/english/forum...h-off?start=30#48235 )

( Filename: tool-change.ngc )
( LinuxCNC Manual Tool-Change Subroutines for Milling Machines version 1.1: subroutine 1/2 )
( BEFORE USING CHANGE "CONFIGURATION PARAMETERS" BELOW FOR YOUR MACHINE! )

( )

( In the LinuxCNC .ini config file, under the [RS274NGC] section add: )
( # change/add/use SUBROUTINE_PATH to point to the location where these tool-change subroutines are located: )
( SUBROUTINE_PATH = /home/linuxcnc/linuxcnc/nc_files )
( REMAP=M6 modalgroup=6 ngc=tool-change )
( REMAP=M600 modalgroup=6 ngc=tool-job-begin )

( and under the [EMCIO] section add: )
( TOOL_CHANGE_AT_G30 = 0 )

( and ensure neither TOOL_CHANGE_POSITION nor TOOL_CHANGE_QUILL_UP is set. )
( )

( In the LinuxCNC .hal config file, map some input pin to be the probe input, e.g.: )
( net probe-z parport.0.pin-12-in => motion.probe-input )

( )

( Usage: M6 in the g-code will invoke a manual tool change with automatic tool height adjustment. )
( M600 is used at the beginning of the first g-code file of a job so that the next M6 will measure the tool for reference )
( instead of caluculating a tool length offset. It can also be invoked manually through the MDI before a job starts. )

( )

( General theory of operation: touches each tool off to the tool height sensor. The first tool is used as the reference, all )
( subsequent tools adjust the tool offset. The tip of the tool is always placed back at the position it started in before )
( any of the subroutines are called.)
( )


(

CONFIGURATION PARAMETERS
)
#<_ProbeX> = 3 ( machine X coordinate of switch/touch-off plate )
#<_ProbeStartZ> = -140 ( machine Z coord to move to before starting probe, longest tool should not touch switch at this Z )
#<_ProbeDistance> = -69 ( Suchweg für den Probe)
#<_ProbeRetract> = 2 ( small distance to retract before approaching switch/touch-off plate second time)
#<_ProbeRetractSpeed> = 500 (wie schnell ich vom Messtaster runter fahre)
#<_ProbeFeed1> = 500 ( feed rate for touching switch/touch-off plate first time )
#<_ProbeFeed2> = 50.0 ( feed rate for touching switch/touch-off plate second time )
#<_ToolChangeX> = 200.0 ( machine X coordinate to pause at for manual tool changing )


(
Init
)

O100 if [EXISTS[#<_ToolDidFirst>] EQ 0 ]
#<_ToolDidFirst> = 0
O100 endif

G49 ( clear tool length compensation prior to saving state if this is first time )
M5 (stop spindle)
G54
G90 G0

G53 Z0 (ganz hoch im Maschinenkoord.)
G53 X[#<_ToolChangeX>] (Wechsel X Position)
M6 (Toolchange aufrufen T[#<_selected_tool>])
G53 G0 X[#<_ProbeX>] (to probe switch)
G53 G0 Z[#<_ProbeStartZ>] (to probe Start height)



(
Referenzieren
)

O200 if [ #<_ToolDidFirst> EQ 0 ]


G91 (inc modus)
G38.2 Z[#<_ProbeDistance>] F[#<_ProbeFeed1>] (messen grob)
G1 Z[#<_ProbeRetract>] F[#<_ProbeRetractSpeed>] (frei fahren)
G38.2 Z[#<_ProbeRetract>*-1.25] F[#<_ProbeFeed2>] (messen fein)


#<_ToolZRef>=[#5063+#5223] (G53 Referenzlänge speichern)
;(debug, Referenz: #<_ToolZRef>)

G1 Z5.0 F[#<_ProbeRetractSpeed>] (frei fahren)
G90 G0
G53 Z0 (wieder hoch)
G54 (zu G54 zurück)

#<_ToolDidFirst> = 1 (referenzieren abgeschlossen)
O200 else

(
Werkzeuglänge verrechnen
)


G91 (inc modus)
G38.2 Z[#<_ProbeDistance>] F[#<_ProbeFeed1>] (messen grob)
G1 Z[#<_ProbeRetract>] F[#<_ProbeRetractSpeed>] (frei fahren)
G38.2 Z[#<_ProbeRetract>*-1.25] F[#<_ProbeFeed2>] (messen fein)


#<_ToolZ>=[#5063+#5223] (G53 dynamisch messen)
;(debug, Messpunkt: #<_ToolZ>)

#<_ToolDiff>=[#<_ToolZ>-#<_ToolZRef>] (Differenz der Messungen)
;(debug, Differenz: #<_ToolDiff>)

#<_ToolOffset>=[#5223+#<_ToolDiff>] (Berechnung des Offsets)
;(debug, Offset: #<_ToolOffset>)

G1 Z5.0 F[#<_ProbeRetractSpeed>] (frei fahren)
G90 G0
G53 Z0 (wieder hoch)
G10 L2 P1 Z[#<_ToolOffset>] (passt G54 an)
G54 (neues G54)


O200 endif

O<tool-change> endsub
M2

O<tool-job-begin> SUB

( Filename: tool-job-begin.ngc )

( LinuxCNC Manual Tool-Change Subroutines for Milling Machines version 1.1: subroutine 2/2 )
( Intended to be run as a remapped M600 command. Used to indicate that the next tool change, M6, is the first tool of a job. )

#<_ToolDidFirst> = 0 ( new job, we haven't yet called <tool-change> for the first time )
G49 ( clear tool height adjustment )

O<tool-job-begin> ENDSUB
M2
Attachments:

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

More
21 Feb 2021 12:26 #199600 by paul303
Kann mir jemand helfen? Ich finde die Ursache für den Fehler nicht.

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

Time to create page: 0.100 seconds
Powered by Kunena Forum