Hey everybody!
I'm having a problem with my code because of the cond's.
I want that in the change question leads me to drawing the spiral but i can't do it...
What should i do?
(alert "To run type: Tatlin")
(defun c:spiral0 ()
(command "layer" "new" "spiral0" "color" "53" "spiral0" "")
(c:despiral)
) ; end defun
(defun c:despiral(param)()
(setq selec (entsel "Click in the solid where you want to draw the spiral:"))
(setq spin -1); -1=CW, 1=CCW
(setq ri (car param) rf (cadr param))
(setq h (nth 2 param))
(initget (+ 1 2 4))
(setq ns (getint "number of spirals:" ))
(setq tu (getreal "Number of turns: "))
(setq rt (getreal "extrusion radius: "))
(setq segs (nth 3 param))
(setq old (getvar "osmode"))
(setvar "cmdecho" 0)
(setq fi1 (/ (* 2 PI) segs) i 0)
(setq points (fix (* tu segs))
h1 (/ h points)
r1 (/ (- rf ri) points)
s (last param)
) ;end setq
(setvar "osmode" 0 )
(command "3dpoly")
(setq i 0)
(repeat (1+ points)
(setq fi (* i fi1) h (* i h1) r (+ ri (* i r1)))
(setq x (* r (cos fi)) y (* spin r (sin fi)))
(command (list (+ (car s) x) (+ (cadr s) y) (+ (caddr s) h)))
(setq i (1+ i)))
(command "")
(setvar "osmode" old)
(setq spiral (entlast))
(command "ucs" "n" "za" (polar s 0 ri)
(list
(+(car s) (* ri (cos fi1)))
(+(cadr s) (* spin ri (sin fi1)))h1))
(command "circle" "0,0,0" rt)
(command "extrude" (entlast) "" "p" spiral)
(setvar "osmode" old)
(command "ucs" "p")
(command "array" (entlast) "" "p" s ns 360 "y")
(c:spiral0)
) ; end defun despiral
;;; Transformation question
(defun c:Question ()
(command "zoom" "e")
(setq answer (getstring "\n (c)hange ,e(x)it ou (r)estart?: "))
(while (and (/= answer "c")
(/= answer "x")
(/= answer "r")
) ; and
(setq answer (getstring
"Only c,x ou r!: "
) ; getstring
) ; setq
) ;while
(cond
((= answer "c")(c:spiral))
((= answer "x"))
((= answer "r")(c:restart))
)
); defun
(defun c:solid ()
(setq r1 (getdist "\n larger radius: ")
r2 (getdist "\n smaller radius: ")
h (getdist "\n height: ")
sides (getint "\n number of polygon sides: ")
centerpt (getpoint "\n insertion point: ")
osnaps (getvar "osmode")
ang (atan (* (/ (- r1 r2) h) (cos (/ PI sides))))
) ; end setq
(setvar "osmode" 0)
(command "polygon"
sides
centerpt
"I"
(polar centerpt 0 r1)
)
(command "extrude" (entlast) "" h (/ (* ang 180.0) pi ))
(setvar "osmode" osnaps)
(list r1 r2 h sides centerpt)
(command "zoom" "ex")
(c:Question)
) ;end defun solid
;;; initial function
(defun c:Tatlin ()
(c:solid)
) ;defun
Thanks