Author Topic: Perforated Pan  (Read 1382 times)

0 Members and 1 Guest are viewing this topic.

David Bethel

  • Swamp Rat
  • Posts: 656
Perforated Pan
« on: May 01, 2010, 04:10:55 PM »


Had to redo a perforated pan routine today.  Needed a break so I figured I'd post here and break the day up a bit.  Made the holes diamond shape to infer round holes.  Lazy on my part and but really need small file sizes )

Code: [Select]
;++++++++++++ Make The Perforated False Pan +++++++++++++++++++++++++++
;;;ARG -> Xwidth YDepth Inpoint
(defun ppf_perf (x y i / xq xs xh xp yq ys yh yp bn)

(entmake (list (cons 0 "BLOCK")(cons 2 "*U")(list 10 0 0 0)(cons 70 1)))
(entmake (list (cons 0 "LINE")(cons 8 "3D")(cons 39 -1)(cons 10 (list 0 y 0))(cons 11 (list 0 0 0))))
(entmake (list (cons 0 "LINE")(cons 8 "3D")(cons 39 -1)(cons 10 (list x y 0))(cons 11 (list 0 y 0))))
(entmake (list (cons 0 "LINE")(cons 8 "3D")(cons 39 -1)(cons 10 (list x 0 0))(cons 11 (list x y 0))))
(entmake (list (cons 0 "LINE")(cons 8 "3D")(cons 39 -1)(cons 10 (list 0 0 0))(cons 11 (list x 0 0))))

(setq xq (fix (/ x 2))
      xs (/ x xq)
      yq (fix (/ y 2))
      ys (/ y yq)
      xh (* xs 0.5)
      yh (* ys 0.5))

(setq xp (* xs 0.5)
      yp (* ys 0.5))

(repeat xq
  (setq yp (* ys 0.5))
  (repeat yq

     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp (- xh)) (+ yp 0) 0))(cons 11 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 12 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 13 (list (+ xp (- xh)) (+ yp (+ yh)) 0))(cons 70 13)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 11 (list (+ xp (+ xh)) (+ yp (+ yh)) 0))(cons 12 (list (+ xp (- xh)) (+ yp (+ yh)) 0))(cons 13 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 70 15)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 11 (list (+ xp (- xh)) (+ yp (+ yh)) 0))(cons 12 (list (+ xp (- xh)) (+ yp (- yh)) 0))(cons 13 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 70 15)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp 0) (+ yp (- yh)) 0))(cons 11 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 12 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 13 (list (+ xp (- xh)) (+ yp (- yh)) 0))(cons 70 13)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 11 (list (+ xp (- xh)) (+ yp (- yh)) 0))(cons 12 (list (+ xp (+ xh)) (+ yp (- yh)) 0))(cons 13 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 70 15)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp (+ xh)) (+ yp 0) 0))(cons 11 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 12 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 13 (list (+ xp (+ xh)) (+ yp (- yh)) 0))(cons 70 13)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 11 (list (+ xp (+ xh)) (+ yp (- yh)) 0))(cons 12 (list (+ xp (+ xh)) (+ yp (+ yh)) 0))(cons 13 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 70 15)))
     (entmake (list (cons 0 "3DFACE")(cons 8 "3D")(cons 10 (list (+ xp 0) (+ yp (+ yh)) 0))(cons 11 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 12 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 13 (list (+ xp (+ xh)) (+ yp (+ yh)) 0))(cons 70 13)))

;     (entmake (list (cons 0 "3DFACE")(cons 8 "3D-BLACK")(cons 10 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 11 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 12 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 13 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 70 0)))

     (entmake (list (cons 0 "LINE")(cons 8 "2D")(cons 10 (list (+ xp 0) (+ yp -0.70710678) 0))(cons 11 (list (+ xp 0.70710678) (+ yp 0) 0))))
     (entmake (list (cons 0 "LINE")(cons 8 "2D")(cons 10 (list (+ xp 0.70710678) (+ yp 0) 0))(cons 11 (list (+ xp 0) (+ yp 0.70710678) 0))))
     (entmake (list (cons 0 "LINE")(cons 8 "2D")(cons 10 (list (+ xp 0) (+ yp 0.70710678) 0))(cons 11 (list (+ xp -0.70710678) (+ yp 0) 0))))
     (entmake (list (cons 0 "LINE")(cons 8 "2D")(cons 10 (list (+ xp -0.70710678) (+ yp 0) 0))(cons 11 (list (+ xp 0) (+ yp -0.70710678) 0))))

     (setq yp (+ yp ys)))
 (setq xp (+ xp xs)))

(entmake (list (cons 0 "LINE")(cons 8 "1D")(cons 10 (list 0 y 0))(cons 11 (list 0 0 0))))
(entmake (list (cons 0 "LINE")(cons 8 "1D")(cons 10 (list x y 0))(cons 11 (list 0 y 0))))
(entmake (list (cons 0 "LINE")(cons 8 "1D")(cons 10 (list x 0 0))(cons 11 (list x y 0))))
(entmake (list (cons 0 "LINE")(cons 8 "1D")(cons 10 (list 0 0 0))(cons 11 (list x 0 0))))

(setq bn (entmake (list (cons 0 "ENDBLK")(cons 8 "0"))))
(entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 8 "0")(cons 10 i))))

;++++++++++++ Get The User Inputs +++++++++++++++++++++++++++++++++++++
(defun c:perfpan (/ x y ip el)

  (initget 7)
  (setq x (getdist "\nX Width S-S:   "))

  (initget 7)
  (setq y (getdist "\nY Depth F-B:    "))

  (initget 1)
  (setq ip (getpoint "\nInsert Point:   " ))

  (initget 6)
  (setq el (getdist (strcat "\nSurface Elevation <" (rtos (getvar "ELEVATION") 2 2)">:   ")))
  (or el (setq el (getvar "ELEVATION")))

  (ppf_perf x y (list (car ip) (cadr ip) el))

  (prin1))

-David
R12 Dos - A2K