So please, if this topic was already discussed but I did a wrong search, I kindly ask you to tell me the best keywords to perform a search.
On my Z-axis I have several tools, like the spindle, laser module, a camera, a touch probe, etc...
I'm looking for the best way to create a button set in my custom screen to easily switch the XY reference among them.
Something like the webcam plugin does. I'm not looking for a ready-to-use solution. I'm able to write a macro by myself, I'm asking you an advice to make the things elegant and re-usable.
I know the relative displacements among all my tools. Say the spindle is (0, 0), laser (0, 60), camera (50, 25), touch probe (-40, -40). They are not the actual value, but it just an example.
In my screenset I place four toggle buttons (acting like an option group) with the for tools.
I would like to be able to do something like this:
- select the current tool (i.e. camera)
- manually jog the machine to a desired position
- zero XY axis
- select another tool (i.e. laser or spindle)
- the macro should set now the XY values to the actual position as seen from the new tool
- for the sake of clarity, if now I select again the camera button I should read again (0, 0)
It's ok for me to hard-code the relative displacements in the macro file.
My ugly way:
- create a macro file for each button (I don't know if I can pass a parameter so I can use only one macro)
- hard-code the positions in some vars
- when the macro is called (= the related button is pressed) I sum the reference position (i.e. spindle) to the current position to go back to a default coordinate system. Then, sum again the new offsets.
- I also need to save in a system var the current tool to avoid to change the position if I press multiple times the same button
Do you recommend a more elegant solution?