How to revised z value

Discussion in 'AutoCAD' started by Adesu, Mar 21, 2005.

  1. Adesu

    Adesu Guest

    How to revised z value in order to same result with pit (pitch),at the end
    tested for one segment
    ----------------------------------------------<snip>----------------
    32 = (-3.21394 3.83022 275.02)
    33 = (-2.5 4.33013 283.614)
    34 = (-1.7101 4.69846 292.208)
    35 = (-0.868241 4.92404 300.803) >>>I want as like this 35 = (-0.868241
    4.92404 1.5)
    _$

    (defun c:ch (/ seg ang cnt rad pit ele x y z point)
    (setq seg 36)
    (setq ang (/ (* 2 Pi) seg)) ; (* 2 pi) = 360
    (setq cnt 0)
    (setq rad 5) ; (setq rad (getdist "\nENTER
    NEW RADIUS: "))
    (setq pit 1.5) ; (setq rad (getdist "\nENTER
    NEW PITCH: "))
    (setq ele (/ pit ang))
    ;(command "3dpoly")
    (repeat seg
    (setq x (* rad (sin (* cnt ang))))
    (setq y (* rad (cos (* cnt ang))))
    (setq z (* cnt ele)) ; the problem here
    !!!
    (setq point (list x y z))
    ;(command point)
    (princ "\n")(princ cnt)(princ " = ")(princ point)
    (setq cnt (1+ cnt))
    )
    ;(command "")
    (setq cnt nil)
    (princ)
    )
     
    Adesu, Mar 21, 2005
    #1
  2. Adesu

    Adesu Guest

    Hi,.... I've got ,and but I got problem to found length of coil (or z
    value),how to find it

    (defun c:ch (/ seg ang cnt rad pit ele x y z point)
    (setq seg 36)
    (setq ang (/ (* 2 Pi) seg)) ; (* 2 pi) = 360
    (setq cnt 0)
    (setq rad 5) ; (getdist "\nENTER NEW RADIUS:
    "))
    (setq pit 1.5) ; (getdist "\nENTER NEW PITCH:
    "))
    (setq num 36) ; (getdist "\nENTER NUMBER OF
    COIL: "))
    (command "3dpoly")
    (repeat (+ 1 num)
    (setq x (* rad (sin (* cnt ang))))
    (setq y (* rad (cos (* cnt ang))))
    (setq z (* cnt (/ pit seg)))
    (setq point (list x y z))
    (command point)
    ;(princ "\n")(princ cnt)(princ " = ")(princ point)
    (setq cnt (1+ cnt))
    )
    (command "")
    (setq cnt nil)
    (princ)
    )
     
    Adesu, Mar 21, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.