Macro centratura XY

Sezione dedicata all'invio e al download delle macro parametriche
Rispondi
Alessandro
Messaggi: 43
Iscritto il: 18 giu 2019, 07:32

Macro centratura XY

Messaggio da Alessandro » 28 dic 2019, 21:59

Allego le macro che permettono di dividere in automatico la quota degli assi X ed Y ad esempio usando un centratore a molla.
Una volta rilevata la posizione su un lato del pezzo da lavorare, si procede a mettere a 0 il relativo DRO dell'asse, ci si sposta sul altro lato e si preme il pulsante relativo alla macro dell'asse, questo farà si che la quota venga divisa in due ed impostata in automatico sulla WCS.


;
; RosettaCNC (c) 2016-2019
;
; Name : center_on_x
; Sub UID : 1
; Version : 1
; Description : set active wcs X to be center o two points.
; :
; : 1] Move X axis to left side of piece to center.
; : 2] Zero current WCS X with related left tool bar icon.
; : 3] Move X axis to right side of piece to center.
; : 4] Run this macro.
; Note :
;O1
; gets active wcs X index
#<_wcs.index_>=#5220
#<_wcs.x.index_>=[5200 + 20 * [#5220] + 1]

; gets wcs X offset
#<_wcs.x_>=##<_wcs.x.index_>

; sets new wcs X offset to be center of piece
#<_center_>=[#<_wcs.x_> + [#5001 / 2]]
##<_wcs.x.index_>=#<_center_>

; M109 p"Right side was: #<_wcs.x_><BR>Left side was: #5001<BR>Center is: #<_center_>" Q2
M109 p"Press to center X axis" Q2

; if there are not movements we need to forces WCS change to update internal CNC states
IF [#<_wcs.index_> EQ 1] THEN G55
IF [#<_wcs.index_> EQ 2] THEN G54
IF [#<_wcs.index_> EQ 3] THEN G55
IF [#<_wcs.index_> EQ 4] THEN G55
IF [#<_wcs.index_> EQ 5] THEN G55
IF [#<_wcs.index_> EQ 6] THEN G55
IF [#<_wcs.index_> EQ 7] THEN G55
IF [#<_wcs.index_> EQ 8] THEN G55
IF [#<_wcs.index_> EQ 9] THEN G55

IF [#<_wcs.index_> EQ 1] THEN G54
IF [#<_wcs.index_> EQ 2] THEN G55
IF [#<_wcs.index_> EQ 3] THEN G56
IF [#<_wcs.index_> EQ 4] THEN G57
IF [#<_wcs.index_> EQ 5] THEN G58
IF [#<_wcs.index_> EQ 6] THEN G59
IF [#<_wcs.index_> EQ 7] THEN G59.1
IF [#<_wcs.index_> EQ 8] THEN G59.2
IF [#<_wcs.index_> EQ 9] THEN G59.3

M102











;
; RosettaCNC (c) 2016-2019
;
; Name : center_on_y
; Sub UID : 1
; Version : 1
; Description : set active wcs Y to be center o two points.
; :
; : 1] Move Y axis to bottom side of piece to center.
; : 2] Zero current WCS Y with related left tool bar icon.
; : 3] Move Y axis to top side of piece to center.
; : 4] Run this macro.
; Note :
;O1
; gets active wcs Y index
#<_wcs.index_>=#5220
#<_wcs.y.index_>=[5200 + 20 * [#5220] + 2]

; gets wcs Y offset
#<_wcs.y_>=##<_wcs.y.index_>

; sets new wcs Y offset to be center of piece
#<_center_>=[#<_wcs.y_> + [#5002 / 2]]
##<_wcs.y.index_>=#<_center_>

; M109 p"Bottom side was: #<_wcs.y_><BR>Top side was: #5002<BR>Center is: #<_center_>" Q2
M109 p"Press to center Y axis" Q2

; if there are not movements we need to forces WCS change to update internal CNC states
IF [#<_wcs.index_> EQ 1] THEN G55
IF [#<_wcs.index_> EQ 2] THEN G54
IF [#<_wcs.index_> EQ 3] THEN G55
IF [#<_wcs.index_> EQ 4] THEN G55
IF [#<_wcs.index_> EQ 5] THEN G55
IF [#<_wcs.index_> EQ 6] THEN G55
IF [#<_wcs.index_> EQ 7] THEN G55
IF [#<_wcs.index_> EQ 8] THEN G55
IF [#<_wcs.index_> EQ 9] THEN G55

IF [#<_wcs.index_> EQ 1] THEN G54
IF [#<_wcs.index_> EQ 2] THEN G55
IF [#<_wcs.index_> EQ 3] THEN G56
IF [#<_wcs.index_> EQ 4] THEN G57
IF [#<_wcs.index_> EQ 5] THEN G58
IF [#<_wcs.index_> EQ 6] THEN G59
IF [#<_wcs.index_> EQ 7] THEN G59.1
IF [#<_wcs.index_> EQ 8] THEN G59.2
IF [#<_wcs.index_> EQ 9] THEN G59.3

M102

Rispondi

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite