Author Topic: Parking Stall Lisp  (Read 5796 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Parking Stall Lisp
« on: June 24, 2004, 09:25:00 AM »
I didnt know if you new this... here is a lisp for creating parking stalls... whatever size you might want...

  (defun C:STALL90 ( / +pi/2 -pi/2 sc sw sl sxw st p1 p2 p3 p4 a d l hi bm)
      (setq +pi/2 '((a) (+ a (/ pi 2.0)))
            -pi/2 '((a) (- a (/ pi 2.0))))
      (initget 7)
      (setq sw (getdist "\nMinimum stall width: "))
      (setq sl (getdist "\nStall depth: "))
      (initget "Single Double")
      (setq st (cond ((getkword "Single- or Double-loaded <Double>: "))
                     (t "Double")))
      (initget "Entity")
      (setq p1 (cond ((getpoint "\nFirst alignment point/<Entity>: "))
                     (t "Entity")))
      (cond (  (eq p1 "Entity")
               (setq l (entsel "\nSelect line: "))
               (setq l (entget (car l)))
               (setq p1 (cdr (assoc 10 l))
                     p2 (cdr (assoc 11 l))))
            (t (setq p2 (getpoint p1 "\nSecond alignment point: "))))
      (cond (  (eq st "Single")
               (setq p3 (getpoint "\nWhich side of alignment: "))))
      (setq d (distance p1 p2))
      (setq a (angle p1 p2))
      (setq sc (fix (/ d sw)))
      (setq sxw (/ d sc))
      (if p3 (setq p4 (inters p1 p2 p3 (polar p3 (+pi/2 a) 1.0) nil)))
      (princ (strcat "\nDrawing "
                     (cond (p3 "") (t "2 x "))
                     (itoa sc) " stalls @ " (rtos sxw) " wide x "
                     (rtos sl) " deep."))
      (setvar "cmdecho" 0)
      (setq hi (getvar "highlight"))
      (setq bm (getvar "blipmode"))
      (setvar "highlight" 0)
      (setvar "blipmode" 0)
      (command ".line" p1 p2 "")
      (cond (p3 (command ".line" p1 (polar p1 (angle p4 p3) sl) ""))
            (t  (command ".line" (polar p1 (+pi/2 a) sl)
                                 (polar p1 (-pi/2 a) sl) "")))
      (command ".UCS" "Z" (* a (/ 180.0 pi))
               ".array" (entlast) "" "R" "1" (1+ sc) sxw
               ".UCS" "P"
      )
      (setvar "highlight" hi)
      (setvar "blipmode" bm)
      (princ)
  )
Civil3D 2020

Dent Cermak

  • Guest
Parking Stall Lisp
« Reply #1 on: June 25, 2004, 01:20:29 PM »
That's a cool lisp routine. What I usually do is use the 'divide" or "measure" routine for the same result.