This routine from Jay Thomas is an excellent example of combining LISP code with a dialog box with graphics. Its purpose is to draw railing elevations in AutoCAD.
It includes four files that you must place in a directory that is included in the AutoCAD support file search path. After you have done that, load the LISP file and run the command REL to start. A dialog will appear in which you can specify the parameters of the railing segment. There is also a Help file that further explains the various parameters, although the image in the dialog does a pretty good job too. Layers required by the routine are created on the fly, and you can modify the code to make these fit your standards.