My favorite programming accomplishment

One of the part-time jobs I held during college was AutoCAD technician at a small facilities management consulting firm. Our clients (mostly hospitals and universities) would give us blueprints of their buildings’ floor plans. My job was to tape the blueprints to a large digitizing tablet and essentially trace them to produce AutoCAD drawings. A consultant had usually already done a site visit and made notes on each room in the building — the type of room (e.g., an office or a classroom), the type of floor surface, and so forth. In addition to creating the drawings, I had to measure the area of each room and enter it, along with the consultant’s notes, into a database. The database had been integrated with AutoCAD so that you could invoke a popup window to enter new database records and edit existing records without leaving AutoCAD.1

The work required many mouse clicks, and we had a library of custom functions written in AutoLISP to reduce some of the overhead. I used a special multi-button mouse with the digitizer. The buttons were programmed to run common commands and functions so that you didn’t have to move the pointer to a toolbar button or switch over to the keyboard to type commands.

When the technician who had been maintaining the custom functions left the firm, my boss tapped me to take over that role in addition to my primary duties. I wasn’t a computer science major, but I had taken two introductory programming classes, and my computer skills were above average.2 I was a novice programmer at best, but my boss seemed to think I was qualified or at least had the capacity to become qualified. I had never seen any language except BASIC and Pascal before. AutoLISP, with its abundant parentheses, was confusing at first. Fortunately, AutoCAD came with good documentation, and the firm had subscriptions to two CAD magazines that contained AutoLISP tutorials and sample code. Eventually, I learned enough to start enhancing the existing functions and writing new ones.

My boss — one of the partners — was an industrial engineer by training, and he firmly believed that saving one or two seconds on a repeated task paid large dividends over the long term. His pet peeve was measuring area in AutoCAD. To measure the area of a shape in AutoCAD, you had to invoke the area command and then click each corner of the shape. It wasn’t a big deal in a small rectangular room, but in a large space or a space with a lot of corners, measuring the area required quite a bit of mouse movement across the digitizer. My boss frequently mentioned that his holy grail was a one-click area function — a function that would allow you to click once anywhere in a space and have AutoCAD calculate the area. He had wanted it for years, but none of the previous technicians had been able to crack it.

One day, I had an idea: I remembered (or perhaps had just discovered) that area is one of the properties of a hatch. (A hatch is a fill inside of a shape.) You could hatch a space in AutoCAD by clicking once anywhere inside of it, so I wrote a function that worked like this: When you clicked inside the space, it would automatically hatch the space, get the area of the hatch, and erase the hatch. It was kludgy and inelegant, and it didn’t work if the space contained an arc. Spaces with arcs weren’t that common, so it reduced measuring the area to one click for all but a few edge cases. (I never solved the arc problem.)

Since graduating from college, I’ve spent most of my career in IT, and I’ve written a lot of Python, SQL, JavaScript, shell scripts, and even some SAS in a professional capacity. That AutoLISP function is still my favorite programming accomplishment. It felt like a real achievement to work out the solution, implement it, and see the results. I’m certain it was the first time I automated anything, and I had to reluctantly admit that my boss was right about the benefit of saving a few seconds on a task you did dozens of times a day. The lesson stuck because I now find myself trying to automate almost any computing task if I do it more than twice.


  1. It must have been a relational database because I’m certain that’s where I learned my first SQL statement: SELECT * FROM table . I can’t remember the database management system or how it was integrated with AutoCAD, though. ↩︎

  2. During this era, resumes always included a “Computer Skills” section, which was little more than a list of software you had touched at least once. The longer the list, the more impressive it was, so people used to even list web browsers. To be fair, however, home computers were far from ubiquitous, and home internet access was even less common. Being a frequent internet user was reasonably noteworthy at the time. ↩︎