PDA

View Full Version : 3D Helices in AutoCAD 2000i



shawn.bean
2007-04-12, 07:08 PM
Can someone point me to some code that can create 3DPoly Helices (for use as extrusion paths for springs, threads, and such) in AutoCAD 2000i? Thanks.

-STB

Adesu
2007-04-13, 12:41 AM
Can someone point me to some code that can create 3DPoly Helices (for use as extrusion paths for springs, threads, and such) in AutoCAD 2000i? Thanks.

-STB

Hi shawn,
I have a code to create spring,do you mean like this?


; ccs is stand for Create Coil Spring
; Design by : Adesu <Ade Suharna>
; Email : mteybid@yuasabattery.co.id
; Homepage : http://www.yuasa-battery.co.id
; Create : 24 March 2005
; Program no.: 219/03/2005
; Edit by : Adesu 13/05/2005 1).
; Kevin Nehls 16/05/2005 2).
; Adesu 11/07/2005 3).
; 04/08/2005 4).remove render ("2).")
; 03/09/2005 5).remove ssadd,el3,isolines
; 19/09/2005 6).add error system


(defun c:ccs (/ *error* om lay seg ang cnt rad pit len leng x y z point el p1
rads el1 el2)
(setq *error* myer) ; 6).
(setq om (getvar "osmode")) ; 5).
(setvar "osmode" 0)
(setq lay (getvar "clayer"))
(if
(/= lay "SPRING")
(command "_layer" "m" "SPRING" "c" 1 "" "")
)
(setq seg 36) ; in one circle become 36 part
(setq ang (/ (* 2 pi) seg)) ; (* 2 pi) in radian = 360
(setq cnt 0)
(setq rad (getdist "\nENTER NEW RADIUS<10>: ")) ; 3
(if (= rad nil)(setq rad 10))
(setq pit (getreal "\nENTER NEW PITCH<3>: ")) ; 3
(if (= pit nil)(setq pit 3.0))
(setq len (getdist "\nENTER LENGTH OF SPRING<25>: ")) ; 3
(if (= len nil)(setq len 25))
(setq leng (fix (/ len pit)))
(command "_vpoint" "r" 315 25 "")
(command "_3dpoly")
(repeat leng
(repeat (1+ seg)
(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)
(setq cnt (1+ cnt))
)
)
(command "")
(setq el (entlast)) ; 1).
(setq p1 (polar (list 0 0 0)(* pi 0.5) rad)) ; 1).
(command "_zoom" "d" "")
(setq rads (getdist "\nENTER RADIUS OF WIRE<1.25>: ")) ; 3).
(if (= rads nil)(setq rads 1.25))
(cond ((= rads pit)(setq rads (* pit 0.45)))
((> rads pit)(setq rads (* pit 0.45)))
((> rads (/ pit 2.0))(setq rads (* pit 0.45)))
) ; 3).
(command "_circle" p1 rads) ; 1).
(setq el1 (entlast))
(if (not (member "geom3d.arx" (arx))) ; 1).
(arxload "geom3d")) ; 1).
(rotate3d el1 "y" p1 "r" 0 90) ; 1).
(setq el2 (entlast))
(command "_extrude" el2 "" "p" el) ; 1).
(command "_zoom" "e" "")
(command "_erase" el "") ; 1).
(command "_regen")
(command "_shademode" "g") ; 3).
(setvar "osmode" om)
(setq *error* nil) ; 6).
(princ)
)

(defun myer (msg) ; 6).
(setvar "osmode" om)
(setq att "***Resetting system variable has been done***")
(princ att)
)

shawn.bean
2007-04-13, 02:28 PM
Thanks; it's close, but I really want the ability to do screw threads, too. I might be able to get there from this, though; it's a much simpler method of constructing the extrusion path than I was fiddling with. Thank you for the inspiration!

-STB