# Divide Axis coordinate

15 Mar 2017 11:38 #89657
MarcoGaspar created the topic: Divide Axis coordinate
Hello,

It's possible and how to add one button to Divide the coordinates of axis?

Best Regards,
Marco Gaspar
15 Mar 2017 13:02 #89659
Todd Zuercher replied the topic: Divide Axis coordinate
Probably.
What do you mean by "Divide"?
What exactly do you want?
Do you just want to take the number shown in the DRO and divide it by another number?
What will the divisor be? Will it always be the same or will it be a variable?
What do you want to do with the product?
15 Mar 2017 13:28 #89660
MarcoGaspar replied the topic: Divide Axis coordinate
i want to take the number shown in the DRO and divide it by 2 (to center a workpice)
15 Mar 2017 13:52 #89661
Todd Zuercher replied the topic: Divide Axis coordinate
Are you also going to want to command the axis to move to that point, or do you just want the number for calculating purposes?
15 Mar 2017 14:00 #89662
MarcoGaspar replied the topic: Divide Axis coordinate
i just want for calculate

I just want to make 0 on one side of the workpiece and on the other side i want to divide the value by half to set the X0 Y0 to the middle of the pice.
15 Mar 2017 14:50 #89666
Todd Zuercher replied the topic: Divide Axis coordinate
I think you could create a button (with GladeVCP or PYVCP) that could do this but it seems a lot of trouble.

If all you want is the number spit out it will take 2 lines of MDI code, so you will need to make a sub program that the VCP button calls with its MDI command. If you would like the button to move the axis to that half way point, it is actually a little simpler as one line of MDI code can do the job and you wouldn't need the sub program(s). You would have to set up a different button for each axis you want to do this with.

Any way, the MDI commands to just spit out the numbers would be, 1st to create a parameter variable and set it equal to the value you are after. And the 2nd one prints it out. First you would jog to the left edge of your piece, touch off that axis, jog to the other edge, then issue these two commands. (or press your button once that is configured).
```#<half x.>=[#5420/2]
(debug, #<half x>)```

To just move to the mid point the line of code would be.
`G0 X[#5420/2]`

The parameter numbers for the other relative axis potions are #5421=Y, #5422=Z, #5423=A...
15 Mar 2017 14:59 #89668
MarcoGaspar replied the topic: Divide Axis coordinate
Thanks
15 Mar 2017 16:13 - 15 Mar 2017 16:14 #89675
Todd Zuercher replied the topic: Divide Axis coordinate
Maybe this line might be more useful, It would automatically change the touch off point to the mid point in one MDI command, without any movement of the machine.
First touch of the left edge (G54), then jog to the right edge, then issue this command, and the mid point will be set as the new G54 X0.
`G10 L20 P1 X[#5420/2]`
Last Edit: 15 Mar 2017 16:14 by Todd Zuercher.
The following user(s) said Thank You: MarcoGaspar
16 Mar 2017 18:48 #89765 by andypugh
andypugh replied the topic: Divide Axis coordinate

MarcoGaspar wrote: i want to take the number shown in the DRO and divide it by 2 (to center a workpice)

If you are using the Axis interface and the Touch-off box then you can simply enter an arithmetic expression in the touch-off dialog.
Time to create page: 0.080 seconds