Box
DSL function
DrawBox (Initx, Inity, Initz, Length, Width, Height, Feed, dx)
Curry program for the DSL function

------------------------------------------------------------------------------
------------- CAJEADO RECTANGULAR --------------------------------
------------------------------------------------------------------------------
{-- La siguiente es una funcion auxiliar para el corte iterativo de la caja --}
FAUX_DrawBox :: (Float, Float, Float, Float, Float, Float) -> IO()
FAUX_DrawBox (Initx, Inity, Length, Width, Feed, dx) = do Draw

where
Draw = if (Length >= dx)
then do writefile(DrawXY(Initx +. Length, Inity, Feed)) -- Bottom
writefile(DrawXY(Initx +. Length, Inity +. Width, Feed)) -- Right
writefile(DrawXY(Initx, Inity +. Width, Feed)) -- Top
writefile(DrawXY (Initx,Inity, Feed)) -- Left
writefile([G "01", X (Initx+.dx), Y (Inity+.dx),F Feed])
FAUX_DrawBox(Initx +. dx, Inity +. dx, (Length -. dx)-.dx, (Width -. dx)-.dx, Feed, dx)
else done

{--DrawBottom= writefile(DrawXY(Initx +. Length, Inity, Feed))
DrawRight = writefile(DrawXY(Initx +. Length, Inity +. Width, Feed))
DrawTop = writefile(DrawXY(Initx, Inity +. Width, Feed))
DrawLeft = writefile(DrawXY (Initx,Inity, Feed))--}

-- Funcion para Generar un Cajeado Rectangular
-- La esquina inferior izquierda (x,y) que sera la posicion inicial.
-- Se debe indicar el ancho, largo y profundidad de corte del rectangulo.
-- dx es el ancho de la herramienta.
DrawBox :: (Float, Float, Float,Float, Float, Float, Float,Float) -> IO()
DrawBox (Initx, Inity, Initz, Length, Width, Height, Feed, dx) = do InitPos
Perforate
Draw
Restore

where
InitPos = writefile(GotoXYZ(Initx,Inity,Initz))
Perforate = writefile(DrawZ(Height+.Initz, 40.0))
Draw = FAUX_DrawBox (Initx, Inity, Length, Width, Feed, dx)
Restore = writefile(GotoZ(Initz))


example figure