May 3, 2009

Create Involute Curve In AutoCAD Using AutoLISP

Here is a useful LISP program for mechanical engineers, involute curve genaration program for AutoCAD, which is widely used in gear designs and casing of pumps and blowers. Have a look at it.


(defun c:involute()
(defun dtr(x)(* (/ pi 180) x))
(setq echo (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq osmode_1 (getvar "osmode")
ortho_1 (getvar "orthomode")
R1 (getdist "Enter the Base Circle Radius:")
Ang (getint "Enter the Angle of Revolution:")
Orgin 0.0
)
(setvar "orthomode" 0)
(setvar "osmode" 0)
(command "undo" "be")
(command "pline" )
(repeat Ang
(setq X (+ (* R1 (cos (dtr Orgin)))(/(* 2 pi R1 Orgin (cos (dtr(- Orgin 90))))360)))
(setq Y (+ (* R1 (sin (dtr Orgin)))(/(* 2 pi R1 Orgin (sin (dtr(- Orgin 90))))360)))
(setq Orgin (+ Orgin 1))
(setq Cordnte (list X Y))
(command Cordnte)
)
(setq X (+ (* R1 (cos (dtr Orgin)))(/(* 2 pi R1 Orgin (cos (dtr(- Orgin 90))))360)))
(setq Y (+ (* R1 (sin (dtr Orgin)))(/(* 2 pi R1 Orgin (sin (dtr(- Orgin 90))))360)))
(setq Cordnte (list X Y))
(command Cordnte)
(command "")
(command "undo" "e")
(setvar "osmode" osmode_1)
(setvar "orthomode" ortho_1)
(setvar "cmdecho" echo)
)

To run the LISP just type the program name in AutoCAD Command Prompt (Involute)

 


Labels: ,