Cut a rectangle
DSL function
DrawRectangle (Initx, Inity, Initz, Length, Width, Height, Feed, dx)
Curry program for the DSL function

------------------------------------------------------------------------------
------------- RECTANGULO -----------------------------------------------------
------------------------------------------------------------------------------

-- Funcion Para Dibujar un Rectangulo
-- La esquina inferior izquierda (x,y) que será la posicion inicial.
-- Se debe indicar el ancho, largo y profundidad de corte del rectangulo.
DrawRectangle :: (Float, Float, Float, Float, Float, Float, Float, Float) -> IO()
DrawRectangle (Initx, Inity, Initz, Length, Width, Height, Feed, dx) =
do InitPOS
DrawBottom
DrawRight
DrawTop
DrawLeft
Restore
where
InitPOS = writefile(GotoXYZ(Initx, Inity,Initz))
-- Perforate = DrawHole(Initx, Inity, Initz, Height, Feed, dx)
DrawBottom= DrawLine(Initx, Inity, Initz, Initx +. Length, Inity, Height, Feed, dx)
DrawRight = DrawLine(Initx +. Length, Inity, Initz, Initx +. Length, Inity +. Width, Height, Feed, dx)
DrawTop = DrawLine(Initx +. Length, Inity +. Width, Initz, Initx, Inity +. Width, Height, Feed, dx)
DrawLeft = DrawLine (Initx,Inity +. Width, Initz, Initx, Inity, Height, Feed, dx)
Restore = writefile(GotoZ(Initz))

example figure