Si, Gino.
ora devo riuscire a capire come fare per avere un fottuto "azzeramento degli utensili" che rispetti ciò che deve fare e la posizione dell'oggetto sulla macchina.
Indicativamente la procedura che sto seguendo è la seguente:
1) azzero la macchina - Tutto ok. La macchina si azzera come dico io!
2) carico il file gocode - Tutto ok... anche se devo sistemare alcuni comandi nel postprocessore e rivedere i vecchi files gcode
3)
effettuo il touch-off sul pezzo (ma qui già mi incasino, credo...) con la seguente subroutine
Codice: Seleziona tutto
O<touch_to_z> SUB
G21
G91
#< Plate_Thickness> = 1.5
#< Probe_Speed> = 100
#< Probe_System> = #5220
#< Probe_Retract> = 1
#< Probe_Movement> = 1
; Calcolo la distanza massima per il sensore
#< Probe_Distance> = [100 - #< Plate_Thickness>]
;(DEBUG, Probe Distance = #< Probe_Distance>)
; Vado a trovare il sensore con una velocità alta
G38.3 Z-#< Probe_Distance> F#< Probe_Speed>
; Azzero la Z rispetto al pezzo
G10 L20 P#< Probe_System> Z#< Plate_Thickness>
G28.1
; Rialzo l'utensile
G0 Z#< Probe_Retract>
; Sposto l'utensile
G0 X#< Probe_Movement>
; Calcolo la nuova distanza massima per il sensore
#< Probe_Distance> = [#< Plate_Thickness> + 1]
;(DEBUG, Probe Distance = #< Probe_Distance>)
; Vado a trovare il sensore con una velocità MOLTO BASSA
G38.3 Z-#< Probe_Distance> F[#< Probe_Speed> / 20]
; Azzero Nuovamente la Z rispetto al pezzo
G10 L20 P#< Probe_System> Z#< Plate_Thickness>
G28.1
;(DEBUG, #5223)
G90
G53 G0 Z100
O<touch_to_z> endsub [#5070]
M2
4) avvio il programma e
alla linea Txx M6 viene fatto il REMAPPING e richiamata la seguente subroutine:
Codice: Seleziona tutto
O<tool-change> SUB
(------------------------------- CONFIGURATION PARAMETERS ----------------------------------------------)
#<_UseInches> = 0 ( set to 1 to use inches here, or 0 to use millimeters; should match units on tool.tbl dimensions )
#<_TravelZ> = 100.0 ( machine Z coordinate for travelling, typically near max Z to avoid ever hitting the work )
#<_TravelFeed> = 100.0 ( feedrate used for general Z moves when avoiding G0 )
#<_ProbeX> = 670.0 ( machine X coordinate of switch/touch-off plate )
#<_ProbeY> = 459.5 ( machine Y coordinate of switch/touch-off plate )
#<_ProbeFastZ> = 100.0 ( machine Z coord to move to before starting probe, longest tool should not touch switch at this Z )
#<_ProbeMinZ> = 10.0 ( machine Z coord to stop probe, shortest tool must touch switch at this Z, must be > min Z )
#<_ProbeRetract> = 1.0 ( small distance to retract before approaching switch/touch-off plate second time )
#<_ProbeFastFeed> = 200.0 ( feed rate for moving to _ProbeFastZ )
#<_ProbeFeed1> = 100.0 ( feed rate for touching switch/touch-off plate first time )
#<_ProbeFeed2> = 10.0 ( feed rate for touching switch/touch-off plate second time )
#<_ToolChangeX> = 750.0 ( machine X coordinate to pause at for manual tool changing )
#<_ToolChangeY> = 50.0 ( machine Y coordinate to pause at for manual tool changing )
#<_MistOnDuringProbe> = 0 ( set to 1 for mist, or 2 for coolant, or 0 for nothing during probing, to clear switch of swarf )
(-------------------------------------------------------------------------------------------------------)
O100 IF [ EXISTS[#<_ToolDidFirst>] EQ 0 ]
#<_ToolDidFirst> = 0
O100 ENDIF
O105 IF [ #<_ToolDidFirst> EQ 0 ]
G49 ( clear tool length compensation prior to saving state if this is first time )
O105 ENDIF
M70 ( save current modal state )
M9 ( turn off coolant, will be restored on return if it was on )
M5 ( turn off spindle, cannot be on during the probe )
G21 ( use inches or millimeters as required here, units will be restored on return )
G30.1 ( save current position in #5181-#5183... )
G49 ( clear tool length compensation )
G90 ( use absolute positioning here )
G94 ( use feedrate in units/min )
G40 ( turn cutter radius compensation off here )
G53 G1 F[#<_TravelFeed>] Z[#<_TravelZ>] ( go to high travel level on Z )
G53 G0 X[#<_ToolChangeX>] Y[#<_ToolChangeY>] ( nice place for changing tool )
M6 ( do the normal M6 stuff )
O200 IF [ #<_ToolDidFirst> EQ 0 ]
G53 G1 F[#<_TravelFeed>] Z[#<_TravelZ>] ( go to high travel level on Z )
G53 G0 X[#<_ProbeX>] Y[#<_ProbeY>] ( to probe switch )
G53 G1 F[#<_ProbeFastFeed>] Z[#<_ProbeFastZ>]( move tool closer to switch -- we shouldn't hit it )
G54 G1 F[#<_ProbeFeed1>] G91 ( use relative positioning )
O101 IF [ #<_MistOnDuringProbe> EQ 1 OR #<_MistOnDuringProbe> EQ 2 ]
M[7 + #<_MistOnDuringProbe> - 1] ( turn on mist/coolant )
O101 ENDIF
G38.2 Z[#<_ProbeMinZ> - #<_ProbeFastZ>] F[#<_ProbeFeed1>] ( trip switch slowly )
G0 Z[#<_ProbeRetract>] ( go up slightly )
G38.2 Z[#<_ProbeRetract>*-1.25] F[#<_ProbeFeed2>] ( trip switch very slowly )
M9 ( turn off mist )
G90 ( use absolute positioning )
#<_ToolZRef> = #5063 ( save trip point )
#<_ToolZLast> = #<_ToolZRef> ( save last tool Z position )
G53 G1 F[#<_TravelFeed>] Z[#<_TravelZ>] ( return to safe level )
G53 G0 X[#5181] Y[#5182] ( return to where we were in X Y)
G53 G1 F[#<_TravelFeed>] Z[#5183] ( return to where we were in Z )
M72 ( restore modal state )
#<_ToolDidFirst> = 1 ( we have been in this section to set reference value already )
O200 ELSE
G53 G1 F[#<_TravelFeed>] Z[#<_TravelZ>] ( go to high travel level on Z )
G53 G0 X[#<_ToolChangeX>] Y[#<_ToolChangeY>] ( nice place for changing tool )
O107 IF [#<_UseInches> EQ 1 ]
#<ToolDiamIn> = #5410
#<ToolDiamMM> = [ #<ToolDiamIn> * 25.4 ]
O107 ELSE
#<ToolDiamMM> = #5410
#<ToolDiamIn> = [ #<ToolDiamMM> / 25.4 ]
O107 ENDIF
O102 IF [ #<_current_tool> EQ 0 AND #<ToolDiamIn> EQ 0 ]
(MSG, Change tool then click Resume )
O102 ELSE
#<ToolDiamMM> = [ #<ToolDiamIn> * 25.4 ]
(DEBUG, Change to tool #<_current_tool> with diameter #<ToolDiamMM>mm, #<ToolDiamIn>in then click Resume )
O102 ENDIF
M0 ( pause execution )
G53 G0 X[#<_ProbeX>] Y[#<_ProbeY>] ( to high place directly over switch )
G53 G1 F[#<_ProbeFastFeed>] Z[#<_ProbeFastZ>]( move tool closer to switch -- we shouldn't hit it )
G54 G1 F[#<_ProbeFeed1>] G91 ( use relative positioning )
O103 IF [ #<_MistOnDuringProbe> EQ 1 OR #<_MistOnDuringProbe> EQ 2 ]
M[7 + #<_MistOnDuringProbe> - 1] ( turn on mist/coolant )
O103 ENDIF
G38.2 Z[#<_ProbeMinZ> - #<_ProbeFastZ>] F[#<_ProbeFeed1>] ( trip switch slowly )
G0 Z[#<_ProbeRetract>] ( go up slightly )
G38.2 Z[#<_ProbeRetract>*-1.25] F[#<_ProbeFeed2>] ( trip switch very slowly )
M9 ( turn off mist )
G90 ( use absolute positioning )
(debug, #<_ToolZ>)
(debug, #<_ToolZRef>)
(debug, #<_ToolZLast>)
#<_ToolZ> = #5063 ( save new tool length )
G43.1 Z[#<_ToolZ> - #<_ToolZRef>] ( set new tool length Z offset, we do this now to show operator even though it has to be set again after M72 )
G53 G1 F[#<_TravelFeed>] Z[#<_TravelZ>] ( return to high travel level )
G53 G0 X[#5181] Y[#5182] ( return to where we were in X Y)
G53 G1 F[#<_TravelFeed>] Z[#5183 - #<_ToolZLast> + #<_ToolZ>] ( return to where we were in Z, ajusting for tool length change )
#<_ToolZLast> = #<_ToolZ> ( save last tool length )
M72 ( restore modal state )
G43.1 Z[#<_ToolZ> - #<_ToolZRef>] ( set new tool length Z offset )
O200 ENDIF
O<tool-change> ENDSUB
M2
A questo punto la testa dovrebbe tornare alla giusta posizione ed iniziare a lavorare.
Il problema è la Z. tutto il piano di lavoro mi si abbassa e la Z andrebbe a sbattere contro il pezzo!
--------------------
Update: ho trovato l'errore
#<_ToolZ> = #5063 ( save new tool length )
G43.1 Z[#<_ToolZ> - #<_ToolZRef>] ( set new tool length Z offset, we do this now to show operator even though it has to be set again after M72 )
Qui... c'è un errore. Devo capire come sistemarlo perché ormai non ci sto capendo più nulla!
Gino, correggimi se sbaglio...
Allora...
Quando la CNC si avvia, la compensazione è ZERO.
Effettua una serie di operazioni. Poi ad un certo punto arriva l'istruzione Txx M6 per il cambio utensile.
Quando la punta del nuovo utensile tocca il sensore, viene calcolata la differenza tra la posizione Z in quell'istante e l'altezza del sensore (nel mio caso è 50mm). Giusto?
A questo punto, tale differenza la devo inserire nel comando G43.1 Z <valore>.
Corretto?