Recreating the Star Wars opening crawl in AutoCAD using F# – Part 1

Happy New Year, everyone!

As mentioned in the last post, I took a couple of weeks off over the holiday period, extending Autodesk's annual "week of rest" between Christmas and New Year to a full fortnight.

This time of year clearly has religious significance for many. Some go to church, to temple or even to Stonehenge, some watch one or more of the Star Wars trilogies โ€“ arguably which they choose depends on how devout they are. I only ended up watching one Star Wars film, over the holiday period, and while it was from the Despecialized Edition, I don't necessarily consider myself a fundamentalist. ๐Ÿ˜‰

A sneak peek at the Star Wars opening crawl inside AutoCAD

I did spend some time on a Star Wars-related coding project, though. The project was initiated when I received notification, just before Christmas, that the long-awaited (by me, at least ๐Ÿ™‚ Star Wars API was available for Beta-testing. This is a Data-as-a-Service REST API that provides access to all manner of information about the various episodes in the Star Wars movie franchise, including which characters appeared in which film, the weapons and vehicles they used, etc.

I put on my thinking hat to see if there was some compelling way this API might be used inside AutoCAD. There are lots of CAD-centric allusions throughout the Star Wars movies  โ€“ Death Star plans, 3D targeting systems, etc. โ€“ and I felt that for sure there was some fun to be had with it. In the end I settled on using AutoCAD to recreate the famous opening crawl.

Here's the original opening crawl from the 1977 version of Star Wars episode IV, for context:

There are a few components to the opening crawl that we're going to recreate inside AutoCAD over the course of this week. This page was helpful when looking at the specifics of how to implement some of these items.

  1. The initial blue text
  2. The theme music
  3. The star field
  4. The disappearing Star Wars logo
  5. The crawling text

We'll actually only be using the Star Wars API to retrieve the opening crawl text for step 5, as the command we end up implementing will create a crawl for each of the episodes covered by the API (which means I-VI at the time of writing, but also for VII once released in December 2015).

To access the Star Wars API, we'll once again use the F# Type Provider mechanism for this, just as we used it with Typepad in this recent post. That's actually the main reason for using F# for this project, to see how it simplifies access to DaaS APIs. At some point I may well throw together a C# version of this code, but we'll see: the AutoCAD-centric API calls should be relevant to anyone using AutoCAD's .NET API from another language, of course.

In the next post we'll take a look at knocking off the first few items from the above list.

2 responses to “Recreating the Star Wars opening crawl in AutoCAD using F# – Part 1”

  1. Hi Kean,
    I love Star wars too, especially that part about ludicrous speed and the luggage combination ๐Ÿ™‚
    I did not read your code yet, but the whole idea of showing text on the screen as an interface, rather than on command line or cursur area, is vastly underutilized IMO. Autodesk is starting to do fancier stuff with grips and little things in Civil3D, but not anything like it could.
    I am thinking heads up display type info. At our company, the startup checks for excess app ids and displays a big message using grdraw, to clean the dwg. Its harmless and does not interrupt scripts like a dialog might. We also use grdraw for showing info on a given road or pipe alignment, when doing something on it. Civil3D has the feature line object, which is a polyline with a profile, but we have tools that hook our shared alignments with a pline, so you can edit the profile in plan view. It helps to have info like start and end station shown in plan view along the pline, as well as several other things. I am trying to switch to transients for this, but working through some issues on it, its the same idea though. Users like it a lot and constantly ask me for more info shown.

    1. Interesting. Thanks for sharing, James.

      Kean

Leave a Reply to James Maeding Cancel reply

Your email address will not be published. Required fields are marked *