@Domenico,
Those coding examples all fail, because I am not familiar with MESHES and creation other than Polygon Meshes for which I've posted in DOWNLOAD section of cadtutor.net EDGENET routines...
If you don't mind, lisp version of 3D command exist in BricsCAD and I suppose in AutoCAD too... When started "3D", you'll choose what do you need among which you can find BOX as entity MESH...
Good luck,
happy coding...