Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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)
- (setq conTop (getpoint "Укажите вершину")
- x (nth 0 conTop)
- y (nth 1 conTop)
- z (nth 2 conTop)
- const 100
- )
- (setvar "osmode" 0)
- (setq angles
- (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
- (+ pi (/ pi 10)) (+ pi (/ pi 5)) (+ pi (* (/ pi 10) 3)) (+ pi (* (/ pi 5) 2)) (+ pi (/ pi 2)) (+ pi (* (/ pi 5) 3))
- (+ pi(* (/ pi 10) 7)) (+ pi (* (/ pi 5) 4)) (+ pi (* (/ pi 10) 9))))
- (foreach n angles
- (setq conBot (append conBot (list (list (+ x const) (+ y (* const (cos n))) (+ z (* const (sin n))))))))
- (setq R (/ const 2))
- ;;;Отрисовка конуса
- (foreach point conBot
- (if (/= point (car conBot)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car conBot) "")
- (foreach point conBot
- (command "_line" point conTop ""))
- (foreach n angles
- (setq con1 (append con1 (list (list (+ x R) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
- (foreach point con1
- (if (/= point (car con1)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car con1) "")
- (setq RTemp (* R 1.5))
- (foreach n angles
- (setq con2 (append con2 (list (list (+ x RTemp) (+ y (* RTemp (cos n))) (+ z (* RTemp (sin n))))))))
- (foreach point con2
- (if (/= point (car con2)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car con2) "")
- (setq RTemp (/ R 2))
- (foreach n angles
- (setq con3 (append con3 (list (list (+ x RTemp) (+ y (* RTemp (cos n))) (+ z (* RTemp (sin n))))))))
- (foreach point con3
- (if (/= point (car con3)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car con3) "")
- ;;;Конец отрисовки конуса
- (setq R (* const 2))
- ;;;Отрисовка цилиндра
- (setq cilC (list (+ x const) y z)
- x (nth 0 cilC)
- y (nth 1 cilC)
- z (nth 2 cilC))
- (foreach n angles
- (setq cilTop (append cilTop (list (list x (+ y (* R (cos n))) (+ z (* R (sin n))))))))
- (foreach point cilTop
- (if (/= point (car cilTop)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cilTop) "")
- (setq i 0)
- (while (< i 20)
- (command "_line" (nth i cilTop) (nth i conBot) "")
- (setq i (1+ i)))
- (foreach n angles
- (setq cilTop1 (append cilTop1 (list (list x (+ y (* (* const 1.5) (cos n))) (+ z (* (* const 1.5) (sin n))))))))
- (foreach point cilTop1
- (if (/= point (car cilTop1)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cilTop1) "")
- (foreach n angles
- (setq cil1 (append cil1 (list (list (+ x const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
- (foreach point cil1
- (if (/= point (car cil1)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cil1) "")
- (foreach n angles
- (setq cil2 (append cil2 (list (list (+ x const const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
- (foreach point cil2
- (if (/= point (car cil2)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cil2) "")
- (foreach n angles
- (setq cil3 (append cil3 (list (list (+ x const const const) (+ y (* R (cos n))) (+ z (* R (sin n))))))))
- (foreach point cil3
- (if (/= point (car cil3)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cil3) "")
- (foreach point cilTop
- (setq cilBot (append cilBot (list (list (+ (nth 0 point) (* 4 const)) (nth 1 point) (nth 2 point))))))
- (foreach point cilBot
- (if (/= point (car cilBot)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car cilBot) "")
- (setq i 0)
- (while (< i 20)
- (command "_line" (nth i cilTop) (nth i cilBot) "")
- (setq i (1+ i)))
- ;;;Конец отрисовки цилиндра
- (setq RUCon (* const 1.5))
- ;;;Отрисовка усеченного конуса
- (foreach n angles
- (setq uConBot (append uConBot (list (list (+ x (* 4 const)) (+ y (* RUCon (cos n))) (+ z (* RUCon (sin n))))))))
- (foreach point uConBot
- (if (/= point (car uConBot)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uConBot) "")
- (setq i 0)
- (while (< i 20)
- (command "_line" (nth i uConBot) (nth i cilBot) "")
- (setq i (1+ i)))
- (setq RUConTop (/ RUCon 2))
- (foreach n angles
- (setq uConTop (append uConTop (list (list (+ x (* 2 const)) (+ y (* RUConTop (cos n))) (+ z (* RUConTop (sin n))))))))
- (foreach point uConTop
- (if (/= point (car uConTop)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uConTop) "")
- (setq i 0)
- (while (< i 20)
- (command "_line" (nth i uConBot) (nth i uConTop) "")
- (setq i (1+ i)))
- (setq uConC (list (+ x (* 2 const)) y z))
- (setq i 0)
- (while (< i 20)
- (command "_line" uConC (nth i uConTop) "")
- (setq i (1+ i)))
- (foreach n angles
- (setq uConTop1 (append uConTop1 (list (list (+ x (* 2 const)) (+ y (* (/ RUConTop 2) (cos n))) (+ z (* (/ RUConTop 2) (sin n))))))))
- (foreach point uConTop1
- (if (/= point (car uConTop1)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uConTop1) "")
- (foreach n angles
- (setq uCon1 (append uCon1 (list (list (+ x (* 3 const)) (+ y (* (/ RUCon 1.34) (cos n))) (+ z (* (/ RUCon 1.34) (sin n))))))))
- (foreach point uCon1
- (if (/= point (car uCon1)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uCon1) "")
- (foreach n angles
- (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))))))))
- (foreach point uCon2
- (if (/= point (car uCon2)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uCon2) "")
- (foreach n angles
- (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))))))))
- (foreach point uCon3
- (if (/= point (car uCon3)) (command "_line" temp point ""))
- (setq temp point))
- (command "_line" temp (car uCon3) "")
- ;;;Конец отрисовки усеченного конуса
- (princ)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement