Torch height control during rapids

Having problems with or questions about SheetCam? Post them here.
Post Reply
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Torch height control during rapids

Post by David_Lelen01 »

Hey Les, I'm pretty sure this is going to be another "not possible" question (I seem to be pretty good at those lately), but my goal is to only output a torch height off M code in the output if the next rapid distance is greater than some predetermined value. When we cut a lot of holes in sheets with the laser, it causes a lot of unnecessary movement and slowdowns. Problem is, at the time of OnPenUp(), I don't know how to get the distance of the next rapid. endX and endY have not been updated at this point yet, so they are still the same as currentX and currentY. Is there anywhere to get the distance of the coming rapid from?

This is the code I currently have and found out the endX/Y are not updated:

Code: Select all

if (highSpeed == 1) then
	post.NonModalNumber("End X = ", endX * scale, "0.000#") --for debugging purposes
	post.NonModalNumber("End Y = ", endY * scale, "0.000#") --for debugging purposes
	post.NonModalNumber("Current X = ", currentX * scale, "0.000#") --for debugging purposes
	post.NonModalNumber("Current Y = ", currentY * scale, "0.000#") --for debugging purposes
	if ((math.sqrt((endX - currentX)^2+(endY - currentY)^2)) * scale > heightOffTol) then
		post.Text ("M199\n")
	end
else
	post.Text ("M199\n")
end
highSpeed is a boolean flag and heightOffTol is a decimal, both are custom post variables in the popup dialog.
User avatar
djreiswig
Posts: 484
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

Re: Torch height control during rapids

Post by djreiswig »

You would probably have to do the check in the OnRapid sub and output the M code before the rapid move.
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Re: Torch height control during rapids

Post by David_Lelen01 »

You would probably have to do the check in the OnRapid sub and output the M code before the rapid move.
I swear sometimes I should just dye my hair blonde. It didn't even remotely cross my mind to move that to the OnRapid function. Works like a champ, thanks!!
User avatar
djreiswig
Posts: 484
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

Re: Torch height control during rapids

Post by djreiswig »

:lol:
Post Reply