Page 1 of 1

Acorn Macro/ Sub Program to offset wsc Position

Posted: Wed Nov 11, 2020 7:22 pm
by kcarpenter1986
Hello,

Can you guys point me in the right direction

Basically I have my WCS # 4 or G75 set to the back corner of my vice.

What I would like to do is make a program that will

G75 X0 Y0 ; Move to x and y 0

M200 "Please insert Y offset" ????????????? At this point I want it to ask me for a y offset and allow me to type this in a box the save this to #101 Im not sure how to do this can any one help?


Then I want to
G00 y[#101] ; Move to offset that was inputted Hopfully

G54 ; Change to WCS#1

Then I want to to make x and y =0 but Im not sure of the code for this


Can any one help me with this

I dont want to use the g52 and offset because I use multiply 3-6 are all permanently set and i never move them so i can get confused. then 1-2 i use as temp homes... thats why I want to do it like this

Thank you

Re: Acorn Macro/ Sub Program to offset wsc Position

Posted: Wed Nov 11, 2020 9:31 pm
by cncsnw
Look up M224 and G92.

Re: Acorn Macro/ Sub Program to offset wsc Position

Posted: Fri Nov 13, 2020 9:27 pm
by kcarpenter1986
Hi
Thank you for that was very helpful and after some searching I have managed to edit another macro do do what I want


I have another question. is there a way to change the icon on the virtual key pad?



my maco for offsetting the y below:

So I set the back left corner of my vice and 0,0 WC3 so i never change this

then when i clamp a block of stock in my vice most of the time i will line it up with the left

I can then run this maco type in the size of the block and it will reset WC2 in the botom left corner of the block

;------------------------------------------------------------------------------
;Macro to take current origin and offset Y by asked amount and reset this as origin 2
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

N100 ;Insert your code between N100 and N1000
#101 = 1 ;Initialize #101 to 1, (represents axis number)
IF #50010 ;Prevent lookahead from parsing past here

N200 ;If an axis has not been homed, notify user part 0 can not be set.
#102 = #[20100 + #101] ;Set #102 = Ascii value of current axis label
IF #50010 ;Prevent lookahead from parsing past here
IF #102 != 78 THEN #[103 +#101] = #102 ;Put label into appropriate variable
IF #50010 ;Prevent lookahead from parsing past here
IF #102 != 78 THEN #103 = [[#103]+1] ;Increment number of valid axes.
IF #50010 ;Prevent lookahead from parsing past here
IF #102 == 78 THEN GOTO 300 ;Skip if axis label = N
IF #50010 ;Prevent lookahead from parsing past here
IF #[23700 + #101] THEN GOTO 300 ;If current axis has been homed, goto 300 to increment to next axis.
;Otherwise, display message below
M225 #100 "%c axis home is not set.\nPlease home your machine before attempting to set part 0.\nPress Cycle Start to exit and then home all axes." #102
IF 1 == 1 THEN GOTO 1000 ;Go to end of macro. Exit macro

N300 ;Loop through axes to make sure machine is homed
IF #50010 ;Prevent lookahead from parsing past here
#101 = #101 + 1 ;Increment axis number
IF #50010 ;Prevent lookahead from parsing past here
IF #101 < 5 THEN GOTO 200 ;Only need to check 4 axes, go to end
IF #50010 ;Prevent lookahead from parsing past here

G53 Z0

G00 X0 Y0 ; Move to X and Y 0




N400 ; Ask User how much to offset by in the y axis

IF #103 == 3 THEN M224 #110 "Please enter amount to offset Y axis \n Press Cycle Start to complete"
IF #50010 ;Prevent lookahead from parsing past here

N500 ; Move Y axis by offset amount

G00 Y-#110
IF #50010 ;Prevent lookahead from parsing past here

N600 ; swap to origin 1

G55


N700 ;Set Y axis to


G92 X0 Y0






N1000 ;End of Macro

Re: Acorn Macro/ Sub Program to offset wsc Position

Posted: Fri Nov 13, 2020 10:56 pm
by swissi
kcarpenter1986 wrote: Fri Nov 13, 2020 9:27 pm I have another question. is there a way to change the icon on the virtual key pad?
Lots of great information here:

Introduction to Centroid CNC Macro Programming

Centroid VCP 2.0 Users manual

-swissi