CS-Lab Support Forum for CNC Community
Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help!
help with a tool length macro
Quote from dylan1024 on 10 November 2023, 11:57I would like some thoughts or help with a tool length macro that is slightly different to normal:
My machine has an ER collet system, so manual tool changes. I will have a tool height sensor fixed to the machine bed.
My tool height sensor has a max travel of 3mm and no overtravel contacts.Either of two possible ways of working I would like:
1:
- M6 pauses program and prompts user to change tool
- user can then maually move tool to toolsetter location
- user manually moves Z axis until tool setter is detected then the macro will retract the tool and 'auto' measure from there.
- once tool length is measured retract Z completely and prompt user to resume program.
2:
- M6 pauses program and prompts user to change tool
- user can then manually move tool to toolsetter location (I prefer this as some tools have cutting edges off center, like a fly cutter)
- User can manually move Z to just above tool setter and press a 'probe' or 'start measure button' and the macro will move Z axis towards the tool setter but 0nly for 3mm if it does not trigger after 3mm then it lets user know it as failed. (this ensures it can never over travel)
- once tool length is measured successfully retract Z completely and prompt user to resume program.
I think option 2 is better suited to SimCNC?
I suspect i want to somehow use d.executeProbing with an incremental move rather than telling it to go to a machine co-ordinatemaybe it needs to save machine coordinate when user has positioned tool just above sensor then calculate machine coordinate 3mm below that?
any help or guidance would be appreciated. very very new to python.
I would like some thoughts or help with a tool length macro that is slightly different to normal:
My machine has an ER collet system, so manual tool changes. I will have a tool height sensor fixed to the machine bed.
My tool height sensor has a max travel of 3mm and no overtravel contacts.
Either of two possible ways of working I would like:
1:
- M6 pauses program and prompts user to change tool
- user can then maually move tool to toolsetter location
- user manually moves Z axis until tool setter is detected then the macro will retract the tool and 'auto' measure from there.
- once tool length is measured retract Z completely and prompt user to resume program.
2:
- M6 pauses program and prompts user to change tool
- user can then manually move tool to toolsetter location (I prefer this as some tools have cutting edges off center, like a fly cutter)
- User can manually move Z to just above tool setter and press a 'probe' or 'start measure button' and the macro will move Z axis towards the tool setter but 0nly for 3mm if it does not trigger after 3mm then it lets user know it as failed. (this ensures it can never over travel)
- once tool length is measured successfully retract Z completely and prompt user to resume program.
I think option 2 is better suited to SimCNC?
I suspect i want to somehow use d.executeProbing with an incremental move rather than telling it to go to a machine co-ordinate
maybe it needs to save machine coordinate when user has positioned tool just above sensor then calculate machine coordinate 3mm below that?
any help or guidance would be appreciated. very very new to python.
Quote from erwan on 11 November 2023, 09:49you can use this m6
> it stop the gcode
> popup ask the new tool, pres okthe m6 stop the work here then
>set the tool on the machine
>prest the probing buton (you have to modify the probing.py for your 3mm safty and manual placement)
>pres play to star the g code again
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
d.stopTrajectory()
d.setGCodeNextLine()
you can use this m6
> it stop the gcode
> popup ask the new tool, pres ok
the m6 stop the work here then
>set the tool on the machine
>prest the probing buton (you have to modify the probing.py for your 3mm safty and manual placement)
>pres play to star the g code again
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
d.stopTrajectory()
d.setGCodeNextLine()
Quote from erwan on 11 November 2023, 16:15it's your lucky day. replace your probing.py by this one. it make a mesure any where you are . going down -3mm
can be modifed
https://github.com/erwan56450/SimCnC/blob/main/Prob/ManualPlacementProbing.py
it's your lucky day. replace your probing.py by this one. it make a mesure any where you are . going down -3mm
can be modifed
https://github.com/erwan56450/SimCnC/blob/main/Prob/ManualPlacementProbing.py
Quote from dylan1024 on 12 November 2023, 21:40Thanks erwan
your initial message sent me down the correct path, my probe macro, modified from standard ended up looking very similar to what you posted, just a bit messy 🙂
I have modified the M6 macro so that it still works if tool changes is input via the MDI:
if(d.getState( ) != State.Trajectory):
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
else:
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
d.stopTrajectory()
d.setGCodeNextLine()
Thanks erwan
your initial message sent me down the correct path, my probe macro, modified from standard ended up looking very similar to what you posted, just a bit messy 🙂
I have modified the M6 macro so that it still works if tool changes is input via the MDI:
if(d.getState( ) != State.Trajectory):
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
else:
d.setSpindleToolNumber(d.getSelectedToolNumber( ))
d.setToolOffsetNumber(d.getSelectedToolNumber( ))
tool = d.getSelectedToolNumber( )
print("load tool number = " + str(tool))
msg.info( "load tool number = " + str(tool), "Info" )
d.stopTrajectory()
d.setGCodeNextLine()
Quote from erwan on 12 November 2023, 22:14cool this code should work to
messy? 😉
d.setSpindleToolNumber(d.getSelectedToolNumber())
d.setToolOffsetNumber(d.getSelectedToolNumber())
tool = d.getSelectedToolNumber()
print("load tool number = " + str(tool))
msg.info("load tool number = " + str(tool), "Info")if d.getState() == State.Trajectory:
d.stopTrajectory()
d.setGCodeNextLine()
cool this code should work to
messy? 😉
d.setSpindleToolNumber(d.getSelectedToolNumber())
d.setToolOffsetNumber(d.getSelectedToolNumber())
tool = d.getSelectedToolNumber()
print("load tool number = " + str(tool))
msg.info("load tool number = " + str(tool), "Info")if d.getState() == State.Trajectory:
d.stopTrajectory()
d.setGCodeNextLine()
Quote from erwan on 7 January 2024, 19:27ey !!! do you try me probing macro?
If Yes
send a video if it work i will link it in the script
ey !!! do you try me probing macro?
If Yes
send a video if it work i will link it in the script