Making Isometric Drawings Using AutoLISP – Part 1 - Alex Sassoon

Making Isometric Drawings Using AutoLISP – Part 1

Posted on: August 4th, 2013 by amhsmc

I started creating isometric details in AutoCAD a while ago, and realized something I thought I already knew: AutoCAD sucks at 3D modeling. Isometric drawings are an effective way of representing 3D objects in 2D, and preserves dimensionality of the object. Unfortunately it turns out that while AutoCAD is perfectly capable of handling isometric drawings, it does so with a lot less thoughtfullness as I’d hope.
Creating isometric drawings means breaking up a workflow, which most people would say isn’t that big of a deal, but for anyone trying to work quickly and effectively, that’s a problem. It’s fine sticking to regular drawing when creating boxes, they’re simple enough. But circles and hexagons aren’t as easy. That’s why I decided to create an AutoLISP macro to do it for me.
Since I’m also fairly new to AutoCAD and AutoLISP, I decided to practice further by generating my own geometry and functions, rather than just switching between the two drawing methods with LISP. This allows me to get my own input and output options, which also speeds up the drawing process.
The following is the step by step process by which I made the macro and solved for the geometry mathematically.

Develop Input and Output Goals

Choosing your input how it’s asked for is key to a good function. Not only does it force you to start thinking about what variables you need, it also gets you thinking about the algorithm’s process and how it performs the calculations. First off I decided I wanted either a circle, rectangle, or hexagon, so I needed a snippet for that prompt. Next I wanted to put that object somewhere, so I needed to query for that as well. Then what do I want? For it to draw the shape of course! So here is the first iteration of what I want.
(defun C:myProg () ;defines the function in LISP
;query shape to build
;query starting point
;draw shape

The “draw shape” segment then expands into:
;if circle
;draw circle
;else if rectangle
;draw rectangle
;else if hexagon
;draw hexagon

And since each shape has different ways of measuring it, those need to be included to get the desired size. For circles I use the radius, rectangles the edge lengths, and hexagons the trade size (since they will be nuts and bolts). It’s very important to get an input that has meaningful bearing on your output, otherwise the program gets overly complicated.

;if circle
;query radius
;draw circle
;if rectangle
;query length, width, height
;draw rectangle
;if hexagon
;query trade size (diameter)
;draw hexagon

Now let’s solve for those shapes!


Tags: , ,

Comments are closed.

©2017 Alex Sassoon