waterjet pierce

Trying to get the following behavior:

Move to pierce height
Jet on
ramp from pierce height to cut height over leadin with leadin taking pierce delay time
continues cut at feed rate

This is a dynamic pierce

Currently getting:
Move to pierce height
jet on
lower to cut height at plunge feed rate
cut leadin at cuting feed rate



Attached are an example gcode file and post I am using. Maybe This isnt possible or I have something set wrong.
N0010 (Filename RARS_ELEC_PLATE_1_8.txt (2.97 KB)
LinuxCNC Waterjet TXRX 11-16-23.scpost (3.86 KB)

I noticed in the .scpost in OnPenDown() that the pierce delay has been commented out, so effectively zero seconds. Thus if you change the Leadin Type to Ramp (in the Tool def) doesn’t that give you the pierce outcome that you want ? If so, then you can either adjust plungeRate to suit the ramp-down time you want.
Or consider using this OnPenDown() function substitute in your .scpost to calculate a Ramp down feedrate based on pierceDelay value.

function OnPenDown()

   post.ModalText (" o<touchoff> call")
   post.Eol()

   post.ModalText (" G00")
   post.ModalNumber (" Z", pierceHeight * scale, "0.0000")
   post.Text ("\n M03 M07\n")

   if pierceDelay > 0 then      
      if leadinType ~= 0 then --assume this is a Ramp style leadin
         local rampDistance = math.abs(pierceHeight - cutHeight) * 1.414 -- 45deg ramp angle
         local rampSpeed = rampDistance / pierceDelay * 60  --speed in units/minute
         post.ModalNumber(" F", rampSpeed * scale, FRformat) --post Ramp speed to match pierceDelay 
            post.Text(" (overriding plungeRate of:")
            -- now ModalNumber() here will nullify posting the same value in OnMove() or OnArc() later
            post.ModalNumber(" F", plungeRate * scale, FRformat) 
            post.Text(" )\n")
      else
         post.NonModalNumber(" G04 P", pierceDelay, "0.##")
         post.Eol()
      end
   end
end

FRformat = "0.##"

corrected: ModalNumber()…
Also, ModalNumber() function is handy so that the same exact text (including format of number) is not posted twice on consecutive calls. So I use it in this case to post the real plungeRate as a comment after overriding it with the calculated plungeRate (rampSpeed). In order for this to work as planned, the ModalNumber(" F", … ) stmts in OnMove() and OnArc() must be exactly the same formatting text, so change those stmts to use global var FRformat (feedrate format) so they are sure to match. Notice OnMove() and OnArc() had been using differing " F" word formatting.

Just FYI. Per Les, the ramp lead always ramps at a 45 degree angle.