Advertisement
Guest User

Untitled

a guest
Dec 4th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun c:lab23(/ const conBot conTop con1 con2 con3 con4 cilC cilTop cilTop1 cil1 cil2 cil3 angles R RTemp RUCon RUConTop x y z temp i cilBot uConBot uConTop uConTop1 uConC uCon1 uCon2 uCon3)
  2.   (setq conTop (getpoint "Укажите вершину")
  3.     x (nth 0 conTop)
  4.     y (nth 1 conTop)
  5.     z (nth 2 conTop)
  6.     const 100
  7.   )
  8.   (setvar "osmode" 0)
  9.   (setq angles
  10.      (list 0 (/ pi 10) (/ pi 5) (* (/ pi 10) 3) (* (/ pi 5) 2) (/ pi 2) (* (/ pi 5) 3) (* (/ pi 10) 7) (* (/ pi 5) 4) (* (/ pi 10) 9) pi
  11.            (+ pi (/ pi 10)) (+ pi (/ pi 5)) (+ pi (* (/ pi 10) 3)) (+ pi (* (/ pi 5) 2)) (+ pi (/ pi 2)) (+ pi (* (/ pi 5) 3))
  12.            (+ pi(* (/ pi 10) 7)) (+ pi (* (/ pi 5) 4)) (+ pi (* (/ pi 10) 9))))
  13.   (foreach n angles
  14.     (setq conBot (append conBot (list (list (+ x const) (+ y (* const (cos n))) (+ z (* const (sin n))))))))
  15.   (setq R (/ const 2))
  16.   ;;;Отрисовка конуса
  17.   (foreach point conBot
  18.     (if (/= point (car conBot)) (command "_line" temp point ""))
  19.     (setq temp point))
  20.   (command "_line" temp (car conBot) "")
  21.   (foreach point conBot
  22.     (command "_line" point conTop ""))
  23.   (foreach n angles
  24.     (setq con1 (append con1 (list (list (+ x R) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
  25.   (foreach point con1
  26.     (if (/= point (car con1)) (command "_line" temp point ""))
  27.     (setq temp point))
  28.   (command "_line" temp (car con1) "")
  29.   (setq RTemp (* R 1.5))
  30.   (foreach n angles
  31.     (setq con2 (append con2 (list (list (+ x RTemp) (+ y (* RTemp (cos n))) (+ z (* RTemp (sin n))))))))
  32.   (foreach point con2
  33.     (if (/= point (car con2)) (command "_line" temp point ""))
  34.     (setq temp point))
  35.   (command "_line" temp (car con2) "")
  36.   (setq RTemp (/ R 2))
  37.   (foreach n angles
  38.     (setq con3 (append con3 (list (list (+ x RTemp) (+ y (* RTemp (cos n))) (+ z (* RTemp (sin n))))))))
  39.   (foreach point con3
  40.     (if (/= point (car con3)) (command "_line" temp point ""))
  41.     (setq temp point))
  42.   (command "_line" temp (car con3) "")
  43.   ;;;Конец отрисовки конуса
  44.   (setq R (* const 2))
  45.   ;;;Отрисовка цилиндра
  46.   (setq cilC (list (+ x const) y z)
  47.     x (nth 0 cilC)
  48.     y (nth 1 cilC)
  49.     z (nth 2 cilC))
  50.   (foreach n angles
  51.     (setq cilTop (append cilTop (list (list x (+ y (* R (cos n))) (+ z (* R (sin n))))))))
  52.   (foreach point cilTop
  53.     (if (/= point (car cilTop)) (command "_line" temp point ""))
  54.     (setq temp point))
  55.   (command "_line" temp (car cilTop) "")
  56.   (setq i 0)
  57.   (while (< i 20)
  58.     (command "_line" (nth i cilTop) (nth i conBot) "")
  59.     (setq i (1+ i)))
  60.   (foreach n angles
  61.     (setq cilTop1 (append cilTop1 (list (list x (+ y (* (* const 1.5) (cos n))) (+ z (* (* const 1.5) (sin n))))))))
  62.   (foreach point cilTop1
  63.     (if (/= point (car cilTop1)) (command "_line" temp point ""))
  64.     (setq temp point))
  65.   (command "_line" temp (car cilTop1) "")
  66.   (foreach n angles
  67.     (setq cil1 (append cil1 (list (list (+ x const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
  68.   (foreach point cil1
  69.     (if (/= point (car cil1)) (command "_line" temp point ""))
  70.     (setq temp point))
  71.   (command "_line" temp (car cil1) "")
  72.   (foreach n angles
  73.     (setq cil2 (append cil2 (list (list (+ x const const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
  74.   (foreach point cil2
  75.     (if (/= point (car cil2)) (command "_line" temp point ""))
  76.     (setq temp point))
  77.   (command "_line" temp (car cil2) "")
  78.   (foreach n angles
  79.     (setq cil3 (append cil3 (list (list (+ x const const const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
  80.   (foreach point cil3
  81.     (if (/= point (car cil3)) (command "_line" temp point ""))
  82.     (setq temp point))
  83.   (command "_line" temp (car cil3) "")
  84.   (foreach point cilTop
  85.     (setq cilBot (append cilBot (list (list (+ (nth 0 point) (* 4 const)) (nth 1 point) (nth 2 point))))))
  86.   (foreach point cilBot
  87.     (if (/= point (car cilBot)) (command "_line" temp point ""))
  88.     (setq temp point))
  89.   (command "_line" temp (car cilBot) "")
  90.   (setq i 0)
  91.   (while (< i 20)
  92.     (command "_line" (nth i cilTop) (nth i cilBot) "")
  93.     (setq i (1+ i)))
  94.   ;;;Конец отрисовки цилиндра
  95.   (setq RUCon (* const 1.5))
  96.   ;;;Отрисовка усеченного конуса
  97.   (foreach n angles
  98.     (setq uConBot (append uConBot (list (list (+ x (* 4 const)) (+ y (* RUCon (cos n))) (+ z (* RUCon (sin n))))))))
  99.   (foreach point uConBot
  100.     (if (/= point (car uConBot)) (command "_line" temp point ""))
  101.     (setq temp point))
  102.   (command "_line" temp (car uConBot) "")
  103.   (setq i 0)
  104.   (while (< i 20)
  105.     (command "_line" (nth i uConBot) (nth i cilBot) "")
  106.     (setq i (1+ i)))
  107.   (setq RUConTop (/ RUCon 2))
  108.   (foreach n angles
  109.     (setq uConTop (append uConTop (list (list (+ x (* 2 const)) (+ y (* RUConTop (cos n))) (+ z (* RUConTop (sin n))))))))
  110.   (foreach point uConTop
  111.     (if (/= point (car uConTop)) (command "_line" temp point ""))
  112.     (setq temp point))
  113.   (command "_line" temp (car uConTop) "")
  114.   (setq i 0)
  115.   (while (< i 20)
  116.     (command "_line" (nth i uConBot) (nth i uConTop) "")
  117.     (setq i (1+ i)))
  118.   (setq uConC (list (+ x (* 2 const)) y z))
  119.   (setq i 0)
  120.   (while (< i 20)
  121.     (command "_line" uConC (nth i uConTop) "")
  122.     (setq i (1+ i)))
  123.   (foreach n angles
  124.     (setq uConTop1 (append uConTop1 (list (list (+ x (* 2 const)) (+ y (* (/ RUConTop 2) (cos n))) (+ z (* (/ RUConTop 2) (sin n))))))))
  125.   (foreach point uConTop1
  126.     (if (/= point (car uConTop1)) (command "_line" temp point ""))
  127.     (setq temp point))
  128.   (command "_line" temp (car uConTop1) "")
  129.   (foreach n angles
  130.     (setq uCon1 (append uCon1 (list (list (+ x (* 3 const)) (+ y (* (/ RUCon 1.34) (cos n))) (+ z (* (/ RUCon 1.34) (sin n))))))))
  131.   (foreach point uCon1
  132.     (if (/= point (car uCon1)) (command "_line" temp point ""))
  133.     (setq temp point))
  134.   (command "_line" temp (car uCon1) "")
  135.   (foreach n angles
  136.     (setq uCon2 (append uCon2 (list (list (+ x (* 2.5 const)) (+ y (* 0.83 (/ RUCon 1.34) (cos n))) (+ z (* 0.83 (/ RUCon 1.34) (sin n))))))))
  137.   (foreach point uCon2
  138.     (if (/= point (car uCon2)) (command "_line" temp point ""))
  139.     (setq temp point))
  140.   (command "_line" temp (car uCon2) "")
  141.   (foreach n angles
  142.     (setq uCon3 (append uCon3 (list (list (+ x (* 3.5 const)) (+ y (* 1.17 (/ RUCon 1.34) (cos n))) (+ z (* 1.17 (/ RUCon 1.34) (sin n))))))))
  143.   (foreach point uCon3
  144.     (if (/= point (car uCon3)) (command "_line" temp point ""))
  145.     (setq temp point))
  146.   (command "_line" temp (car uCon3) "")
  147.   ;;;Конец отрисовки усеченного конуса
  148.   (princ)
  149. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement