Eamon Kelly - Roller Coaster Design

Discovering the Thrill of Engineering Thrills

Project Experience

Lost in Stupid Parentheses

Posted by Eamon Kelly on August 5, 2010 at 1:26 PM

So lately I've been working in AutoCAD and have starting learning both it and the programming language it uses, AutoLISP.  First, I'll clarify the title of this post by explaining a little bit about LISP.  LISP actually stands for LISt Processing becuase it uses lists as a data structure.  It has been dubbed "lost in stupid parentheses" because everything needs to be enclosed in parentheses.  For example, to add 1 and 1, you would write (+ 1 1).  You'll notice the other thing that can be a pain in LISP is that operators (addition, subtraction, etc) come first.  This isn't a problem when you've only got one operation occurring, but quickly becomes a nightmare once you attempt multiple operations at once.  For example, (+ (- (/ 6 2) (* 1 8 ) ) 7) will divide 6 by 2, subtract the multiplication of 8 and 1 from that, and then add seven.  Because of the parentheses, it is easy to make mistakes and become lost.

But enough complaining.  The cool thing about LISP is that it can be used to execute commands in AutoCAD.  Instead of clicking the 'line' button, and then specifying two points, I can use code to virtually click the line button and draw a line from two data points, instead of doing it manually with my hand and mouse.  Drawing lines is also the focus of this post.  I have written a couple programs that draw bents (the vertical support structures placed along the direction of travel in wooden roller coasters) as a bunch of lines.  The first program I wrote asks for a height, and then draws the bent.

The box is called Dialog Control Language, and can be used in LISP to make, well, boxes.  I messed around with it a little but probably won't get into it unless I make one for the final program.  When I hit okay, I get the following:

So as you can see, it will automatically draw me a bent of whatever height I need.  Next I added in the ability to draw multiple bents, where the program asks for how many the user needs, and then just runs through the bentgen code that many times, increasing the y values to space the bents out.  After that, I decided to try and pull data from my MatLab code to start making something that resembles a coaster.  I am still working out a lot of kinks, but I did manage to get it to draw up all the bents for the lift hill from the previous post's MatLab code.  Here is a video of the resulting lines:

You need Adobe Flash Player to view this content.

As you can see, it actually looks like the structure of a wooden roller coaster.  As I said, I will continue to go through and do most of what the final code will be with just lines, including batters (sloped supports) and other elements of the structure, pulling data from my MatLab code.  This will help me learn better how to use AutoCAD and AutoLISP and the resulting code will allow me to quickly visualize my layouts from MatLab.  That is all for now, but look forward to learning more about getting lost in parentheses... it's pretty much a given at this point that it will happen a lot.

Categories: Roller Coaster Design Project

Post a Comment


Oops, you forgot something.


The words you entered did not match the given text. Please try again.

Already a member? Sign In


Reply Nick
4:59 PM on August 5, 2010 
I've been trying to think of a similar method to use in Catia.
Reply Eamon Kelly
6:11 PM on August 5, 2010 
Looks like Catia uses Visual Basic, which seems to be the case with most 3D modeling software. I've never used VB before, though I do plan on learning it.
Reply Nick
7:58 PM on August 5, 2010 
Another method in Catia for a steel coaster could be to use the Power Copy feature. The diameter of the steel tube supports and the length could be user input parameters.
Reply Eamon Kelly
8:10 PM on August 5, 2010 
I've never used Catia, so I have no idea lol. I was going to attempt VB programming in Inventor but decided AutoCAD first, so it'll be a while before I tackle that beast. I was thinking there would be a way to make a center line and extrude the circle along that path. If it can take the data points this would be rather easy to model. (for steel running rails).

For supports you could easily write code where the length/height is user input and the rest is automatic. Wouldn't be very hard (at least I don't think it would be).