From the chat...

dzach wrote: BTW there is this fine application, Therion[L1 ], that does cave mapping with tcl/tk.

From the web page:

Therion is a complete package which processes survey data and generates maps or 3D models of caves. It runs on wide variety of platforms: Linux, Windows, Mac OS X. It is completely free, released under the terms of GNU GPL, with source code available. It doesn't require any other commercial software to run.

Basic drawing instructions [L2 ]

...and an example of a map drawn with Therion:

[Category Application|Category Geography|Category (L)GPL Licensed]