Jump to content

strange results - cannot explain ...help! :)


Recommended Posts

Posted

Hi guys,

It's about a play with parametric equations...trying to obtain a torr...and the result is strange for me, i cannot get real dimensions for the torr..i don't understand why...any help? Sorry for my lisp, looks like hell..:(

 



(defun c:tor ( / R r x y z plist );torr

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun randnum (/  )
 (if (not seed)
     (setq seed (getvar "DATE")))
 (setq modulus    65536
    multiplier    25173
     increment    13849
       seed       (rem (+ (* multiplier seed) increment) modulus)
       random     (/ seed modulus)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun point (xplist)
(setq i 0)  
(repeat (length xplist)  
(entmakex
     (list(cons 0 "POINT")
      (cons 100  "AcDbEntity")
      (cons 67  0)
      (cons 8  "0")
      (cons 100  "AcDbPoint")
      (cons 10 (nth i xplist))
      (cons 62 256)
      (cons 50  0)
     )
)
 (setq i (1+ i))
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (setq x 10000)
 (if
   (and
     (setq R (getreal "\n  R="))
     (setq r (getreal "\n r="))
   )
 (progn
   (setq plist nil)
   (repeat x
         (setq ux  (* pi 2  (randnum)))
         (setq vx  (* pi 2  (randnum)))
     (setq x (*  (+ (* 5 R) (* r  (cos vx)))  (cos ux)    ))
         (setq y (*  (+ (* 5 R) (* r  (cos vx)))  (sin ux )   ))
         (setq z (* r (sin vx)))
         (setq px (list x y z))                      
     (setq plist (cons px plist))
   )
   ))
 (point plist)  
(princ))




Please compare with this one

 



(defun c:tor ( / R r x y z plist );torr

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun randnum (/  )
 (if (not seed)
     (setq seed (getvar "DATE")))
 (setq modulus    65536
    multiplier    25173
     increment    13849
       seed       (rem (+ (* multiplier seed) increment) modulus)
       random     (/ seed modulus)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun point (xplist)
(setq i 0)  
(repeat (length xplist)  
(entmakex
     (list(cons 0 "POINT")
      (cons 100  "AcDbEntity")
      (cons 67  0)
      (cons 8  "0")
      (cons 100  "AcDbPoint")
      (cons 10 (nth i xplist))
      (cons 62 256)
      (cons 50  0)
     )
)
 (setq i (1+ i))
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (setq x 10000)
 (if
   (and
     (setq R (getreal "\n  R="))
     (setq r (getreal "\n r="))
   )
 (progn
   (setq plist nil)
   (repeat x
         (setq ux  (* pi 2  (randnum)))
         (setq vx  (* pi 2  (randnum)))
     (setq x (*  (+ (* 1 R) (* r  (cos vx)))  (cos ux)    ))
         (setq y (*  (+ (* 1 R) (* r  (cos vx)))  (sin ux )   ))
         (setq z (* r (sin vx)))
         (setq px (list x y z))                      
     (setq plist (cons px plist))
   )
   ))
 (point plist)  
(princ))


Posted

(setq R ...
(setq r ...

Try different variable names.

AutoLisp is not case sensitive.

Posted

How can i draw a mesh (surface) through these points? Triangulate? Or to draw a solid ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...