#### The Rectangle

*The* rectangle is the easiest, since each axis of drawing follows the isometric axis. Isometric drawings use 30° parallel projection, meaning that unlike perspective drawing, objects along the same axis don’t convene at a point, but rather are parallel to one another. This preserves the dimensions of most of the shape, however there is no visible depth to the objects (see figure 1).

#### Developing the Geometry

*In* order to start building the rectangle, we need to establish a reference point, which we’ll then use to also be where the geometry is placed. We’ll call this point “p0” for convenience sake. We also need to know the length, width and height, which we’ll call “lx”, “wx” and “hx” respectively. It’s then just a matter of expressing the coordinates of the cube in two dimensions.

*Since* the lengths all stay the same, and the x and y axes are offset 120°, we can express each of the points of the prismatic rectangle on the regular x and y axis using trigonometry.

We then have to turn this into LISP code, which looks like this:

(setq l1(getdist "\n Length(inches):"))

(setq w1(getdist "\n Width(inches):"))

(setq h1(getdist "\n Height(inches):"))

(setq ptl1 (list (+ x1 (* (cos a1) l1)) (+ y1 (* (sin a1) l1)) 0))

(setq ptw1 (list (+ x1 (* (cos a2) w1)) (+ y1 (* (sin a2) w1)) 0))

(setq pth1 (list x1 (+ y1 h1) 0))

(setq pthw1 (list (car ptw1) (+ h1 (car(cdr ptw1))) 0))

(setq pthl1 (list (car ptl1) (+ h1 (car(cdr ptl1))) 0))

(setq ptlwh1 (list (+ (car ptl1) (* (cos a2) w1)) (+ (car(cdr pthl1)) (* (sin a2) w1)) 0))

(command "._line" pt1 pth1 "")

(command "._line" pt1 ptl1 "")

(command "._line" pt1 ptw1 "")

(command "._line" pth1 pthw1 "")

(command "._line" pth1 pthl1 "")

(command "._line" pthw1 ptlwh1 "")

(command "._line" pthl1 ptlwh1 "")

(command "._line" ptl1 pthl1 "")

(command "._line" ptw1 pthw1 "")

There! All done with that, on to the the next!

Tags: AutoCAD, AutoLISP, LISP