This Chapter shows how to extend Tcl/Tk commands to include your own. The example used here is based on PHIGS (Programmer's Hierarchical Interactive Graphics System) programming library for 3D graphics. The rationale behind this example is to include 3D drawing capabilities to Tk canvas with Tk handling all the input while PHIGS handles the 3D output.
If the reader already knows PHIGS, it is easy to understand the self-contained PHIGS procedures but the reader is not required to know PHIGS to understand how to register user commands with Tcl interpreter. You can either use the c routines as a unit or better still you can follow the relevant parts of Tcl/Tk and apply the methodology to a software package of your choice.
If you want to learn/use PHIGS, refer to Tom Gaskin's PHIGS Programming Manual which has examples showing the use of PHIGS with X Window System based toolkits.
Tcl/Tk scripts similar to ones described in earlier chapters are not explained again. If you are new to Tcl/Tk programming, you should at least read through previous chapters.