fbpx

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! 

 

Please or Register to create posts and topics.

help with a tool length macro

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.

 

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()

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

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()

erwan has reacted to this post.
erwan

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()

ey !!! do you try me probing macro?

If Yes
send a video if it work i will link it in the script

PARTNERS:

 

USA

Germany

Slovenia / Bosnia

Spain

South Africa

UNI-CAM

The Netherlands

Portugal

Greece

  Distrib milionis logo

Hungary

Distrib logot

Bulgaria

Master

Kenya

Proteq Automation

Egypt

Germanelectronix

China

Jun Ma

Serbia

ALCO

Italy

LVL tech r

Denmark

Varntoft Dania

Finland

×

Hello!

Click one of our contacts below to chat on WhatsApp

× How can I help you?