Drill a hole
DSL Function
DrawHole (InitX,InitY,InitZ,Height,Feedrate,dx)
Curry program for the DSL function

-----------------------------------------------------------------------------
------------- PERFORACION EN UN PUNTO ---------------------------
------------------------------------------------------------------------------

{-- FUNCION AUXILIAR --}
FAUX_DrawHole :: (Float, Float, Float, Float) -> IO()
FAUX_DrawHole(Height, Feedrate, halfdx, control) = do Draw

where
Draw = if ((Height >= control)&&((Height-.control) >= halfdx))||(Height==control)
then do
writefile(DrawZ(control,Feedrate))
FAUX_DrawHole(Height,Feedrate,halfdx,(control+.halfdx))
else
if ((Height >= control)&&((Height-.control) < halfdx))
then do --Se usa para compensar....
writefile(DrawZ(control,Feedrate))
FAUX_DrawHole(Height,Feedrate,halfdx,(control+.(Height-.control)))
else done

{-- FUNCION PRINCIPAL --}

-- Funcion Perforacion en un Punto X,Y
-- Indicar coordenadas X,Y,Z y profundidad Height, velocidad de corte Feedrate
-- y ancho de herramienta dx

DrawHole :: (Float,Float,Float,Float,Float,Float) -> IO()
DrawHole (InitX,InitY,InitZ,Height,Feedrate,dx) = do InitPOS
Perforate
-- Restore
where
InitPOS = writefile(GotoXYZ(InitX,InitY,InitZ))
-- Si el ancho de la herramienta es mayor que la profundidad
Perforate = if(Height<dx) then do
writefile(DrawZ(Height,Feedrate))
-- Si el ancho de la herramienta es menor que la profundidad
else do
FAUX_DrawHole(Height,Feedrate,(0.5*.dx),(0.5*.dx))
-- Restore = writefile(GotoZ(InitZ))

example figure